AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "AliMCEvent.h"
51 #include "AliAnalysisManager.h"
52 #include "AliAODMCHeader.h"
53 #include "AliAODHandler.h"
54 #include "AliLog.h"
55 #include "AliExternalTrackParam.h"
56 #include "AliAODVertex.h"
57 #include "AliAODRecoDecay.h"
58 #include "AliAODRecoDecayHF.h"
59 #include "AliAODRecoCascadeHF.h"
60 #include "AliAnalysisVertexingHF.h"
61 #include "AliESDtrack.h"
62 #include "AliAODTrack.h"
63 #include "AliAODv0.h"
64 #include "AliAODMCParticle.h"
65 #include "AliAnalysisTaskSE.h"
68 #include "AliAODPidHF.h"
69 #include "AliInputEventHandler.h"
70 #include "AliESDtrackCuts.h"
71 #include "AliNeutralTrackParam.h"
72 #include "AliVertexingHFUtils.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  fAODProtection(1),
92  fIsEventSelected(kFALSE),
93  fWriteVariableTree(kFALSE),
94  fVariablesTree(0),
95  fCandidateVariables(),
96  fVtx1(0),
97  fBzkG(0),
98  fAdditionalChecks(kFALSE),
99  fTrackRotation(kFALSE),
100  fOutputPIDBachTR(0),
101  fMinAngleForRot(5*TMath::Pi()/6),
102  fMaxAngleForRot(7*TMath::Pi()/6),
103  fMinMass(0),
104  fMaxMass(0),
105  fNRotations(9),
106  fPtMinToFillTheTree(0.),
107  fPtMaxToFillTheTree(999.),
108  fUseTPCPIDtoFillTree(kFALSE),
109  fSign(2),
110  fCheckOrigin(kFALSE),
111  fReconstructSecVtx(kFALSE),
112  fDoSingleAnalysisForSystK0SP(0)
113 {
114  //
116  //
117 
118  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
119  fMinMass=mLcPDG-0.250;
120  fMaxMass=mLcPDG+0.250;
121 
122 }
123 //___________________________________________________________________________
125  AliRDHFCutsLctoV0* analCuts, Bool_t useOnTheFly,
126  Bool_t writeVariableTree, Bool_t additionalChecks, Bool_t trackRotation, Bool_t useTPCpid, Char_t sign, Bool_t origin) :
127  AliAnalysisTaskSE(name),
128  fUseMCInfo(kFALSE),
129  fOutput(0),
130  fOutputAll(0),
131  fOutputPIDBach(0),
132  fCEvents(0),
133  fCounter(0),
134  fAnalCuts(analCuts),
135  fUseOnTheFlyV0(useOnTheFly),
136  fAODProtection(1),
137  fIsEventSelected(kFALSE),
138  fWriteVariableTree(writeVariableTree),
139  fVariablesTree(0),
140  fCandidateVariables(),
141  fVtx1(0),
142  fBzkG(0),
143  fAdditionalChecks(additionalChecks),
144  fTrackRotation(trackRotation),
145  fOutputPIDBachTR(0),
146  fMinAngleForRot(5*TMath::Pi()/6),
147  fMaxAngleForRot(7*TMath::Pi()/6),
148  fMinMass(0),
149  fMaxMass(0),
150  fNRotations(9),
151  fPtMinToFillTheTree(0.),
152  fPtMaxToFillTheTree(999.),
153  fUseTPCPIDtoFillTree(useTPCpid),
154  fSign(sign),
155  fCheckOrigin(origin),
156  fReconstructSecVtx(kFALSE),
157  fDoSingleAnalysisForSystK0SP(0)
158 {
159  //
161  //
162  Info("AliAnalysisTaskSELc2V0bachelor","Calling Constructor");
163 
165  AliInfo(Form("You cannot initialize fWriteVariableTree=%d and fTrackRotation=%d => fTrackRotation=0",fWriteVariableTree,fTrackRotation));
166  fTrackRotation=kFALSE;
167  }
168 
169  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
170  fMinMass=mLcPDG-0.250;
171  fMaxMass=mLcPDG+0.250;
172 
173  DefineOutput(1,TList::Class()); //conters
174  DefineOutput(2,AliNormalizationCounter::Class());
175  DefineOutput(3,AliRDHFCutsLctoV0::Class());
176  if (!writeVariableTree) {
177  DefineOutput(4,TList::Class()); //All Entries output
178  DefineOutput(5,TList::Class()); //3sigma PID output
179  if (trackRotation) {
180  DefineOutput(6,TList::Class()); //All Entries output
181  }
182  } else {
183  // Output slot #4 keeps a tree of the candidate variables after track selection
184  DefineOutput(4,TTree::Class()); //My private output
185  }
186 
187  if (fWriteVariableTree) fSign=2;
188 
189 }
190 
191 //___________________________________________________________________________
193  //
195  //
196  Info("~AliAnalysisTaskSELc2V0bachelor","Calling Destructor");
197 
198  if (fOutput) {
199  delete fOutput;
200  fOutput = 0;
201  }
202 
203  if (fOutputAll) {
204  delete fOutputAll;
205  fOutputAll = 0;
206  }
207 
208  if (fOutputPIDBach) {
209  delete fOutputPIDBach;
210  fOutputPIDBach = 0;
211  }
212 
213  if (fCounter) {
214  delete fCounter;
215  fCounter = 0;
216  }
217 
218  if (fAnalCuts) {
219  delete fAnalCuts;
220  fAnalCuts = 0;
221  }
222 
223  if (fVariablesTree) {
224  delete fVariablesTree;
225  fVariablesTree = 0;
226  }
227 
228  if (fOutputPIDBachTR) {
229  delete fOutputPIDBachTR;
230  fOutputPIDBachTR = 0;
231  }
232 
233 }
234 //_________________________________________________
236  //
238  //
239 
240  fIsEventSelected=kFALSE;
241 
242  if (fDebug > 1) AliInfo("Init");
243 
244  PostData(3,fAnalCuts);
245 
246  return;
247 }
248 
249 //_________________________________________________
251 {
253  if (!fInputEvent) {
254  AliError("NO EVENT FOUND!");
255  return;
256  }
257 
258  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
259 
260  if(fAODProtection>=0)
261  {
262  // Protection against different number of events in the AOD and deltaAOD
263  // In case of discrepancy the event is rejected.
264  Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
265  if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 && fAODProtection==1)) {
266  // AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
267  fCEvents->Fill(19);
268  return;
269  }
270  }
271 
272  TClonesArray *arrayLctopKos=0;
273 
274  if (!aodEvent && AODEvent() && IsStandardAOD()) {
275  // In case there is an AOD handler writing a standard AOD, use the AOD
276  // event in memory rather than the input (ESD) event.
277  aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
278  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
279  // have to taken from the AOD event hold by the AliAODExtension
280  AliAODHandler* aodHandler = (AliAODHandler*)
281  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
282 
283  if (aodHandler->GetExtensions()) {
284  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
285  AliAODEvent *aodFromExt = ext->GetAOD();
286  arrayLctopKos=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
287  }
288  } else {
289  arrayLctopKos=(TClonesArray*)aodEvent->GetList()->FindObject("CascadesHF");
290  }
291 
292  fCEvents->Fill(1);
293 
294  if (fUseMCInfo)
296 
297  // AOD primary vertex
298  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
299  if (!fVtx1) return;
300 
301  fIsEventSelected = fAnalCuts->IsEventSelected(aodEvent); // better to initialize before CheckEventSelection call
302 
303  CheckEventSelection(aodEvent);
304 
305 
306  // fix for temporary bug in ESDfilter
307  fBzkG = (Double_t)aodEvent->GetMagneticField();
309  if (TMath::Abs(fBzkG)<0.001) return;
310  fCEvents->Fill(2);
311 
312  if (!arrayLctopKos) {
313  AliInfo("Could not find array of HF cascades, skipping the event");
314  return;
315  } else {
316  if (arrayLctopKos->GetEntriesFast()) {
317  AliInfo(Form("Found %d cascades",arrayLctopKos->GetEntriesFast()));
318  }
319  }
320  fCEvents->Fill(3);
321 
322  // mc analysis
323  TClonesArray *mcArray = 0;
324  AliAODMCHeader *mcHeader=0;
325 
326  if (fUseMCInfo) {
327  // MC array need for maching
328  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
329  if (!mcArray) {
330  AliError("Could not find Monte-Carlo in AOD");
331  return;
332  }
333  fCEvents->Fill(4); // in case of MC events
334 
335  // load MC header
336  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
337  if (!mcHeader) {
338  AliError("AliAnalysisTaskSELc2V0bachelor::UserExec: MC header branch not found!\n");
339  return;
340  }
341  fCEvents->Fill(5); // in case of MC events
342 
343  Double_t zMCVertex = mcHeader->GetVtxZ();
344  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
345  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
346  return;
347  } else {
348  fCEvents->Fill(17); // in case of MC events
349  }
350  }
351 
352  Int_t runnumber = aodEvent->GetRunNumber();
353  if (aodEvent->GetTriggerMask() == 0 && (runnumber >= 195344 && runnumber <= 195677)){
354  AliDebug(3,"Event rejected because of null trigger mask");
355  return;
356  }
357 
358  fCounter->StoreEvent(aodEvent,fAnalCuts,fUseMCInfo); // it is very important that it stays BEFORE any other event selection
359 
360  if (fVtx1->GetNContributors()>0) // this check is done in IsEventSelected
361  fCEvents->Fill(6);
362 
363  if ( !fIsEventSelected ) return; // don't take into account not selected events
364  fCEvents->Fill(7);
365 
367  MakeSingleAnalysisForSystK0SP(aodEvent,mcArray,fAnalCuts);
368  if(fDoSingleAnalysisForSystK0SP==2) return;
369  }
370 
371  Int_t nSelectedAnal = 0;
372  MakeAnalysisForLc2prK0S(aodEvent,arrayLctopKos,mcArray, nSelectedAnal, fAnalCuts);
373 
374  if (nSelectedAnal)
376 
377  fCounter->StoreCandidates(aodEvent,nSelectedAnal,kTRUE);
378  fCounter->StoreCandidates(aodEvent,nSelectedAnal,kFALSE);
379 
380  PostData(1,fOutput);
381  PostData(2,fCounter);
382  if (!fWriteVariableTree) {
383  PostData(4,fOutputAll);
384  PostData(5,fOutputPIDBach);
385  if (fTrackRotation)
386  PostData(6,fOutputPIDBachTR);
387  } else {
388  PostData(4,fVariablesTree);
389  }
390 
391  fIsEventSelected=kFALSE;
392 
393  return;
394 }
395 
396 //________________________________________ terminate ___________________________
398 {
399  // The Terminate() function is the last function to be called during
400  // a query. It always runs on the client, it can be used to present
401  // the results graphically or save the results to file.
402 
403  //AliInfo("Terminate","");
404  AliAnalysisTaskSE::Terminate();
405 
406  fOutput = dynamic_cast<TList*> (GetOutputData(1));
407  if (!fOutput) {
408  AliError("fOutput not available");
409  return;
410  }
411 
412  //fCEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fCEvents"));
413  if (!fWriteVariableTree) {
414  fOutputAll = dynamic_cast<TList*> (GetOutputData(4));
415  if (!fOutputAll) {
416  AliError("fOutputAll not available");
417  return;
418  }
419 
420  fOutputPIDBach = dynamic_cast<TList*> (GetOutputData(5));
421  if (!fOutputPIDBach) {
422  AliError("fOutputPIDBach not available");
423  return;
424  }
425 
426  if (fTrackRotation) {
427  fOutputPIDBachTR = dynamic_cast<TList*> (GetOutputData(6));
428  if (!fOutputPIDBachTR) {
429  AliError("fOutputPIDBachTR not available");
430  return;
431  }
432  }
433 
434  } else {
435  fVariablesTree = dynamic_cast<TTree*> (GetOutputData(4));
436  if (!fVariablesTree) {
437  AliError("fVariablesTree not available");
438  return;
439  }
440  }
441 
442  return;
443 }
444 //___________________________________________________________________________
447  AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
448 
449  fOutput = new TList();
450  fOutput->SetOwner();
451  fOutput->SetName("chist0");
452  DefineGeneralHistograms(); // define general histograms
453  PostData(1,fOutput);
454 
455  fCounter = new AliNormalizationCounter("NormalizationCounter");
456  fCounter->Init();
457  PostData(2,fCounter);
458 
459  if (!fWriteVariableTree) {
460 
461  fOutputAll = new TList();
462  fOutputAll->SetOwner();
463  fOutputAll->SetName("listAll");
464 
465  fOutputPIDBach = new TList();
466  fOutputPIDBach->SetOwner();
467  fOutputPIDBach->SetName("listPIDBach");
468 
469  if (fTrackRotation) {
470  fOutputPIDBachTR = new TList();
471  fOutputPIDBachTR->SetOwner();
472  fOutputPIDBachTR->SetName("listPIDBachTR");
473  }
474 
475  DefineK0SHistos(); // define analysis histograms
476  if (fUseMCInfo && fCheckOrigin) DefineSignalHistosSeparatedPerOrigin(); // define analysis histograms for SNG separated for origin
477 
478  PostData(4,fOutputAll);
479  PostData(5,fOutputPIDBach);
480 
481  if (fTrackRotation)
482  PostData(6,fOutputPIDBachTR);
483 
484  }
485  else {
487  PostData(4,fVariablesTree);
488  }
489 
490  return;
491 }
492 
493 //-------------------------------------------------------------------------------
494 void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(AliAODEvent *aodEvent,TClonesArray *arrayLctopKos,
495  TClonesArray *mcArray,
496  Int_t &nSelectedAnal,
497  AliRDHFCutsLctoV0 *cutsAnal)
498 {
499 
501 
502  Int_t pdgCand = 4122;
503  Int_t pdgDgLctoV0bachelor[2]={2212,310}; // always 1st bachelor, 2nd V0
504  Int_t pdgDgV0toDaughters[2]={211,211};
505 
506  // loop over cascades to search for candidates Lc->p+K0S
507  Int_t nCascades= arrayLctopKos->GetEntriesFast();
508  if (nCascades==0) {
509  AliInfo("Could not find cascades, skipping the event");
510  return;
511  }
513  for (Int_t iLctopK0S = 0; iLctopK0S<nCascades; iLctopK0S++) {
514 
515  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(0);
516 
517  // Lc candidates and K0S from Lc
518  AliAODRecoCascadeHF* lcK0Spr = dynamic_cast<AliAODRecoCascadeHF*>(arrayLctopKos->At(iLctopK0S));
519  if (!lcK0Spr) {
520  AliDebug(2,Form("Cascade %d doens't exist, skipping",iLctopK0S));
521  continue;
522  }
523 
524  if (!(lcK0Spr->CheckCascadeFlags())) {
525  AliDebug(2,Form("Cascade %d is not flagged as Lc candidate",iLctopK0S));
526  continue;
527  }
528 
529  Bool_t unsetvtx=kFALSE;
530  if (!lcK0Spr->GetOwnPrimaryVtx()) {
531  lcK0Spr->SetOwnPrimaryVtx(fVtx1);
532  unsetvtx=kTRUE;
533  }
534 
535  if(!vHF->FillRecoCasc(aodEvent,lcK0Spr,kFALSE)){//Fill the data members of the candidate only if they are empty.
536  fCEvents->Fill(18);//monitor how often this fails
537  continue;
538  }
539  if (fReconstructSecVtx) {
540  if (!(vHF->RecoSecondaryVertexForCascades(aodEvent, lcK0Spr))) {
541  continue;
542  }
543  }
544  if (!lcK0Spr->GetSecondaryVtx()) {
545  AliInfo("No secondary vertex"); // it will be done in AliRDHFCutsLctoV0::IsSelected
546  continue;
547  }
548 
549  if (lcK0Spr->GetNDaughters()!=2) {
550  AliDebug(2,Form("Cascade %d has not 2 daughters (nDaughters=%d)",iLctopK0S,lcK0Spr->GetNDaughters())); // it will be done in AliRDHFCutsLctoV0::IsSelected
551  continue;
552  }
553 
554  if ( (fSign == 0 && lcK0Spr->Charge()<0) ||
555  (fSign == 1 && lcK0Spr->Charge()>0) ) {
556  AliDebug(2,Form("Charge of the cascade %d is different with respect to the required one",iLctopK0S)); //
557  continue;
558  }
559 
560  AliAODv0 * v0part = dynamic_cast<AliAODv0*>(lcK0Spr->Getv0());
561  AliAODTrack * bachPart = dynamic_cast<AliAODTrack*>(lcK0Spr->GetBachelor());
562  if (!v0part || !bachPart) {
563  AliDebug(2,Form("Cascade %d has no V0 or no bachelor object",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
564  continue;
565  }
566 
567  if (!v0part->GetSecondaryVtx()) {
568  AliDebug(2,Form("No secondary vertex for V0 by cascade %d",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
569  continue;
570  }
571 
572  if (v0part->GetNDaughters()!=2) {
573  AliDebug(2,Form("current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters())); // it will be done in AliRDHFCutsLctoV0::IsSelected
574  continue;
575  }
576 
577  AliAODTrack * v0Pos = dynamic_cast<AliAODTrack*>(lcK0Spr->Getv0PositiveTrack());
578  AliAODTrack * v0Neg = dynamic_cast<AliAODTrack*>(lcK0Spr->Getv0NegativeTrack());
579  if (!v0Neg || !v0Pos) {
580  AliDebug(2,Form("V0 by cascade %d has no V0positive of V0negative object",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
581  continue;
582  }
583 
584  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(1);
585 
586  if (v0Pos->Charge() == v0Neg->Charge()) continue;
587 
588  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(2);
589 
590  Int_t isLc = 0;
591  Int_t originLc = -1; // -1 -> RD; 0 -> BKG; 1 -> form c; 2 -> from b; 3 -> not from quark
592 
593  if (fUseMCInfo) {
594 
595  Int_t pdgCode=-2;
596 
597  // find associated MC particle for Lc -> p+K0 and K0S->pi+pi
598  Int_t mcLabel = lcK0Spr->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE);
599  if (mcLabel!=-1) {
600  AliDebug(2,Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0S,nCascades));
601 
602  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
603  if (partLc) {
604  pdgCode = partLc->GetPdgCode();
605  if (pdgCode<0) AliDebug(2,Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
606  pdgCode = TMath::Abs(pdgCode);
607  isLc = 1;
609  Int_t pdgMom = util->CheckOrigin(mcArray,partLc,kFALSE);
610  if (pdgMom == 4) {
611  originLc=1; // from c
612  } else if (pdgMom == 5) {
613  originLc=2; // form b
614  } else {
615  Int_t isThereaQuark=util->CheckOrigin(mcArray,partLc,kTRUE);
616  if (isThereaQuark<=0) originLc=3; // not from q
617  }
618  delete util;
619  }
620  } else {
621  AliDebug(2,Form("No MC candidate (cascade number %d -total cascade number = %d -)", iLctopK0S,nCascades));
622  pdgCode=-1;
623  }
624  } else {
625  originLc=-1; // real data
626  }
627 
628  FillLc2pK0Sspectrum(lcK0Spr, isLc,
629  nSelectedAnal, cutsAnal,
630  mcArray, originLc);
631 
632  if (unsetvtx) lcK0Spr->UnsetOwnPrimaryVtx();
633 
634  }
635 
636  delete vHF;
637  AliDebug(2, Form("Found %d Reco particles that are Lc!!", nSelectedAnal));
638 
639  return;
640 }
641 
642 //________________________________________________________________________
644  Int_t isLc,
645  Int_t &nSelectedAnal,
646  AliRDHFCutsLctoV0 *cutsAnal,
647  TClonesArray *mcArray,
648  Int_t originLc)
649 {
650  //
652  //
653 
654  TString fillthis="";
655 
656  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
657  Double_t momBach = bachelor->P();
658 
659  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
660  Bool_t onFlyV0 = v0part->GetOnFlyStatus(); // on-the-flight V0s
661 
662  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
663  cutsAnal->SetUsePID(kFALSE);
664  Bool_t isInCascadeWindow = (((cutsAnal->IsSelectedSingleCut(part,AliRDHFCuts::kCandidate,0))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // cut on Lc->p+K0S invMass
665  cutsAnal->SetUsePID(areCutsUsingPID);
666 
667  if ( onFlyV0 && !fUseOnTheFlyV0 ) return;
668 
670 
671  // track rotation
672  if (fTrackRotation) {
673  if (onFlyV0) {
674  TrackRotation(cutsAnal,part,"");
675  }
676  else {
677  TrackRotation(cutsAnal,part,"Offline");
678  }
679  if (fUseMCInfo) {
680  if (isLc==1) {
681  if (onFlyV0) {
682  TrackRotation(cutsAnal,part,"Sgn");
683  }
684  else {
685  TrackRotation(cutsAnal,part,"OfflineSgn");
686  }
687  }// sgn
688  else { // bkg
689  if (onFlyV0) {
690  TrackRotation(cutsAnal,part,"Bkg");
691  }
692  else {
693  TrackRotation(cutsAnal,part,"OfflineBkg");
694  }
695  }
696  } // if fUseMCInfo
697  } // if fTrackRotation
698 
699 
700 
701 
702  if ( !(cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122))) ) return;
703 
705 
706  if ( ( ( (cutsAnal->IsSelected(part,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) ) nSelectedAnal++;
707 
708  // Fill candidate variable Tree (track selection, V0 invMass selection)
709  if ( fWriteVariableTree ) {
710  Double_t invmassK0S = v0part->MassK0Short();
711  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
712  Double_t nSigmaTPCpr=-999.;
713  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
714  if ( !onFlyV0 && isInCascadeWindow &&
715  part->CosV0PointingAngle()>0.99 && TMath::Abs(invmassK0S-mk0sPDG)<=0.05 &&
716  part->Pt()>=fPtMinToFillTheTree && part->Pt()<fPtMaxToFillTheTree &&
717  (!fUseTPCPIDtoFillTree || (fUseTPCPIDtoFillTree && TMath::Abs(nSigmaTPCpr)<3.)))
718  FillTheTree(part,cutsAnal,mcArray,isLc,originLc);
719  return;
720  }
721 
722  cutsAnal->SetUsePID(kFALSE);
723  Bool_t isCandidateSelectedCuts = (((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // kinematic/topological cuts
724  cutsAnal->SetUsePID(areCutsUsingPID);
725  Bool_t isBachelorID = (((cutsAnal->IsSelected(part,AliRDHFCuts::kPID))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // ID x bachelor
726 
727  //if (((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)) {
729  if (fUseMCInfo && isLc && !fWriteVariableTree) {
730  Int_t pdgCand1 = 4122;
731  Int_t pdgDgLctoV0bachelor1[2]={2212,310};
732  Int_t pdgDgV0toDaughters1[2]={211,211};
733  Int_t mcLabel1=part->MatchToMC(pdgCand1,pdgDgLctoV0bachelor1[1],pdgDgLctoV0bachelor1,pdgDgV0toDaughters1,mcArray,kTRUE);
734  AliDebug(2,Form(" Found true MC candidate: Lc->pK0S(%d) - onTheFly=%1d",mcLabel1,onFlyV0));
735  }
736  }
737 
738  Double_t nSigmaTPCpr=-999.;
739  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
740  Double_t nSigmaTOFpr=-999.;
741  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,4,nSigmaTOFpr);
742 
743  Double_t nSigmaTPCpi=-999.;
744  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,2,nSigmaTPCpi);
745  Double_t nSigmaTOFpi=-999.;
746  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,2,nSigmaTOFpi);
747 
748  Double_t nSigmaTPCka=-999.;
749  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,3,nSigmaTPCka);
750  Double_t nSigmaTOFka=-999.;
751  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,3,nSigmaTOFka);
752 
753  if (onFlyV0) {
754 
755  fillthis="histArmPodK0S";
756  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
757 
758  fillthis="histArmPodLc";
759  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
760 
761  //if (isCandidateSelectedCuts) {
762  FillAnalysisHistograms(part,cutsAnal,"");
763  //}
764  }
765  else {
766 
767  fillthis="histArmPodK0SOffline";
768  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
769 
770  fillthis="histArmPodLcOffline";
771  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
772 
773  FillAnalysisHistograms(part,cutsAnal,"Offline");
774  if (isCandidateSelectedCuts) {
775  fillthis="histoprotonBachSigmaVspTOF";
776  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
777  fillthis="histoprotonBachSigmaVspTPC";
778  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
779  //FillAnalysisHistograms(part,cutsAnal,"Offline");
780  }
781  }
782  if (fUseMCInfo) {
783  if (isLc==1) {
784  if (onFlyV0) {
785 
786  fillthis="histArmPodK0SSgn";
787  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
788 
789  fillthis="histArmPodLcSgn";
790  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
791 
792  //if (isCandidateSelectedCuts) {
793  FillAnalysisHistograms(part,cutsAnal,"Sgn");
794  //}
795  if (fCheckOrigin) {
796  switch (originLc) {
797  case 1:
798  FillAnalysisHistograms(part,cutsAnal,"SgnC");
799  break;
800  case 2:
801  FillAnalysisHistograms(part,cutsAnal,"SgnB");
802  break;
803  case 3:
804  FillAnalysisHistograms(part,cutsAnal,"SgnNoQ");
805  break;
806  }
807  }
808  }
809  else {
810 
811  fillthis="histArmPodK0SOfflineSgn";
812  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
813 
814  fillthis="histArmPodLcOfflineSgn";
815  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
816 
817  if (isCandidateSelectedCuts) {
818  fillthis="histoprotonBachSigmaVspTOFsgn";
819  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
820  fillthis="histoprotonBachSigmaVspTPCsgn";
821  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
822  //FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
823  }
824 
825  if (fCheckOrigin) {
826  switch (originLc) {
827  case 1:
828  FillAnalysisHistograms(part,cutsAnal,"OfflineSgnC");
829  break;
830  case 2:
831  FillAnalysisHistograms(part,cutsAnal,"OfflineSgnB");
832  break;
833  case 3:
834  FillAnalysisHistograms(part,cutsAnal,"OfflineSgnNoQ");
835  break;
836  }
837  }
838  FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
839 
840  }
841  }// sgn
842  else { // bkg
843  if (onFlyV0) {
844 
845  fillthis="histArmPodK0SBkg";
846  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
847 
848  fillthis="histArmPodLcBkg";
849  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
850 
851  //if (isCandidateSelectedCuts) {
852  FillAnalysisHistograms(part,cutsAnal,"Bkg");
853  //}
854  }
855  else {
856 
857  fillthis="histArmPodK0SOfflineBkg";
858  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
859 
860  fillthis="histArmPodLcOfflineBkg";
861  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
862 
863  FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
864  if (isCandidateSelectedCuts) {
865  fillthis="histoprotonBachSigmaVspTOFbkg";
866  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
867  fillthis="histoprotonBachSigmaVspTPCbkg";
868  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
869  //FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
870  }
871  }
872  }
873  } // if fUseMCInfo
874 
875  return;
876 }
877 
878 //----------------------------------------------------
880 {
881 
882  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
883  Double_t mK0SPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
884  Double_t mMinLambdaPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass()+
885  TDatabasePDG::Instance()->GetParticle(211)->Mass();
886  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
887 
888  TString nameHisto=" ", nameHistoSgn=" ", nameHistoBkg=" ";
889  TString titleHisto=" ", titleHistoSgn=" ", titleHistoBkg=" ";
890 
891  // pt(Lc)
892  Double_t *binLimpTLc=new Double_t[11+1]; // 11 pT(Lc) bins
893  binLimpTLc[ 0]= 0.;
894  binLimpTLc[ 1]= 1.;
895  binLimpTLc[ 2]= 2.;
896  binLimpTLc[ 3]= 3.;
897  binLimpTLc[ 4]= 4.;
898  binLimpTLc[ 5]= 5.;
899  binLimpTLc[ 6]= 6.;
900  binLimpTLc[ 7]= 8.;
901  binLimpTLc[ 8]=12.;
902  binLimpTLc[ 9]=17.;
903  binLimpTLc[10]=25.;
904  binLimpTLc[11]=35.;
905 
906  // pt(prong)
907  Double_t *binLimpTprong=new Double_t[41+1]; // 41 pT(prong) bins
908  binLimpTprong[ 0]= 0.0;
909  binLimpTprong[ 1]= 0.1;
910  binLimpTprong[ 2]= 0.2;
911  binLimpTprong[ 3]= 0.3;
912  binLimpTprong[ 4]= 0.4;
913  binLimpTprong[ 5]= 0.5;
914  binLimpTprong[ 6]= 0.6;
915  binLimpTprong[ 7]= 0.7;
916  binLimpTprong[ 8]= 0.8;
917  binLimpTprong[ 9]= 0.9;
918  binLimpTprong[10]= 1.0;
919  binLimpTprong[11]= 1.2;
920  binLimpTprong[12]= 1.4;
921  binLimpTprong[13]= 1.6;
922  binLimpTprong[14]= 1.8;
923  binLimpTprong[15]= 2.0;
924  binLimpTprong[16]= 2.2;
925  binLimpTprong[17]= 2.4;
926  binLimpTprong[18]= 2.6;
927  binLimpTprong[19]= 2.8;
928  binLimpTprong[20]= 3.0;
929  binLimpTprong[21]= 3.5;
930  binLimpTprong[22]= 4.0;
931  binLimpTprong[23]= 4.5;
932  binLimpTprong[24]= 5.0;
933  binLimpTprong[25]= 5.5;
934  binLimpTprong[26]= 6.0;
935  binLimpTprong[27]= 6.5;
936  binLimpTprong[28]= 7.0;
937  binLimpTprong[29]= 7.5;
938  binLimpTprong[30]= 8.0;
939  binLimpTprong[31]= 9.0;
940  binLimpTprong[32]=10.0;
941  binLimpTprong[33]=11.0;
942  binLimpTprong[34]=12.0;
943  binLimpTprong[35]=13.0;
944  binLimpTprong[36]=14.0;
945  binLimpTprong[37]=15.0;
946  binLimpTprong[38]=20.0;
947  binLimpTprong[39]=25.0;
948  binLimpTprong[40]=30.0;
949  binLimpTprong[41]=35.0;
950 
951  if (fUseOnTheFlyV0) {
952 
953  // V0 invariant masses (on-the-fly)
954  nameHisto="histK0SMass";
955  titleHisto="K^{0}_{S} invariant mass VS p_{T}; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
956  TH2F* spectrumK0SMass = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
957 
958  // Lc invariant masses (x K0S on-the-fly)
959  nameHisto="histLcMassByK0S";
960  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]";
961  TH2F* spectrumLcMassByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
962 
963  nameHisto="histpK0Svsp";
964  titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
965  TH2F* momentumDistributionK0Svsp = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
966 
967  nameHisto="histArmPodK0S";
968  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
969  TH2F* armenterosPodK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
970 
971  nameHisto="histArmPodLc";
972  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
973  TH2F* armenterosPodLc = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
974 
975  TH2F* allspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone();
976  TH2F* allspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
977  TH2F* allmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
978  TH2F* allArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
979  TH2F* allArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
980 
981  TH2F* pidBachspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone();
982  TH2F* pidBachspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
983  TH2F* pidBachmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
984  TH2F* pidBachArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
985  TH2F* pidBachArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
986 
987  fOutputAll->Add(allspectrumK0SMass);
988  fOutputAll->Add(allspectrumLcMassByK0S);
989  fOutputAll->Add(allmomentumDistributionK0Svsp);
990  fOutputAll->Add(allArmenterosPodK0S);
991  fOutputAll->Add(allArmenterosPodLc);
992 
993  fOutputPIDBach->Add(pidBachspectrumK0SMass);
994  fOutputPIDBach->Add(pidBachspectrumLcMassByK0S);
995  fOutputPIDBach->Add(pidBachmomentumDistributionK0Svsp);
996  fOutputPIDBach->Add(pidBachArmenterosPodK0S);
997  fOutputPIDBach->Add(pidBachArmenterosPodLc);
998 
999  nameHisto="histArmPodK0S0";
1000  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1001  TH2F* armenterosPodK0S0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
1002  nameHisto="histArmPodLc0";
1003  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1004  TH2F* armenterosPodLc0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
1005  fOutputAll->Add(armenterosPodK0S0);
1006  fOutputAll->Add(armenterosPodLc0);
1007 
1008 
1009  if (fTrackRotation) {
1010  TH2F* pidBachTRspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
1011  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0S);
1012  }
1013 
1014 
1015 
1016  nameHisto="histptK0S";
1017  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";
1018  TH2F* ptK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1019 
1020  nameHisto="histptP";
1021  titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1022  TH2F* ptP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1023 
1024  nameHisto="histptPip";
1025  titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1026  TH2F* ptPiP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1027 
1028  nameHisto="histptPim";
1029  titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1030  TH2F* ptPiM = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1031 
1032  nameHisto="histLambdaMass";
1033  titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1034  TH2F* massLambda = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1035 
1036  nameHisto="histLambdaBarMass";
1037  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";
1038  TH2F* massLambdaBar = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1039 
1040  nameHisto="histGammaMass";
1041  titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1042  TH2F* massGamma = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
1043 
1044  nameHisto="histD0K0S";
1045  titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1046  TH2F* d0K0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1047 
1048  nameHisto="histD0P";
1049  titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1050  TH2F* d0P = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1051 
1052  nameHisto="histCosPAK0S";
1053  titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1054  TH2F *cosPAK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
1055 
1056  nameHisto="histCosThetaProtonCMS";
1057  titleHisto="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1058  TH2F *cosThePr = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,-1.,1.);
1059 
1060  nameHisto="histResignedD0";
1061  titleHisto="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1062  TH2F *resignedD0 = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,-0.1,0.1);
1063 
1064  TH2F* allptK0S = (TH2F*)ptK0S->Clone();
1065  TH2F* allptP = (TH2F*)ptP->Clone();
1066  TH2F* allptPiP = (TH2F*)ptPiP->Clone();
1067  TH2F* allptPiM = (TH2F*)ptPiM->Clone();
1068  TH2F* allmassLambda = (TH2F*)massLambda->Clone();
1069  TH2F* allmassLambdaBar = (TH2F*)massLambdaBar->Clone();
1070  TH2F* allmassGamma = (TH2F*)massGamma->Clone();
1071  TH2F* alld0K0S = (TH2F*)d0K0S->Clone();
1072  TH2F* alld0P = (TH2F*)d0P->Clone();
1073  TH2F* allcosPAK0S = (TH2F*)cosPAK0S->Clone();
1074  TH2F* allcosThePr = (TH2F*)cosThePr->Clone();
1075  TH2F* allresignedD0 = (TH2F*)resignedD0->Clone();
1076 
1077  TH2F* pidptK0S = (TH2F*)ptK0S->Clone();
1078  TH2F* pidptP = (TH2F*)ptP->Clone();
1079  TH2F* pidptPiP = (TH2F*)ptPiP->Clone();
1080  TH2F* pidptPiM = (TH2F*)ptPiM->Clone();
1081  TH2F* pidmassLambda = (TH2F*)massLambda->Clone();
1082  TH2F* pidmassLambdaBar = (TH2F*)massLambdaBar->Clone();
1083  TH2F* pidmassGamma = (TH2F*)massGamma->Clone();
1084  TH2F* pidd0K0S = (TH2F*)d0K0S->Clone();
1085  TH2F* pidd0P = (TH2F*)d0P->Clone();
1086  TH2F* pidcosPAK0S = (TH2F*)cosPAK0S->Clone();
1087  TH2F* pidcosThePr = (TH2F*)cosThePr->Clone();
1088  TH2F* pidresignedD0 = (TH2F*)resignedD0->Clone();
1089 
1090  fOutputAll->Add(allptK0S);
1091  fOutputAll->Add(allptP);
1092  fOutputAll->Add(allptPiP);
1093  fOutputAll->Add(allptPiM);
1094  fOutputAll->Add(allmassLambda);
1095  fOutputAll->Add(allmassLambdaBar);
1096  fOutputAll->Add(allmassGamma);
1097  fOutputAll->Add(alld0K0S);
1098  fOutputAll->Add(alld0P);
1099  fOutputAll->Add(allcosPAK0S);
1100  fOutputAll->Add(allcosThePr);
1101  fOutputAll->Add(allresignedD0);
1102 
1103  fOutputPIDBach->Add(pidptK0S);
1104  fOutputPIDBach->Add(pidptP);
1105  fOutputPIDBach->Add(pidptPiP);
1106  fOutputPIDBach->Add(pidptPiM);
1107  fOutputPIDBach->Add(pidmassLambda);
1108  fOutputPIDBach->Add(pidmassLambdaBar);
1109  fOutputPIDBach->Add(pidmassGamma);
1110  fOutputPIDBach->Add(pidd0K0S);
1111  fOutputPIDBach->Add(pidd0P);
1112  fOutputPIDBach->Add(pidcosPAK0S);
1113  fOutputPIDBach->Add(pidcosThePr);
1114  fOutputPIDBach->Add(pidresignedD0);
1115 
1116  if (fTrackRotation) {
1117 
1118  TH2F* pidTRptK0S = (TH2F*)ptK0S->Clone();
1119  TH2F* pidTRptP = (TH2F*)ptP->Clone();
1120  TH2F* pidTRptPiP = (TH2F*)ptPiP->Clone();
1121  TH2F* pidTRptPiM = (TH2F*)ptPiM->Clone();
1122  TH2F* pidTRmassLambda = (TH2F*)massLambda->Clone();
1123  TH2F* pidTRmassLambdaBar = (TH2F*)massLambdaBar->Clone();
1124  TH2F* pidTRmassGamma = (TH2F*)massGamma->Clone();
1125  TH2F* pidTRcosPAK0S = (TH2F*)cosPAK0S->Clone();
1126  TH2F* pidTRcosThePr = (TH2F*)cosThePr->Clone();
1127  TH2F* pidTRresignedD0 = (TH2F*)resignedD0->Clone();
1128  fOutputPIDBachTR->Add(pidTRptK0S);
1129  fOutputPIDBachTR->Add(pidTRptP);
1130  fOutputPIDBachTR->Add(pidTRptPiP);
1131  fOutputPIDBachTR->Add(pidTRptPiM);
1132  fOutputPIDBachTR->Add(pidTRmassLambda);
1133  fOutputPIDBachTR->Add(pidTRmassLambdaBar);
1134  fOutputPIDBachTR->Add(pidTRmassGamma);
1135  fOutputPIDBachTR->Add(pidTRcosPAK0S);
1136  fOutputPIDBachTR->Add(pidTRcosThePr);
1137  fOutputPIDBachTR->Add(pidTRresignedD0);
1138 
1139  }
1140 
1141  }
1142 
1143  // V0 invariant masses (offline)
1144  nameHisto="histK0SMassOffline";
1145  titleHisto="K^{0}_{S} invariant mass VS p_{T}; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1146  TH2F* spectrumK0SMassOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1147 
1148  // Lc invariant masses (x K0S offline)
1149  nameHisto="histLcMassByK0SOffline";
1150  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]";
1151  TH2F* spectrumLcMassOfflineByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1152 
1153  nameHisto="histpK0SvspOffline";
1154  titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1155  TH2F* momentumDistributionK0SvspOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
1156 
1157  nameHisto="histArmPodK0SOffline";
1158  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1159  TH2F* armenterosPodK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
1160 
1161  nameHisto="histArmPodLcOffline";
1162  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1163  TH2F* armenterosPodLcOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
1164 
1165  TH2F* allspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone();
1166  TH2F* allspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1167  TH2F* allmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
1168  TH2F* allArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
1169  TH2F* allArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
1170 
1171  TH2F* pidBachspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone();
1172  TH2F* pidBachspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1173  TH2F* pidBachmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
1174  TH2F* pidBachArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
1175  TH2F* pidBachArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
1176 
1177  fOutputAll->Add(allspectrumK0SMassOffline);
1178  fOutputAll->Add(allspectrumLcMassOfflineByK0S);
1179  fOutputAll->Add(allmomentumDistributionK0SvspOffline);
1180  fOutputAll->Add(allArmenterosPodK0SOffline);
1181  fOutputAll->Add(allArmenterosPodLcOffline);
1182 
1183  fOutputPIDBach->Add(pidBachspectrumK0SMassOffline);
1184  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0S);
1185  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOffline);
1186  fOutputPIDBach->Add(pidBachArmenterosPodK0SOffline);
1187  fOutputPIDBach->Add(pidBachArmenterosPodLcOffline);
1188 
1189  nameHisto="histArmPodK0SOffline0";
1190  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1191  TH2F* armenterosPodK0SOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
1192  nameHisto="histArmPodLcOffline0";
1193  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1194  TH2F* armenterosPodLcOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
1195  fOutputAll->Add(armenterosPodK0SOffline0);
1196  fOutputAll->Add(armenterosPodLcOffline0);
1197 
1198  if (fTrackRotation) {
1199  TH2F* pidBachTRspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1200  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0S);
1201  }
1202 
1203 
1204 
1205 
1206  nameHisto="histptK0SOffline";
1207  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";
1208  TH2F* ptK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1209 
1210  nameHisto="histptPOffline";
1211  titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1212  TH2F* ptPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1213 
1214  nameHisto="histptPipOffline";
1215  titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1216  TH2F* ptPiPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1217 
1218  nameHisto="histptPimOffline";
1219  titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1220  TH2F* ptPiMOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1221 
1222  nameHisto="histLambdaMassOffline";
1223  titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1224  TH2F* massLambdaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1225 
1226  nameHisto="histLambdaBarMassOffline";
1227  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";
1228  TH2F* massLambdaBarOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1229 
1230  nameHisto="histGammaMassOffline";
1231  titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1232  TH2F* massGammaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
1233 
1234  nameHisto="histD0K0SOffline";
1235  titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1236  TH2F* d0K0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1237 
1238  nameHisto="histD0POffline";
1239  titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1240  TH2F* d0POffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1241 
1242  nameHisto="histCosPAK0SOffline";
1243  titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1244  TH2F *cosPAK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
1245 
1246  nameHisto="histCosThetaProtonCMSOffline";
1247  titleHisto="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1248  TH2F *cosThePrOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,-1.,1.);
1249 
1250  nameHisto="histResignedD0Offline";
1251  titleHisto="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1252  TH2F *resignedD0Offline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,-0.1,0.1);
1253 
1254 
1255  TH2F* allptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1256  TH2F* allptPOffline = (TH2F*)ptPOffline->Clone();
1257  TH2F* allptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1258  TH2F* allptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1259  TH2F* allmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1260  TH2F* allmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1261  TH2F* allmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1262  TH2F* alld0K0SOffline = (TH2F*)d0K0SOffline->Clone();
1263  TH2F* alld0POffline = (TH2F*)d0POffline->Clone();
1264  TH2F* allcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1265  TH2F* allcosThePrOffline = (TH2F*)cosThePrOffline->Clone();
1266  TH2F* allresignedD0Offline = (TH2F*)resignedD0Offline->Clone();
1267 
1268  TH2F* pidptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1269  TH2F* pidptPOffline = (TH2F*)ptPOffline->Clone();
1270  TH2F* pidptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1271  TH2F* pidptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1272  TH2F* pidmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1273  TH2F* pidmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1274  TH2F* pidmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1275  TH2F* pidd0K0SOffline = (TH2F*)d0K0SOffline->Clone();
1276  TH2F* pidd0POffline = (TH2F*)d0POffline->Clone();
1277  TH2F* pidcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1278  TH2F* pidcosThePrOffline = (TH2F*)cosThePrOffline->Clone();
1279  TH2F* pidresignedD0Offline = (TH2F*)resignedD0Offline->Clone();
1280 
1281  fOutputAll->Add(allptK0SOffline);
1282  fOutputAll->Add(allptPOffline);
1283  fOutputAll->Add(allptPiPOffline);
1284  fOutputAll->Add(allptPiMOffline);
1285  fOutputAll->Add(allmassLambdaOffline);
1286  fOutputAll->Add(allmassLambdaBarOffline);
1287  fOutputAll->Add(allmassGammaOffline);
1288  fOutputAll->Add(alld0K0SOffline);
1289  fOutputAll->Add(alld0POffline);
1290  fOutputAll->Add(allcosPAK0SOffline);
1291  fOutputAll->Add(allcosThePrOffline);
1292  fOutputAll->Add(allresignedD0Offline);
1293 
1294  fOutputPIDBach->Add(pidptK0SOffline);
1295  fOutputPIDBach->Add(pidptPOffline);
1296  fOutputPIDBach->Add(pidptPiPOffline);
1297  fOutputPIDBach->Add(pidptPiMOffline);
1298  fOutputPIDBach->Add(pidmassLambdaOffline);
1299  fOutputPIDBach->Add(pidmassLambdaBarOffline);
1300  fOutputPIDBach->Add(pidmassGammaOffline);
1301  fOutputPIDBach->Add(pidd0K0SOffline);
1302  fOutputPIDBach->Add(pidd0POffline);
1303  fOutputPIDBach->Add(pidcosPAK0SOffline);
1304  fOutputPIDBach->Add(pidcosThePrOffline);
1305  fOutputPIDBach->Add(pidresignedD0Offline);
1306 
1307  if (fTrackRotation) {
1308 
1309  TH2F* pidTRptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1310  TH2F* pidTRptPOffline = (TH2F*)ptPOffline->Clone();
1311  TH2F* pidTRptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1312  TH2F* pidTRptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1313  TH2F* pidTRmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1314  TH2F* pidTRmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1315  TH2F* pidTRmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1316  TH2F* pidTRcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1317  TH2F* pidTRcosThePrOffline = (TH2F*)cosThePrOffline->Clone();
1318  TH2F* pidTRresignedD0Offline = (TH2F*)resignedD0Offline->Clone();
1319  fOutputPIDBachTR->Add(pidTRptK0SOffline);
1320  fOutputPIDBachTR->Add(pidTRptPOffline);
1321  fOutputPIDBachTR->Add(pidTRptPiPOffline);
1322  fOutputPIDBachTR->Add(pidTRptPiMOffline);
1323  fOutputPIDBachTR->Add(pidTRmassLambdaOffline);
1324  fOutputPIDBachTR->Add(pidTRmassLambdaBarOffline);
1325  fOutputPIDBachTR->Add(pidTRmassGammaOffline);
1326  fOutputPIDBachTR->Add(pidTRcosPAK0SOffline);
1327  fOutputPIDBachTR->Add(pidTRcosThePrOffline);
1328  fOutputPIDBachTR->Add(pidTRresignedD0Offline);
1329 
1330  }
1331 
1332 
1333 
1334 
1335 
1336  if (fUseMCInfo) {
1337 
1338  if (fUseOnTheFlyV0) {
1339 
1340  nameHistoSgn="histK0SMassSgn";
1341  nameHistoBkg="histK0SMassBkg";
1342  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";
1343  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";
1344  TH2F* spectrumK0SMassSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1345  TH2F* spectrumK0SMassBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1346 
1347  nameHistoSgn="histLcMassByK0SSgn";
1348  nameHistoBkg="histLcMassByK0SBkg";
1349  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]";
1350  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]";
1351  TH2F* spectrumLcMassByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1352  TH2F* spectrumLcMassByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1353 
1354  nameHistoSgn="histpK0SvspSgn";
1355  nameHistoBkg="histpK0SvspBkg";
1356  titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1357  titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1358  TH2F* momentumDistributionK0SvspSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
1359  TH2F* momentumDistributionK0SvspBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
1360 
1361  // armenteros-podolanski plots K0S
1362  nameHistoSgn="histArmPodK0SSgn";
1363  nameHistoBkg="histArmPodK0SBkg";
1364  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1365  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1366  TH2F* armenterosPodK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1367  TH2F* armenterosPodK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1368 
1369  nameHistoSgn="histArmPodLcSgn";
1370  nameHistoBkg="histArmPodLcBkg";
1371  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1372  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1373  TH2F* armenterosPodLcSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1374  TH2F* armenterosPodLcBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1375 
1376  TH2F* allspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
1377  TH2F* allspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
1378  TH2F* allspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1379  TH2F* allspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1380  TH2F* allmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
1381  TH2F* allmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
1382  TH2F* allArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
1383  TH2F* allArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
1384  TH2F* allArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
1385  TH2F* allArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
1386 
1387  TH2F* pidBachspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
1388  TH2F* pidBachspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
1389  TH2F* pidBachspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1390  TH2F* pidBachspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1391  TH2F* pidBachmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
1392  TH2F* pidBachmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
1393  TH2F* pidBachArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
1394  TH2F* pidBachArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
1395  TH2F* pidBachArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
1396  TH2F* pidBachArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
1397 
1398  fOutputAll->Add(allspectrumK0SMassSgn);
1399  fOutputAll->Add(allspectrumK0SMassBkg);
1400  fOutputAll->Add(allspectrumLcMassByK0SSgn);
1401  fOutputAll->Add(allspectrumLcMassByK0SBkg);
1402  fOutputAll->Add(allmomentumDistributionK0SvspSgn);
1403  fOutputAll->Add(allmomentumDistributionK0SvspBkg);
1404  fOutputAll->Add(allArmenterosPodK0SSgn);
1405  fOutputAll->Add(allArmenterosPodK0SBkg);
1406  fOutputAll->Add(allArmenterosPodLcSgn);
1407  fOutputAll->Add(allArmenterosPodLcBkg);
1408 
1409  fOutputPIDBach->Add(pidBachspectrumK0SMassSgn);
1410  fOutputPIDBach->Add(pidBachspectrumK0SMassBkg);
1411  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgn);
1412  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SBkg);
1413  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspSgn);
1414  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspBkg);
1415  fOutputPIDBach->Add(pidBachArmenterosPodK0SSgn);
1416  fOutputPIDBach->Add(pidBachArmenterosPodK0SBkg);
1417  fOutputPIDBach->Add(pidBachArmenterosPodLcSgn);
1418  fOutputPIDBach->Add(pidBachArmenterosPodLcBkg);
1419 
1420  nameHistoSgn="histArmPodK0SSgn0";
1421  nameHistoBkg="histArmPodK0SBkg0";
1422  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1423  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1424  TH2F* armenterosPodK0SSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1425  TH2F* armenterosPodK0SBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1426  fOutputAll->Add(armenterosPodK0SSgn0);
1427  fOutputAll->Add(armenterosPodK0SBkg0);
1428  nameHistoSgn="histArmPodLcSgn0";
1429  nameHistoBkg="histArmPodLcBkg0";
1430  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1431  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1432  TH2F* armenterosPodLcSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1433  TH2F* armenterosPodLcBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1434  fOutputAll->Add(armenterosPodLcSgn0);
1435  fOutputAll->Add(armenterosPodLcBkg0);
1436 
1437  if (fTrackRotation) {
1438  TH2F* pidBachTRspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1439  TH2F* pidBachTRspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1440  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SSgn);
1441  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SBkg);
1442  }
1443 
1444 
1445 
1446  nameHistoSgn="histptK0SSgn";
1447  nameHistoBkg="histptK0SBkg";
1448  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";
1449  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";
1450  TH2F* ptK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1451  TH2F* ptK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1452 
1453  nameHistoSgn="histptPSgn";
1454  nameHistoBkg="histptPBkg";
1455  titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1456  titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1457  TH2F* ptPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1458  TH2F* ptPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1459 
1460  nameHistoSgn="histptPipSgn";
1461  nameHistoBkg="histptPipBkg";
1462  titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1463  titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1464  TH2F* ptPiPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1465  TH2F* ptPiPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1466 
1467  nameHistoSgn="histptPimSgn";
1468  nameHistoBkg="histptPimBkg";
1469  titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1470  titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1471  TH2F* ptPiMSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1472  TH2F* ptPiMBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1473 
1474  nameHistoSgn="histLambdaMassSgn";
1475  nameHistoBkg="histLambdaMassBkg";
1476  titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1477  titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1478  TH2F* massLambdaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1479  TH2F* massLambdaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1480 
1481  nameHistoSgn="histLambdaBarMassSgn";
1482  nameHistoBkg="histLambdaBarMassBkg";
1483  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";
1484  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";
1485  TH2F* massLambdaBarSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1486  TH2F* massLambdaBarBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1487 
1488  nameHistoSgn="histGammaMassSgn";
1489  nameHistoBkg="histGammaMassBkg";
1490  titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1491  titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1492  TH2F* massGammaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
1493  TH2F* massGammaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
1494 
1495  nameHistoSgn="histD0K0SSgn";
1496  nameHistoBkg="histD0K0SBkg";
1497  titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1498  titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1499  TH2F* d0K0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1500  TH2F* d0K0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1501 
1502  nameHistoSgn="histD0PSgn";
1503  nameHistoBkg="histD0PBkg";
1504  titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1505  titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1506  TH2F* d0PSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1507  TH2F* d0PBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1508 
1509  nameHistoSgn="histCosPAK0SSgn";
1510  nameHistoBkg="histCosPAK0SBkg";
1511  titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1512  titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1513  TH2F *cosPAK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
1514  TH2F *cosPAK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
1515 
1516  nameHistoSgn="histCosThetaProtonCMSSgn";
1517  nameHistoBkg="histCosThetaProtonCMSBkg";
1518  titleHistoSgn="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1519  titleHistoBkg="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1520  TH2F *cosThePrSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,-1.,1.);
1521  TH2F *cosThePrBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,-1.,1.);
1522 
1523 
1524  nameHistoSgn="histResignedD0Sgn";
1525  nameHistoBkg="histResignedD0Bkg";
1526  titleHistoSgn="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1527  titleHistoBkg="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1528  TH2F *resignedD0Sgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,-0.1,0.1);
1529  TH2F *resignedD0Bkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,-0.1,0.1);
1530 
1531  TH2F* allptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1532  TH2F* allptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1533  TH2F* allptPSgn = (TH2F*)ptPSgn->Clone();
1534  TH2F* allptPBkg = (TH2F*)ptPBkg->Clone();
1535  TH2F* allptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1536  TH2F* allptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1537  TH2F* allptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1538  TH2F* allptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1539  TH2F* allmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1540  TH2F* allmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1541  TH2F* allmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1542  TH2F* allmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1543  TH2F* allmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1544  TH2F* allmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1545  TH2F* alld0K0SSgn = (TH2F*)d0K0SSgn->Clone();
1546  TH2F* alld0K0SBkg = (TH2F*)d0K0SBkg->Clone();
1547  TH2F* alld0PSgn = (TH2F*)d0PSgn->Clone();
1548  TH2F* alld0PBkg = (TH2F*)d0PBkg->Clone();
1549  TH2F* allcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1550  TH2F* allcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1551  TH2F* allcosThePrSgn = (TH2F*)cosThePrSgn->Clone();
1552  TH2F* allcosThePrBkg = (TH2F*)cosThePrBkg->Clone();
1553  TH2F* allresignedD0Sgn = (TH2F*)resignedD0Sgn->Clone();
1554  TH2F* allresignedD0Bkg = (TH2F*)resignedD0Bkg->Clone();
1555 
1556  TH2F* pidptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1557  TH2F* pidptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1558  TH2F* pidptPSgn = (TH2F*)ptPSgn->Clone();
1559  TH2F* pidptPBkg = (TH2F*)ptPBkg->Clone();
1560  TH2F* pidptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1561  TH2F* pidptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1562  TH2F* pidptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1563  TH2F* pidptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1564  TH2F* pidmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1565  TH2F* pidmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1566  TH2F* pidmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1567  TH2F* pidmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1568  TH2F* pidmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1569  TH2F* pidmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1570  TH2F* pidd0K0SSgn = (TH2F*)d0K0SSgn->Clone();
1571  TH2F* pidd0K0SBkg = (TH2F*)d0K0SBkg->Clone();
1572  TH2F* pidd0PSgn = (TH2F*)d0PSgn->Clone();
1573  TH2F* pidd0PBkg = (TH2F*)d0PBkg->Clone();
1574  TH2F* pidcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1575  TH2F* pidcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1576  TH2F* pidcosThePrSgn = (TH2F*)cosThePrSgn->Clone();
1577  TH2F* pidcosThePrBkg = (TH2F*)cosThePrBkg->Clone();
1578  TH2F* pidresignedD0Sgn = (TH2F*)resignedD0Sgn->Clone();
1579  TH2F* pidresignedD0Bkg = (TH2F*)resignedD0Bkg->Clone();
1580 
1581  fOutputAll->Add(allptK0SSgn);
1582  fOutputAll->Add(allptK0SBkg);
1583  fOutputAll->Add(allptPSgn);
1584  fOutputAll->Add(allptPBkg);
1585  fOutputAll->Add(allptPiPSgn);
1586  fOutputAll->Add(allptPiPBkg);
1587  fOutputAll->Add(allptPiMSgn);
1588  fOutputAll->Add(allptPiMBkg);
1589  fOutputAll->Add(allmassLambdaSgn);
1590  fOutputAll->Add(allmassLambdaBkg);
1591  fOutputAll->Add(allmassLambdaBarSgn);
1592  fOutputAll->Add(allmassLambdaBarBkg);
1593  fOutputAll->Add(allmassGammaSgn);
1594  fOutputAll->Add(allmassGammaBkg);
1595  fOutputAll->Add(alld0K0SSgn);
1596  fOutputAll->Add(alld0K0SBkg);
1597  fOutputAll->Add(alld0PSgn);
1598  fOutputAll->Add(alld0PBkg);
1599  fOutputAll->Add(allcosPAK0SSgn);
1600  fOutputAll->Add(allcosPAK0SBkg);
1601  fOutputAll->Add(allcosThePrSgn);
1602  fOutputAll->Add(allcosThePrBkg);
1603  fOutputAll->Add(allresignedD0Sgn);
1604  fOutputAll->Add(allresignedD0Bkg);
1605 
1606  fOutputPIDBach->Add(pidptK0SSgn);
1607  fOutputPIDBach->Add(pidptK0SBkg);
1608  fOutputPIDBach->Add(pidptPSgn);
1609  fOutputPIDBach->Add(pidptPBkg);
1610  fOutputPIDBach->Add(pidptPiPSgn);
1611  fOutputPIDBach->Add(pidptPiPBkg);
1612  fOutputPIDBach->Add(pidptPiMSgn);
1613  fOutputPIDBach->Add(pidptPiMBkg);
1614  fOutputPIDBach->Add(pidmassLambdaSgn);
1615  fOutputPIDBach->Add(pidmassLambdaBkg);
1616  fOutputPIDBach->Add(pidmassLambdaBarSgn);
1617  fOutputPIDBach->Add(pidmassLambdaBarBkg);
1618  fOutputPIDBach->Add(pidmassGammaSgn);
1619  fOutputPIDBach->Add(pidmassGammaBkg);
1620  fOutputPIDBach->Add(pidd0K0SSgn);
1621  fOutputPIDBach->Add(pidd0K0SBkg);
1622  fOutputPIDBach->Add(pidd0PSgn);
1623  fOutputPIDBach->Add(pidd0PBkg);
1624  fOutputPIDBach->Add(pidcosPAK0SSgn);
1625  fOutputPIDBach->Add(pidcosPAK0SBkg);
1626  fOutputPIDBach->Add(pidcosThePrSgn);
1627  fOutputPIDBach->Add(pidcosThePrBkg);
1628  fOutputPIDBach->Add(pidresignedD0Sgn);
1629  fOutputPIDBach->Add(pidresignedD0Bkg);
1630 
1631  if (fTrackRotation) {
1632 
1633  TH2F* pidTRptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1634  TH2F* pidTRptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1635  TH2F* pidTRptPSgn = (TH2F*)ptPSgn->Clone();
1636  TH2F* pidTRptPBkg = (TH2F*)ptPBkg->Clone();
1637  TH2F* pidTRptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1638  TH2F* pidTRptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1639  TH2F* pidTRptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1640  TH2F* pidTRptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1641  TH2F* pidTRmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1642  TH2F* pidTRmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1643  TH2F* pidTRmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1644  TH2F* pidTRmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1645  TH2F* pidTRmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1646  TH2F* pidTRmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1647  TH2F* pidTRcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1648  TH2F* pidTRcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1649  TH2F* pidTRcosThePrSgn = (TH2F*)cosThePrSgn->Clone();
1650  TH2F* pidTRcosThePrBkg = (TH2F*)cosThePrBkg->Clone();
1651  TH2F* pidTRresignedD0Sgn = (TH2F*)resignedD0Sgn->Clone();
1652  TH2F* pidTRresignedD0Bkg = (TH2F*)resignedD0Bkg->Clone();
1653  fOutputPIDBachTR->Add(pidTRptK0SSgn);
1654  fOutputPIDBachTR->Add(pidTRptK0SBkg);
1655  fOutputPIDBachTR->Add(pidTRptPSgn);
1656  fOutputPIDBachTR->Add(pidTRptPBkg);
1657  fOutputPIDBachTR->Add(pidTRptPiPSgn);
1658  fOutputPIDBachTR->Add(pidTRptPiPBkg);
1659  fOutputPIDBachTR->Add(pidTRptPiMSgn);
1660  fOutputPIDBachTR->Add(pidTRptPiMBkg);
1661  fOutputPIDBachTR->Add(pidTRmassLambdaSgn);
1662  fOutputPIDBachTR->Add(pidTRmassLambdaBkg);
1663  fOutputPIDBachTR->Add(pidTRmassLambdaBarSgn);
1664  fOutputPIDBachTR->Add(pidTRmassLambdaBarBkg);
1665  fOutputPIDBachTR->Add(pidTRmassGammaSgn);
1666  fOutputPIDBachTR->Add(pidTRmassGammaBkg);
1667  fOutputPIDBachTR->Add(pidTRcosPAK0SSgn);
1668  fOutputPIDBachTR->Add(pidTRcosPAK0SBkg);
1669  fOutputPIDBachTR->Add(pidTRcosThePrSgn);
1670  fOutputPIDBachTR->Add(pidTRcosThePrBkg);
1671  fOutputPIDBachTR->Add(pidTRresignedD0Sgn);
1672  fOutputPIDBachTR->Add(pidTRresignedD0Bkg);
1673 
1674  }
1675 
1676 
1677  } // useOnTheFly
1678 
1679 
1680  nameHistoSgn="histK0SMassOfflineSgn";
1681  nameHistoBkg="histK0SMassOfflineBkg";
1682  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";
1683  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";
1684  TH2F* spectrumK0SMassOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1685  TH2F* spectrumK0SMassOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1686 
1687  nameHistoSgn="histLcMassByK0SOfflineSgn";
1688  nameHistoBkg="histLcMassByK0SOfflineBkg";
1689  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]";
1690  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]";
1691  TH2F* spectrumLcMassOfflineByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1692  TH2F* spectrumLcMassOfflineByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1693 
1694  nameHistoSgn="histpK0SvspOfflineSgn";
1695  nameHistoBkg="histpK0SvspOfflineBkg";
1696  titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1697  titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1698  TH2F* momentumDistributionK0SvspOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
1699  TH2F* momentumDistributionK0SvspOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
1700 
1701  // armenteros-podolanski plots K0S (offline)
1702  nameHistoSgn="histArmPodK0SOfflineSgn";
1703  nameHistoBkg="histArmPodK0SOfflineBkg";
1704  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1705  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1706  TH2F* armenterosPodK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1707  TH2F* armenterosPodK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1708 
1709  nameHistoSgn="histArmPodLcOfflineSgn";
1710  nameHistoBkg="histArmPodLcOfflineBkg";
1711  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1712  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1713  TH2F* armenterosPodLcOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1714  TH2F* armenterosPodLcOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1715 
1716 
1717  TH2F* allspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone();
1718  TH2F* allspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();
1719  TH2F* allspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1720  TH2F* allspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1721  TH2F* allmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
1722  TH2F* allmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
1723  TH2F* allArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
1724  TH2F* allArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
1725  TH2F* allArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
1726  TH2F* allArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
1727 
1728  TH2F* pidBachspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1729  TH2F* pidBachspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1730  TH2F* pidBachspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone();
1731  TH2F* pidBachspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();
1732  TH2F* pidBachmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
1733  TH2F* pidBachmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
1734  TH2F* pidBachArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
1735  TH2F* pidBachArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
1736  TH2F* pidBachArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
1737  TH2F* pidBachArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
1738 
1739  fOutputAll->Add(allspectrumK0SMassOfflineSgn);
1740  fOutputAll->Add(allspectrumK0SMassOfflineBkg);
1741  fOutputAll->Add(allspectrumLcMassOfflineByK0SSgn);
1742  fOutputAll->Add(allspectrumLcMassOfflineByK0SBkg);
1743  fOutputAll->Add(allmomentumDistributionK0SvspOfflineSgn);
1744  fOutputAll->Add(allmomentumDistributionK0SvspOfflineBkg);
1745  fOutputAll->Add(allArmenterosPodK0SOfflineSgn);
1746  fOutputAll->Add(allArmenterosPodK0SOfflineBkg);
1747  fOutputAll->Add(allArmenterosPodLcOfflineSgn);
1748  fOutputAll->Add(allArmenterosPodLcOfflineBkg);
1749 
1750  fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineSgn);
1751  fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineBkg);
1752  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgn);
1753  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SBkg);
1754  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineSgn);
1755  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineBkg);
1756  fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineSgn);
1757  fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineBkg);
1758  fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineSgn);
1759  fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineBkg);
1760 
1761  nameHistoSgn="histArmPodK0SOfflineSgn0";
1762  nameHistoBkg="histArmPodK0SOfflineBkg0";
1763  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1764  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1765  TH2F* armenterosPodK0SOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1766  TH2F* armenterosPodK0SOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1767  nameHistoSgn="histArmPodLcOfflineSgn0";
1768  nameHistoBkg="histArmPodLcOfflineBkg0";
1769  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1770  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1771  TH2F* armenterosPodLcOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1772  TH2F* armenterosPodLcOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1773  fOutputAll->Add(armenterosPodK0SOfflineSgn0);
1774  fOutputAll->Add(armenterosPodK0SOfflineBkg0);
1775  fOutputAll->Add(armenterosPodLcOfflineSgn0);
1776  fOutputAll->Add(armenterosPodLcOfflineBkg0);
1777 
1778  if (fTrackRotation) {
1779  TH2F* pidBachTRspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1780  TH2F* pidBachTRspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1781  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0SSgn);
1782  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0SBkg);
1783  }
1784 
1785 
1786 
1787 
1788  nameHistoSgn="histptK0SOfflineSgn";
1789  nameHistoBkg="histptK0SOfflineBkg";
1790  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";
1791  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";
1792  TH2F* ptK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1793  TH2F* ptK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1794 
1795  nameHistoSgn="histptPOfflineSgn";
1796  nameHistoBkg="histptPOfflineBkg";
1797  titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1798  titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1799  TH2F* ptPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1800  TH2F* ptPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1801 
1802  nameHistoSgn="histptPipOfflineSgn";
1803  nameHistoBkg="histptPipOfflineBkg";
1804  titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1805  titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1806  TH2F* ptPiPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1807  TH2F* ptPiPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1808 
1809  nameHistoSgn="histptPimOfflineSgn";
1810  nameHistoBkg="histptPimOfflineBkg";
1811  titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1812  titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1813  TH2F* ptPiMOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1814  TH2F* ptPiMOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1815 
1816  nameHistoSgn="histLambdaMassOfflineSgn";
1817  nameHistoBkg="histLambdaMassOfflineBkg";
1818  titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1819  titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1820  TH2F* massLambdaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1821  TH2F* massLambdaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1822 
1823  nameHistoSgn="histLambdaBarMassOfflineSgn";
1824  nameHistoBkg="histLambdaBarMassOfflineBkg";
1825  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";
1826  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";
1827  TH2F* massLambdaBarOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1828  TH2F* massLambdaBarOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1829 
1830  nameHistoSgn="histGammaMassOfflineSgn";
1831  nameHistoBkg="histGammaMassOfflineBkg";
1832  titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1833  titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1834  TH2F* massGammaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
1835  TH2F* massGammaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
1836 
1837  nameHistoSgn="histD0K0SOfflineSgn";
1838  nameHistoBkg="histD0K0SOfflineBkg";
1839  titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1840  titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1841  TH2F* d0K0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1842  TH2F* d0K0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1843 
1844  nameHistoSgn="histD0POfflineSgn";
1845  nameHistoBkg="histD0POfflineBkg";
1846  titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1847  titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1848  TH2F* d0POfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1849  TH2F* d0POfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1850 
1851  nameHistoSgn="histCosPAK0SOfflineSgn";
1852  nameHistoBkg="histCosPAK0SOfflineBkg";
1853  titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1854  titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1855  TH2F *cosPAK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
1856  TH2F *cosPAK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
1857 
1858  nameHistoSgn="histCosThetaProtonCMSOfflineSgn";
1859  nameHistoBkg="histCosThetaProtonCMSOfflineBkg";
1860  titleHistoSgn="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1861  titleHistoBkg="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1862  TH2F *cosThePrOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,-1.,1.);
1863  TH2F *cosThePrOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,-1.,1.);
1864 
1865 
1866  nameHistoSgn="histResignedD0OfflineSgn";
1867  nameHistoBkg="histResignedD0OfflineBkg";
1868  titleHistoSgn="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1869  titleHistoBkg="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
1870  TH2F *resignedD0OfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,-0.1,0.1);
1871  TH2F *resignedD0OfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,-0.1,0.1);
1872 
1873  TH2F* allptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1874  TH2F* allptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1875  TH2F* allptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1876  TH2F* allptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1877  TH2F* allptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1878  TH2F* allptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1879  TH2F* allptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1880  TH2F* allptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1881  TH2F* allmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1882  TH2F* allmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1883  TH2F* allmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1884  TH2F* allmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1885  TH2F* allmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1886  TH2F* allmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1887  TH2F* alld0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
1888  TH2F* alld0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
1889  TH2F* alld0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
1890  TH2F* alld0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
1891  TH2F* allcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1892  TH2F* allcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1893  TH2F* allcosThePrOfflineSgn = (TH2F*)cosThePrOfflineSgn->Clone();
1894  TH2F* allcosThePrOfflineBkg = (TH2F*)cosThePrOfflineBkg->Clone();
1895  TH2F* allresignedD0OfflineSgn = (TH2F*)resignedD0OfflineSgn->Clone();
1896  TH2F* allresignedD0OfflineBkg = (TH2F*)resignedD0OfflineBkg->Clone();
1897 
1898  TH2F* pidptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1899  TH2F* pidptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1900  TH2F* pidptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1901  TH2F* pidptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1902  TH2F* pidptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1903  TH2F* pidptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1904  TH2F* pidptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1905  TH2F* pidptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1906  TH2F* pidmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1907  TH2F* pidmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1908  TH2F* pidmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1909  TH2F* pidmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1910  TH2F* pidmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1911  TH2F* pidmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1912  TH2F* pidd0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
1913  TH2F* pidd0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
1914  TH2F* pidd0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
1915  TH2F* pidd0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
1916  TH2F* pidcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1917  TH2F* pidcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1918  TH2F* pidcosThePrOfflineSgn = (TH2F*)cosThePrOfflineSgn->Clone();
1919  TH2F* pidcosThePrOfflineBkg = (TH2F*)cosThePrOfflineBkg->Clone();
1920  TH2F* pidresignedD0OfflineSgn = (TH2F*)resignedD0OfflineSgn->Clone();
1921  TH2F* pidresignedD0OfflineBkg = (TH2F*)resignedD0OfflineBkg->Clone();
1922 
1923  fOutputAll->Add(allptK0SOfflineSgn);
1924  fOutputAll->Add(allptK0SOfflineBkg);
1925  fOutputAll->Add(allptPOfflineSgn);
1926  fOutputAll->Add(allptPOfflineBkg);
1927  fOutputAll->Add(allptPiPOfflineSgn);
1928  fOutputAll->Add(allptPiPOfflineBkg);
1929  fOutputAll->Add(allptPiMOfflineSgn);
1930  fOutputAll->Add(allptPiMOfflineBkg);
1931  fOutputAll->Add(allmassLambdaOfflineSgn);
1932  fOutputAll->Add(allmassLambdaOfflineBkg);
1933  fOutputAll->Add(allmassLambdaBarOfflineSgn);
1934  fOutputAll->Add(allmassLambdaBarOfflineBkg);
1935  fOutputAll->Add(allmassGammaOfflineSgn);
1936  fOutputAll->Add(allmassGammaOfflineBkg);
1937  fOutputAll->Add(alld0K0SOfflineSgn);
1938  fOutputAll->Add(alld0K0SOfflineBkg);
1939  fOutputAll->Add(alld0POfflineSgn);
1940  fOutputAll->Add(alld0POfflineBkg);
1941  fOutputAll->Add(allcosPAK0SOfflineSgn);
1942  fOutputAll->Add(allcosPAK0SOfflineBkg);
1943  fOutputAll->Add(allcosThePrOfflineSgn);
1944  fOutputAll->Add(allcosThePrOfflineBkg);
1945  fOutputAll->Add(allresignedD0OfflineSgn);
1946  fOutputAll->Add(allresignedD0OfflineBkg);
1947 
1948  fOutputPIDBach->Add(pidptK0SOfflineSgn);
1949  fOutputPIDBach->Add(pidptK0SOfflineBkg);
1950  fOutputPIDBach->Add(pidptPOfflineSgn);
1951  fOutputPIDBach->Add(pidptPOfflineBkg);
1952  fOutputPIDBach->Add(pidptPiPOfflineSgn);
1953  fOutputPIDBach->Add(pidptPiPOfflineBkg);
1954  fOutputPIDBach->Add(pidptPiMOfflineSgn);
1955  fOutputPIDBach->Add(pidptPiMOfflineBkg);
1956  fOutputPIDBach->Add(pidmassLambdaOfflineSgn);
1957  fOutputPIDBach->Add(pidmassLambdaOfflineBkg);
1958  fOutputPIDBach->Add(pidmassLambdaBarOfflineSgn);
1959  fOutputPIDBach->Add(pidmassLambdaBarOfflineBkg);
1960  fOutputPIDBach->Add(pidmassGammaOfflineSgn);
1961  fOutputPIDBach->Add(pidmassGammaOfflineBkg);
1962  fOutputPIDBach->Add(pidd0K0SOfflineSgn);
1963  fOutputPIDBach->Add(pidd0K0SOfflineBkg);
1964  fOutputPIDBach->Add(pidd0POfflineSgn);
1965  fOutputPIDBach->Add(pidd0POfflineBkg);
1966  fOutputPIDBach->Add(pidcosPAK0SOfflineSgn);
1967  fOutputPIDBach->Add(pidcosPAK0SOfflineBkg);
1968  fOutputPIDBach->Add(pidcosThePrOfflineSgn);
1969  fOutputPIDBach->Add(pidcosThePrOfflineBkg);
1970  fOutputPIDBach->Add(pidresignedD0OfflineSgn);
1971  fOutputPIDBach->Add(pidresignedD0OfflineBkg);
1972 
1973  if (fTrackRotation) {
1974 
1975  TH2F* pidTRptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1976  TH2F* pidTRptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1977  TH2F* pidTRptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1978  TH2F* pidTRptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1979  TH2F* pidTRptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1980  TH2F* pidTRptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1981  TH2F* pidTRptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1982  TH2F* pidTRptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1983  TH2F* pidTRmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1984  TH2F* pidTRmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1985  TH2F* pidTRmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1986  TH2F* pidTRmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1987  TH2F* pidTRmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1988  TH2F* pidTRmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1989  TH2F* pidTRcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1990  TH2F* pidTRcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1991  TH2F* pidTRcosThePrOfflineSgn = (TH2F*)cosThePrOfflineSgn->Clone();
1992  TH2F* pidTRcosThePrOfflineBkg = (TH2F*)cosThePrOfflineBkg->Clone();
1993  TH2F* pidTRresignedD0OfflineSgn = (TH2F*)resignedD0OfflineSgn->Clone();
1994  TH2F* pidTRresignedD0OfflineBkg = (TH2F*)resignedD0OfflineBkg->Clone();
1995  fOutputPIDBachTR->Add(pidTRptK0SOfflineSgn);
1996  fOutputPIDBachTR->Add(pidTRptK0SOfflineBkg);
1997  fOutputPIDBachTR->Add(pidTRptPOfflineSgn);
1998  fOutputPIDBachTR->Add(pidTRptPOfflineBkg);
1999  fOutputPIDBachTR->Add(pidTRptPiPOfflineSgn);
2000  fOutputPIDBachTR->Add(pidTRptPiPOfflineBkg);
2001  fOutputPIDBachTR->Add(pidTRptPiMOfflineSgn);
2002  fOutputPIDBachTR->Add(pidTRptPiMOfflineBkg);
2003  fOutputPIDBachTR->Add(pidTRmassLambdaOfflineSgn);
2004  fOutputPIDBachTR->Add(pidTRmassLambdaOfflineBkg);
2005  fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineSgn);
2006  fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineBkg);
2007  fOutputPIDBachTR->Add(pidTRmassGammaOfflineSgn);
2008  fOutputPIDBachTR->Add(pidTRmassGammaOfflineBkg);
2009  fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineSgn);
2010  fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineBkg);
2011  fOutputPIDBachTR->Add(pidTRcosThePrOfflineSgn);
2012  fOutputPIDBachTR->Add(pidTRcosThePrOfflineBkg);
2013  fOutputPIDBachTR->Add(pidTRresignedD0OfflineSgn);
2014  fOutputPIDBachTR->Add(pidTRresignedD0OfflineBkg);
2015 
2016  }
2017 
2018  } // useMCinfo
2019 
2020 
2021  if (fTrackRotation) {
2022 
2023  TH3F *phiVSthetaVSpt = new TH3F("phiVSthetaVSpt","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2024  TH3F *phiVSthetaVSptRot = new TH3F("phiVSthetaVSptRot","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2025  TH3F *phiVSthetaVSptOffline = new TH3F("phiVSthetaVSptOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2026  TH3F *phiVSthetaVSptRotOffline = new TH3F("phiVSthetaVSptRotOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2027  fOutputPIDBachTR->Add(phiVSthetaVSpt);
2028  fOutputPIDBachTR->Add(phiVSthetaVSptRot);
2029  fOutputPIDBachTR->Add(phiVSthetaVSptOffline);
2030  fOutputPIDBachTR->Add(phiVSthetaVSptRotOffline);
2031 
2032  TH1F *hNormRotated=new TH1F("hNormRotated","",fNRotations+1,-0.5,fNRotations+0.5);
2033  TH1F *hNormRotatedOffline=new TH1F("hNormRotatedOffline","",fNRotations+1,-0.5,fNRotations+0.5);
2034  /*
2035  hNormRotated->Sumw2();
2036  hNormRotatedOffline->Sumw2();
2037 
2038  hNormRotated->SetMinimum(0);
2039  hNormRotatedOffline->SetMinimum(0);
2040  */
2041 
2042  fOutputPIDBachTR->Add(hNormRotated);
2043  fOutputPIDBachTR->Add(hNormRotatedOffline);
2044 
2045  if (fUseMCInfo) {
2046 
2047  TH3F *phiVSthetaVSptSgn = new TH3F("phiVSthetaVSptSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2048  TH3F *phiVSthetaVSptRotSgn = new TH3F("phiVSthetaVSptRotSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2049  TH3F *phiVSthetaVSptOfflineSgn = new TH3F("phiVSthetaVSptOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2050  TH3F *phiVSthetaVSptRotOfflineSgn = new TH3F("phiVSthetaVSptRotOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2051  fOutputPIDBachTR->Add(phiVSthetaVSptSgn);
2052  fOutputPIDBachTR->Add(phiVSthetaVSptRotSgn);
2053  fOutputPIDBachTR->Add(phiVSthetaVSptOfflineSgn);
2054  fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineSgn);
2055 
2056  TH3F *phiVSthetaVSptBkg = new TH3F("phiVSthetaVSptBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2057  TH3F *phiVSthetaVSptRotBkg = new TH3F("phiVSthetaVSptRotBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2058  TH3F *phiVSthetaVSptOfflineBkg = new TH3F("phiVSthetaVSptOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2059  TH3F *phiVSthetaVSptRotOfflineBkg = new TH3F("phiVSthetaVSptRotOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
2060  fOutputPIDBachTR->Add(phiVSthetaVSptBkg);
2061  fOutputPIDBachTR->Add(phiVSthetaVSptRotBkg);
2062  fOutputPIDBachTR->Add(phiVSthetaVSptOfflineBkg);
2063  fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineBkg);
2064 
2065  TH1F *hNormRotatedSgn=new TH1F("hNormRotatedSgn","",fNRotations+1,-0.5,fNRotations+0.5);
2066  TH1F *hNormRotatedOfflineSgn=new TH1F("hNormRotatedOfflineSgn","",fNRotations+1,-0.5,fNRotations+0.5);
2067  TH1F *hNormRotatedBkg=new TH1F("hNormRotatedBkg","",fNRotations+1,-0.5,fNRotations+0.5);
2068  TH1F *hNormRotatedOfflineBkg=new TH1F("hNormRotatedOfflineBkg","",fNRotations+1,-0.5,fNRotations+0.5);
2069  /*
2070  hNormRotatedSgn->Sumw2();
2071  hNormRotatedOfflineSgn->Sumw2();
2072  hNormRotatedBkg->Sumw2();
2073  hNormRotatedOfflineBkg->Sumw2();
2074 
2075  hNormRotatedSgn->SetMinimum(0);
2076  hNormRotatedOfflineSgn->SetMinimum(0);
2077  hNormRotatedBkg->SetMinimum(0);
2078  hNormRotatedOfflineBkg->SetMinimum(0);
2079  */
2080 
2081  fOutputPIDBachTR->Add(hNormRotatedSgn);
2082  fOutputPIDBachTR->Add(hNormRotatedOfflineSgn);
2083  fOutputPIDBachTR->Add(hNormRotatedBkg);
2084  fOutputPIDBachTR->Add(hNormRotatedOfflineBkg);
2085 
2086  }
2087 
2088  Int_t nMassBins=(Int_t)(fMaxMass*1000.-fMinMass*1000.);
2089  Double_t maxm=fMinMass+nMassBins*0.001;
2090  TH3F *hMassVsPtVsY=new TH3F("hMassVsPtVsY","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2091  TH3F *hMassVsPtVsYOffline=new TH3F("hMassVsPtVsYOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2092  /*
2093  hMassVsPtVsY->Sumw2();
2094  hMassVsPtVsYOffline->Sumw2();
2095 
2096  hMassVsPtVsY->SetMinimum(0);
2097  hMassVsPtVsYOffline->SetMinimum(0);
2098  */
2099 
2100  fOutputPIDBachTR->Add(hMassVsPtVsY);
2101  fOutputPIDBachTR->Add(hMassVsPtVsYOffline);
2102 
2103  if (fUseMCInfo) {
2104 
2105  TH3F *hMassVsPtVsYSgn=new TH3F("hMassVsPtVsYSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2106  TH3F *hMassVsPtVsYOfflineSgn=new TH3F("hMassVsPtVsYOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2107  TH3F *hMassVsPtVsYBkg=new TH3F("hMassVsPtVsYBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2108  TH3F *hMassVsPtVsYOfflineBkg=new TH3F("hMassVsPtVsYOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2109 
2110  /*
2111  hMassVsPtVsYSgn->Sumw2();
2112  hMassVsPtVsYOfflineSgn->Sumw2();
2113  hMassVsPtVsYBkg->Sumw2();
2114  hMassVsPtVsYOfflineBkg->Sumw2();
2115 
2116  hMassVsPtVsYSgn->SetMinimum(0);
2117  hMassVsPtVsYOfflineSgn->SetMinimum(0);
2118  hMassVsPtVsYBkg->SetMinimum(0);
2119  hMassVsPtVsYOfflineBkg->SetMinimum(0);
2120  */
2121 
2122  fOutputPIDBachTR->Add(hMassVsPtVsYSgn);
2123  fOutputPIDBachTR->Add(hMassVsPtVsYOfflineSgn);
2124  fOutputPIDBachTR->Add(hMassVsPtVsYBkg);
2125  fOutputPIDBachTR->Add(hMassVsPtVsYOfflineBkg);
2126 
2127  }
2128 
2129  TH3F *hMassVsPtVsYRot=new TH3F("hMassVsPtVsYRot","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2130  TH3F *hMassVsPtVsYRotOffline=new TH3F("hMassVsPtVsYRotOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2131  /*
2132  hMassVsPtVsYRot->Sumw2();
2133  hMassVsPtVsYRotOffline->Sumw2();
2134 
2135  hMassVsPtVsYRot->SetMinimum(0);
2136  hMassVsPtVsYRotOffline->SetMinimum(0);
2137  */
2138 
2139  fOutputPIDBachTR->Add(hMassVsPtVsYRot);
2140  fOutputPIDBachTR->Add(hMassVsPtVsYRotOffline);
2141 
2142  if (fUseMCInfo) {
2143 
2144  TH3F *hMassVsPtVsYRotSgn=new TH3F("hMassVsPtVsYRotSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2145  TH3F *hMassVsPtVsYRotOfflineSgn=new TH3F("hMassVsPtVsYRotOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2146  TH3F *hMassVsPtVsYRotBkg=new TH3F("hMassVsPtVsYRotBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2147  TH3F *hMassVsPtVsYRotOfflineBkg=new TH3F("hMassVsPtVsYRotOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
2148  /*
2149  hMassVsPtVsYRotSgn->Sumw2();
2150  hMassVsPtVsYRotOfflineSgn->Sumw2();
2151  hMassVsPtVsYRotBkg->Sumw2();
2152  hMassVsPtVsYRotOfflineBkg->Sumw2();
2153 
2154  hMassVsPtVsYRotSgn->SetMinimum(0);
2155  hMassVsPtVsYRotOfflineSgn->SetMinimum(0);
2156  hMassVsPtVsYRotBkg->SetMinimum(0);
2157  hMassVsPtVsYRotOfflineBkg->SetMinimum(0);
2158  */
2159 
2160  fOutputPIDBachTR->Add(hMassVsPtVsYRotSgn);
2161  fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineSgn);
2162  fOutputPIDBachTR->Add(hMassVsPtVsYRotBkg);
2163  fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineBkg);
2164 
2165  }
2166 
2167  TH1F *hDeltaMass=new TH1F("hDeltaMass","",100,-0.4,0.4);
2168  TH1F *hDeltaMassOffline=new TH1F("hDeltaMassOffline","",100,-0.4,0.4);
2169  /*
2170  hDeltaMass->Sumw2();
2171  hDeltaMassOffline->Sumw2();
2172 
2173  hDeltaMass->SetMinimum(0);
2174  hDeltaMassOffline->SetMinimum(0);
2175  */
2176 
2177  fOutputPIDBachTR->Add(hDeltaMass);
2178  fOutputPIDBachTR->Add(hDeltaMassOffline);
2179 
2180  if (fUseMCInfo) {
2181 
2182  TH1F *hDeltaMassSgn=new TH1F("hDeltaMassSgn","",100,-0.4,0.4);
2183  TH1F *hDeltaMassOfflineSgn=new TH1F("hDeltaMassOfflineSgn","",100,-0.4,0.4);
2184  TH1F *hDeltaMassBkg=new TH1F("hDeltaMassBkg","",100,-0.4,0.4);
2185  TH1F *hDeltaMassOfflineBkg=new TH1F("hDeltaMassOfflineBkg","",100,-0.4,0.4);
2186  /*
2187  hDeltaMassSgn->Sumw2();
2188  hDeltaMassOfflineSgn->Sumw2();
2189  hDeltaMassBkg->Sumw2();
2190  hDeltaMassOfflineBkg->Sumw2();
2191 
2192  hDeltaMassSgn->SetMinimum(0);
2193  hDeltaMassOfflineSgn->SetMinimum(0);
2194  hDeltaMassBkg->SetMinimum(0);
2195  hDeltaMassOfflineBkg->SetMinimum(0);
2196  */
2197 
2198  fOutputPIDBachTR->Add(hDeltaMassSgn);
2199  fOutputPIDBachTR->Add(hDeltaMassOfflineSgn);
2200  fOutputPIDBachTR->Add(hDeltaMassBkg);
2201  fOutputPIDBachTR->Add(hDeltaMassOfflineBkg);
2202 
2203  }
2204 
2205  /*
2206  Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
2207  Double_t edgeLowSparseDMassRot[5]={fMinMass,-0.4,0.,-4.,0};
2208  Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
2209  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);
2210  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);
2211 
2212  fOutputPIDBachTR->Add(hDeltaMassFullAnalysis);
2213  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOffline);
2214 
2215  if (fUseMCInfo) {
2216 
2217  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);
2218  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);
2219 
2220  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);
2221  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);
2222 
2223  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisSgn);
2224  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineSgn);
2225  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisBkg);
2226  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineBkg);
2227 
2228  }
2229  */
2230 
2231  }
2232 
2234  TH2D *hMassvsPtInclusiveK0S = new TH2D("hMassvsPtInclusiveK0S","",100,mK0SPDG-0.05,mK0SPDG+0.05,20,0.,10.);
2235  TH2D *hMassvsPtInclusiveK0SSgn = new TH2D("hMassvsPtInclusiveK0SSgn","",100,mK0SPDG-0.05,mK0SPDG+0.05,20,0.,10.);
2236  TH3D *hMassvsPtInclusiveLambda = new TH3D("hMassvsPtInclusiveLambda","",100,mLPDG-0.025,mLPDG+0.025,20,0.,10.,62,0.,62);
2237  TH3D *hMassvsPtInclusiveLambdaSgn = new TH3D("hMassvsPtInclusiveLambdaSgn","",100,mLPDG-0.025,mLPDG+0.025,20,0.,10.,62,0.,62);
2238  TH3D *hMassvsPtInclusiveLambdaPID = (TH3D*)hMassvsPtInclusiveLambda->Clone();
2239  TH3D *hMassvsPtInclusiveLambdaPIDSgn = (TH3D*)hMassvsPtInclusiveLambdaSgn->Clone();
2240  fOutputAll->Add(hMassvsPtInclusiveK0S);
2241  fOutputAll->Add(hMassvsPtInclusiveK0SSgn);
2242  fOutputAll->Add(hMassvsPtInclusiveLambda);
2243  fOutputPIDBach->Add(hMassvsPtInclusiveLambdaPID);
2244  fOutputAll->Add(hMassvsPtInclusiveLambdaSgn);
2245  fOutputPIDBach->Add(hMassvsPtInclusiveLambdaPIDSgn);
2246  }
2247 
2248  /*
2249  fOutputAll->Print();
2250  fOutputPIDBach->Print();
2251  if (fTrackRotation) fOutputPIDBachTR->Print();
2252  */
2253  return;
2254 }
2255 
2256 //-------------------------------------------------------------------------------
2258  TClonesArray *mcArray,
2259  AliRDHFCutsLctoV0 *cutsAnal)
2260 {
2261 
2262  //
2263  // make single analysis for the systematics studies
2264  // 1: Inclusive K0s (Tracking, K0S cut variation)
2265  // 2: Proton from Lambda (PID, Tracking TPC(not yet))
2266  //
2267 
2268  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2269 
2270  Int_t nTracks = aodEvent->GetNumberOfTracks();
2271  Int_t nV0s = aodEvent->GetNumberOfV0s();
2272 
2273  Double_t pos[3]; fVtx1->GetXYZ(pos);
2274  Double_t cov[6]; fVtx1->GetCovarianceMatrix(cov);
2275  const AliESDVertex vESD(pos,cov,100.,100);
2276 
2277  AliESDtrackCuts *trkCuts = fAnalCuts->GetTrackCuts();
2278  AliESDtrackCuts *v0trkCuts = fAnalCuts->GetTrackCutsV0daughters();
2279  const Float_t *cutVars = fAnalCuts->GetCuts();
2280 
2281  //1: Inclusive K0s
2282  for (Int_t iv0 = 0; iv0<nV0s; iv0++) {
2283  AliAODv0 *v0 = aodEvent->GetV0(iv0);
2284  if(!v0) continue;
2285  AliAODTrack *ptrk = dynamic_cast<AliAODTrack*>(v0->GetDaughter(0));
2286  if (!ptrk) continue;
2287  AliAODTrack *ntrk = dynamic_cast<AliAODTrack*>(v0->GetDaughter(1));
2288  if (!ntrk) continue;
2289 
2290  Float_t etaMin=0, etaMax=0; v0trkCuts->GetEtaRange(etaMin,etaMax);
2291  if ( (ptrk->Eta()<=etaMin || ptrk->Eta()>=etaMax) ||
2292  (ntrk->Eta()<=etaMin || ntrk->Eta()>=etaMax) ) continue;
2293  Float_t ptMin=0, ptMax=0; v0trkCuts->GetPtRange(ptMin,ptMax);
2294  if ( (ptrk->Pt()<=ptMin || ptrk->Pt()>=ptMax) ||
2295  (ntrk->Pt()<=ptMin || ntrk->Pt()>=ptMax) ) continue;
2296 
2297  // Condition on nTPCclusters
2298  if (v0trkCuts->GetMinNClusterTPC()>0) {
2299  if ( ( ( ptrk->GetTPCClusterInfo(2,1) ) < v0trkCuts->GetMinNClusterTPC() ) ||
2300  ( ( ntrk->GetTPCClusterInfo(2,1) ) < v0trkCuts->GetMinNClusterTPC() ) ) continue;
2301  }
2302 
2303  if (v0trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
2304  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
2305  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
2306  if (ptrk->GetTPCNclsF()>0) {
2307  ratioCrossedRowsOverFindableClustersTPCPos = ptrk->GetTPCClusterInfo(2,1) / ptrk->GetTPCNclsF();
2308  }
2309  if (ntrk->GetTPCNclsF()>0) {
2310  ratioCrossedRowsOverFindableClustersTPCNeg = ntrk->GetTPCClusterInfo(2,1) / ntrk->GetTPCNclsF();
2311  }
2312  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < v0trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
2313  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < v0trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ) continue;
2314  }
2315 
2316  // kTPCrefit status
2317  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
2318  if (v0trkCuts->GetRequireTPCRefit()) {
2319  if( !(ptrk->GetStatus() & AliESDtrack::kTPCrefit)) continue;
2320  if( !(ntrk->GetStatus() & AliESDtrack::kTPCrefit)) continue;
2321  }
2322  }
2323 
2324  AliESDtrack esdTrackP(ptrk);
2325  esdTrackP.SetTPCClusterMap(ptrk->GetTPCClusterMap());
2326  esdTrackP.SetTPCSharedMap(ptrk->GetTPCSharedMap());
2327  esdTrackP.SetTPCPointsF(ptrk->GetTPCNclsF());
2328  esdTrackP.RelateToVertex(&vESD,0.,3.);
2329 
2330  AliESDtrack esdTrackN(ntrk);
2331  esdTrackN.SetTPCClusterMap(ntrk->GetTPCClusterMap());
2332  esdTrackN.SetTPCSharedMap(ntrk->GetTPCSharedMap());
2333  esdTrackN.SetTPCPointsF(ntrk->GetTPCNclsF());
2334  esdTrackN.RelateToVertex(&vESD,0.,3.);
2335 
2336  //appliyng TPC crossed rows pT dependent cut
2338  if(tmptxt.Contains("pt")){
2339  tmptxt.ReplaceAll("pt","x");
2340  TF1 funcCutMin("funcCutMin",tmptxt);
2341  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2342  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2343  if(nCrossedRowsTPCP<funcCutMin.Eval(esdTrackP.Pt())) continue;
2344  if(nCrossedRowsTPCN<funcCutMin.Eval(esdTrackN.Pt())) continue;
2345  }
2346 
2347  //appliyng NTPCcls/NTPCcrossedRows cut
2349  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2350  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2351  Float_t nClustersTPCP = esdTrackP.GetTPCNcls();
2352  Float_t nClustersTPCN = esdTrackN.GetTPCNcls();
2353  if(nCrossedRowsTPCP!=0){
2354  Float_t ratioP = nClustersTPCP/nCrossedRowsTPCP;
2355  if(ratioP<fAnalCuts->GetMinRatioClsOverCrossRowsTPC()) continue;
2356  }
2357  else continue;
2358  if(nCrossedRowsTPCN!=0){
2359  Float_t ratioN = nClustersTPCN/nCrossedRowsTPCN;
2360  if(ratioN<fAnalCuts->GetMinRatioClsOverCrossRowsTPC()) continue;
2361  }
2362  else continue;
2363  }
2364 
2365  //appliyng TPCsignalN/NTPCcrossedRows cut
2367  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2368  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2369  Float_t nTPCsignalP = esdTrackP.GetTPCsignalN();
2370  Float_t nTPCsignalN = esdTrackN.GetTPCsignalN();
2371  if(nCrossedRowsTPCP!=0){
2372  Float_t ratioP = nTPCsignalP/nCrossedRowsTPCP;
2373  if(ratioP<fAnalCuts->GetMinRatioSignalNOverCrossRowsTPC()) continue;
2374  }
2375  else continue;
2376  if(nCrossedRowsTPCN!=0){
2377  Float_t ratioN = nTPCsignalN/nCrossedRowsTPCN;
2378  if(ratioN<fAnalCuts->GetMinRatioSignalNOverCrossRowsTPC()) continue;
2379  }
2380  else continue;
2381  }
2382 
2383  // kink condition
2384  if (!v0trkCuts->GetAcceptKinkDaughters()) {
2385  AliAODVertex *maybeKinkPos = (AliAODVertex*)ptrk->GetProdVertex();
2386  AliAODVertex *maybeKinkNeg = (AliAODVertex*)ntrk->GetProdVertex();
2387  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
2388  maybeKinkNeg->GetType()==AliAODVertex::kKink) continue;
2389  }
2390 
2391  //RDHF cuts
2392  if(ptrk->Pt()<cutVars[fAnalCuts->GetGlobalIndex(5,0)] || ntrk->Pt()<cutVars[fAnalCuts->GetGlobalIndex(6,0)]) continue;
2393  if(v0->GetDCA()>cutVars[fAnalCuts->GetGlobalIndex(8,0)]) continue;
2394  if(v0->CosPointingAngle(pos)<cutVars[fAnalCuts->GetGlobalIndex(9,0)]) continue;
2395  if(v0->DcaV0ToPrimVertex()>cutVars[fAnalCuts->GetGlobalIndex(11,0)]) continue;
2396  if((v0->PtArmV0()/TMath::Abs(v0->AlphaV0())<cutVars[fAnalCuts->GetGlobalIndex(19,0)])) continue;
2397 
2398  if(TMath::Abs(v0->MassLambda()-mLPDG) < cutVars[fAnalCuts->GetGlobalIndex(13,0)]) continue;
2399  if(TMath::Abs(v0->MassAntiLambda()-mLPDG) < cutVars[fAnalCuts->GetGlobalIndex(13,0)]) continue;
2400  if(v0->InvMass2Prongs(0,1,11,11) < cutVars[fAnalCuts->GetGlobalIndex(13,0)]) continue;
2401 
2402  ((TH2D*)(fOutputAll->FindObject("hMassvsPtInclusiveK0S")))->Fill(v0->MassK0Short(),v0->Pt());
2403 
2404  if(fUseMCInfo){
2405  Int_t pdgdgv0[2]={211,211};
2406  Int_t labV0 = v0->MatchToMC(310,mcArray,2,pdgdgv0); // the V0
2407  if(labV0>=0){
2408  AliAODMCParticle *mcv0 = (AliAODMCParticle*) mcArray->At(labV0);
2409  if(mcv0){
2410  ((TH2D*)(fOutputAll->FindObject("hMassvsPtInclusiveK0SSgn")))->Fill(v0->MassK0Short(),v0->Pt());
2411  }
2412  }
2413  }
2414  }
2415 
2416  //2: Proton from Lambda
2417  for (Int_t iv0 = 0; iv0<nV0s; iv0++) {
2418  AliAODv0 *v0 = aodEvent->GetV0(iv0);
2419  if(!v0) continue;
2420  AliAODTrack *ptrk = dynamic_cast<AliAODTrack*>(v0->GetDaughter(0));
2421  if (!ptrk) continue;
2422  AliAODTrack *ntrk = dynamic_cast<AliAODTrack*>(v0->GetDaughter(1));
2423  if (!ntrk) continue;
2424 
2425  Float_t etaMin=0, etaMax=0; trkCuts->GetEtaRange(etaMin,etaMax);
2426  if ( (ptrk->Eta()<=etaMin || ptrk->Eta()>=etaMax) ||
2427  (ntrk->Eta()<=etaMin || ntrk->Eta()>=etaMax) ) continue;
2428  Float_t ptMin=0, ptMax=0; trkCuts->GetPtRange(ptMin,ptMax);
2429  if ( (ptrk->Pt()<=ptMin || ptrk->Pt()>=ptMax) ||
2430  (ntrk->Pt()<=ptMin || ntrk->Pt()>=ptMax) ) continue;
2431 
2432 
2433  // kTPCrefit status
2434  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
2435  if (trkCuts->GetRequireTPCRefit()) {
2436  if( !(ptrk->GetStatus() & AliESDtrack::kTPCrefit)) continue;
2437  if( !(ntrk->GetStatus() & AliESDtrack::kTPCrefit)) continue;
2438  }
2439  }
2440 
2441  // kink condition
2442  if (!trkCuts->GetAcceptKinkDaughters()) {
2443  AliAODVertex *maybeKinkPos = (AliAODVertex*)ptrk->GetProdVertex();
2444  AliAODVertex *maybeKinkNeg = (AliAODVertex*)ntrk->GetProdVertex();
2445  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
2446  maybeKinkNeg->GetType()==AliAODVertex::kKink) continue;
2447  }
2448 
2449  //Should decay before TPC
2450  Double_t dR = TMath::Sqrt(v0->DecayVertexV0X()*v0->DecayVertexV0X()+v0->DecayVertexV0Y()*v0->DecayVertexV0Y());
2451  if(dR>40.) continue;
2452 
2453  Int_t LType = 0;
2454  if(TMath::Abs(v0->MassLambda()-mLPDG)<0.02) LType += 1;
2455  if(TMath::Abs(v0->MassAntiLambda()-mLPDG)<0.02) LType += 2;
2456  if(LType==3) continue;//to avoid complexity
2457 
2458  Bool_t okLcK0Sp = kTRUE; // K0S case
2459  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
2460  Bool_t okLcLambdaPi = kTRUE; // Lambda case
2461 
2462  AliAODMCParticle *mcv0 = 0x0;
2463  if(fUseMCInfo){
2464  Int_t pdgdgv0[2]={2212,211};
2465  Int_t labV0 = v0->MatchToMC(3122,mcArray,2,pdgdgv0); // the V0
2466  if(labV0>=0){
2467  mcv0 = (AliAODMCParticle*) mcArray->At(labV0);
2468  }
2469  }
2470 
2471  AliESDtrack esdTrackP(ptrk);
2472  esdTrackP.SetTPCClusterMap(ptrk->GetTPCClusterMap());
2473  esdTrackP.SetTPCSharedMap(ptrk->GetTPCSharedMap());
2474  esdTrackP.SetTPCPointsF(ptrk->GetTPCNclsF());
2475  esdTrackP.RelateToVertex(&vESD,0.,3.);
2476 
2477  AliESDtrack esdTrackN(ntrk);
2478  esdTrackN.SetTPCClusterMap(ntrk->GetTPCClusterMap());
2479  esdTrackN.SetTPCSharedMap(ntrk->GetTPCSharedMap());
2480  esdTrackN.SetTPCPointsF(ntrk->GetTPCNclsF());
2481  esdTrackN.RelateToVertex(&vESD,0.,3.);
2482 
2483  // Condition on nTPCclusters
2484  if (trkCuts->GetMinNClusterTPC()>0) {
2485  if(LType==1){
2486  if ( ( ( ptrk->GetTPCClusterInfo(2,1) ) < trkCuts->GetMinNClusterTPC() ) ||
2487  ( ( ntrk->GetTPCClusterInfo(2,1) ) < 70 ) ) continue;
2488  }
2489  if(LType==2){
2490  if ( ( ( ntrk->GetTPCClusterInfo(2,1) ) < trkCuts->GetMinNClusterTPC() ) ||
2491  ( ( ptrk->GetTPCClusterInfo(2,1) ) < 70 ) ) continue;
2492  }
2493  }
2494 
2495  if (trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
2496  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
2497  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
2498  if (ptrk->GetTPCNclsF()>0) {
2499  ratioCrossedRowsOverFindableClustersTPCPos = ptrk->GetTPCClusterInfo(2,1) / ptrk->GetTPCNclsF();
2500  }
2501  if (ntrk->GetTPCNclsF()>0) {
2502  ratioCrossedRowsOverFindableClustersTPCNeg = ntrk->GetTPCClusterInfo(2,1) / ntrk->GetTPCNclsF();
2503  }
2504  if(LType==1){
2505  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
2506  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < 0.8 ) ) continue;
2507  }
2508  if(LType==2){
2509  if ( ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < trkCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
2510  ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < 0.8 ) ) continue;
2511  }
2512  }
2513 
2514  //appliyng TPC crossed rows pT dependent cut
2516  if(tmptxt.Contains("pt")){
2517  tmptxt.ReplaceAll("pt","x");
2518  TF1 funcCutMin("funcCutMin",tmptxt);
2519  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2520  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2521  if(LType==1 && nCrossedRowsTPCP<funcCutMin.Eval(esdTrackP.Pt())) continue;
2522  if(LType==2 && nCrossedRowsTPCN<funcCutMin.Eval(esdTrackN.Pt())) continue;
2523  }
2524 
2525  //appliyng NTPCcls/NTPCcrossedRows cut
2527  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2528  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2529  Float_t nClustersTPCP = esdTrackP.GetTPCNcls();
2530  Float_t nClustersTPCN = esdTrackN.GetTPCNcls();
2531  if(LType==1){
2532  if(nCrossedRowsTPCP!=0){
2533  Float_t ratioP = nClustersTPCP/nCrossedRowsTPCP;
2534  if(ratioP<fAnalCuts->GetMinRatioClsOverCrossRowsTPC()) continue;
2535  }
2536  else continue;
2537 
2538  }
2539  if(LType==2){
2540  if(nCrossedRowsTPCN!=0){
2541  Float_t ratioN = nClustersTPCN/nCrossedRowsTPCN;
2542  if(ratioN<fAnalCuts->GetMinRatioClsOverCrossRowsTPC()) continue;
2543  }
2544  else continue;
2545  }
2546  }
2547 
2548  //appliyng TPCsignalN/NTPCcrossedRows cut
2550  Float_t nCrossedRowsTPCP = esdTrackP.GetTPCCrossedRows();
2551  Float_t nCrossedRowsTPCN = esdTrackN.GetTPCCrossedRows();
2552  Float_t nTPCsignalP = esdTrackP.GetTPCsignalN();
2553  Float_t nTPCsignalN = esdTrackN.GetTPCsignalN();
2554  if(LType==1){
2555  if(nCrossedRowsTPCP!=0){
2556  Float_t ratioP = nTPCsignalP/nCrossedRowsTPCP;
2557  if(ratioP<fAnalCuts->GetMinRatioSignalNOverCrossRowsTPC()) continue;
2558  }
2559  else continue;
2560  }
2561  if(LType==2){
2562  if(nCrossedRowsTPCN!=0){
2563  Float_t ratioN = nTPCsignalN/nCrossedRowsTPCN;
2564  if(ratioN<fAnalCuts->GetMinRatioSignalNOverCrossRowsTPC()) continue;
2565  }
2566  else continue;
2567  }
2568  }
2569 
2570  if(LType==1){
2571  Double_t nTPCsigmas=-9999, nTOFsigmas=-9999;
2572  fAnalCuts->GetPidHF()->GetnSigmaTPC(ptrk,4,nTPCsigmas);
2573  fAnalCuts->GetPidHF()->GetnSigmaTOF(ptrk,4,nTOFsigmas);
2574  Bool_t PIDOK=kFALSE;
2575  switch(fAnalCuts->GetPidSelectionFlag()){
2576  case 10:
2577  if(TMath::Abs(nTPCsigmas)<3. && TMath::Abs(nTOFsigmas)<3.){
2578  PIDOK = !(ptrk->Pt()>fAnalCuts->GetLowPtCut()&& nTOFsigmas<-2.)&&!(ptrk->Pt()>fAnalCuts->GetLowPtCut()&&nTPCsigmas>2.);
2579  }
2580  break;
2581  }
2582  ((TH3D*)(fOutputAll->FindObject("hMassvsPtInclusiveLambda")))->Fill(v0->MassLambda(),ptrk->Pt(),dR);
2583  if(PIDOK) ((TH3D*)(fOutputPIDBach->FindObject("hMassvsPtInclusiveLambda")))->Fill(v0->MassLambda(),ptrk->Pt(),dR);
2584 
2585  if(fUseMCInfo && mcv0){
2586  ((TH3D*)(fOutputAll->FindObject("hMassvsPtInclusiveLambdaSgn")))->Fill(v0->MassLambda(),ptrk->Pt(),dR);
2587  if(PIDOK) ((TH3D*)(fOutputPIDBach->FindObject("hMassvsPtInclusiveLambdaSgn")))->Fill(v0->MassLambda(),ptrk->Pt(),dR);
2588 
2589  }
2590  }
2591  if(LType==2){
2592  Double_t nTPCsigmas=-9999, nTOFsigmas=-9999;
2593  fAnalCuts->GetPidHF()->GetnSigmaTPC(ntrk,4,nTPCsigmas);
2594  fAnalCuts->GetPidHF()->GetnSigmaTOF(ntrk,4,nTOFsigmas);
2595  Bool_t PIDOK=kFALSE;
2596  switch(fAnalCuts->GetPidSelectionFlag()){
2597  case 10:
2598  if(TMath::Abs(nTPCsigmas)<3. && TMath::Abs(nTOFsigmas)<3.){
2599  PIDOK = !(ptrk->Pt()>fAnalCuts->GetLowPtCut()&& nTOFsigmas<-2.)&&!(ptrk->Pt()>fAnalCuts->GetLowPtCut()&&nTPCsigmas>2.);
2600  }
2601  break;
2602  }
2603  ((TH3D*)(fOutputAll->FindObject("hMassvsPtInclusiveLambda")))->Fill(v0->MassAntiLambda(),ntrk->Pt(),dR);
2604  if(PIDOK) ((TH3D*)(fOutputPIDBach->FindObject("hMassvsPtInclusiveLambda")))->Fill(v0->MassAntiLambda(),ntrk->Pt(),dR);
2605  if(fUseMCInfo && mcv0){
2606  ((TH3D*)(fOutputAll->FindObject("hMassvsPtInclusiveLambdaSgn")))->Fill(v0->MassAntiLambda(),ntrk->Pt(),dR);
2607  if(PIDOK) ((TH3D*)(fOutputPIDBach->FindObject("hMassvsPtInclusiveLambdaSgn")))->Fill(v0->MassAntiLambda(),ntrk->Pt(),dR);
2608  }
2609  }
2610  }
2611  return;
2612 }
2613 
2614 //---------------------------
2616  //
2618  //
2619 
2620  TClonesArray *arrayLctopKos=0;
2621  if (!aodEvent){
2622  if(AODEvent() && IsStandardAOD()) {
2623  // In case there is an AOD handler writing a standard AOD, use the AOD
2624  // event in memory rather than the input (ESD) event.
2625  aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
2626  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
2627  // have to taken from the AOD event hold by the AliAODExtension
2628  AliAODHandler* aodHandler = (AliAODHandler*)
2629  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
2630 
2631  if (aodHandler->GetExtensions()) {
2632  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
2633  AliAODEvent *aodFromExt = ext->GetAOD();
2634  arrayLctopKos=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
2635  }
2636  }
2637  } else {
2638  arrayLctopKos=(TClonesArray*)aodEvent->GetList()->FindObject("CascadesHF");
2639  }
2640 
2641  Float_t zVertex = fVtx1->GetZ();
2642  TString titleVtx=fVtx1->GetTitle();
2643 
2644  if (TMath::Abs(fBzkG)>=0.001) {
2645 
2646  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ2")))->Fill(zVertex);
2647 
2648  if (arrayLctopKos) {
2649 
2650  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ3")))->Fill(zVertex);
2651 
2652  // mc analysis
2653  TClonesArray *mcArray = 0;
2654  AliAODMCHeader *mcHeader=0;
2655 
2656  if (fUseMCInfo) {
2657  // MC array need for maching
2658  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2659 
2660  if (mcArray) {
2661  // load MC header
2662  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ4")))->Fill(zVertex);
2663  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
2664 
2665  if (mcHeader && fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ5")))->Fill(zVertex);
2666 
2667  // check on MC Lc Daughter
2668  if (fAdditionalChecks) {
2669  for (Int_t iii=0; iii<mcArray->GetEntries(); iii++)
2670  SearchLcDaughter(mcArray,iii);
2671  }
2672 
2673  }
2674 
2675  }
2676 
2677  if (fVtx1->GetNContributors()>0) {
2678  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ6")))->Fill(zVertex);
2679 
2680  TString firedTriggerClasses = aodEvent->GetFiredTriggerClasses(); // trigger class
2681  ULong64_t fTriggerMask=AliVEvent::kAnyINT;
2682  Bool_t check1 = kFALSE;
2683  if ( !fUseMCInfo && // don't do for MC...
2684  (aodEvent->GetRunNumber()<136851 || aodEvent->GetRunNumber()>139517) ) { // ...and for PbPb 2010 data
2685  if ( !(firedTriggerClasses.Contains("CINT1")) ) {
2686  AliInfo(Form(" ======================== firedTriggerClasses.Data() = %s",firedTriggerClasses.Data()));
2687  fCEvents->Fill(8);
2688  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ8")))->Fill(zVertex);
2689  check1 = kTRUE;
2690  }
2691  }
2692 
2693  Bool_t isSelectedAAA = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2694  if (!isSelectedAAA) {
2695  fCEvents->Fill(9);
2696  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ9")))->Fill(zVertex);
2697  }
2698 
2699  if (!isSelectedAAA || check1) {
2700  fCEvents->Fill(16);
2701  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ16")))->Fill(zVertex);
2702  }
2703 
2704  fTriggerMask=AliVEvent::kAny;
2705  Bool_t isSelectedBBB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2706  if (!isSelectedBBB) {
2707  fCEvents->Fill(10);
2708  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ10")))->Fill(zVertex);
2709  }
2710 
2711  if (titleVtx.Contains("Z")) {
2712  fCEvents->Fill(11);
2713  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ11")))->Fill(zVertex);
2714  }
2715  else if (titleVtx.Contains("3D")) {
2716  fCEvents->Fill(12);
2717  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ12")))->Fill(zVertex);
2718  } else {
2719  fCEvents->Fill(13);
2720  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ13")))->Fill(zVertex);
2721  }
2722 
2723  if (TMath::Abs(zVertex)<=fAnalCuts->GetMaxVtxZ()) {
2724  fCEvents->Fill(14);
2725  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ14")))->Fill(zVertex);
2726  }
2727 
2728  if ( fIsEventSelected ) {
2729  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ7")))->Fill(zVertex);
2730  } else {
2731  fCEvents->Fill(15);
2732  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ15")))->Fill(zVertex);
2733  }
2734 
2735  } // nContributors>=1
2736  } // analysisArray exists
2737  } // magnetic field exists
2738 
2739  return;
2740 }
2741 
2742 //-----------------
2747 
2748  Float_t zVertex = fVtx1->GetZ();
2749  TString titleVtx=fVtx1->GetTitle();
2750  TString firedTriggerClasses = aodEvent->GetFiredTriggerClasses(); // trigger class
2751  ULong64_t fTriggerMask=AliVEvent::kAnyINT;
2752 
2753  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(6);
2754  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ6a")))->Fill(zVertex);
2755 
2756  Bool_t check1a = kFALSE;
2757  if ( !fUseMCInfo && // don't do for MC...
2758  (aodEvent->GetRunNumber()<136851 || aodEvent->GetRunNumber()>139517) ) { // ...and for PbPb 2010 data
2759  if ( !(firedTriggerClasses.Contains("CINT1")) ) {
2760  AliInfo(Form(" ======================== firedTriggerClasses.Data() = %s",firedTriggerClasses.Data()));
2761  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(8);
2762  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ8a")))->Fill(zVertex);
2763  check1a = kTRUE;
2764  }
2765  }
2766 
2767  Bool_t isSelectedAAAa = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2768  if (!isSelectedAAAa) {
2769  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(9);
2770  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ9a")))->Fill(zVertex);
2771  }
2772 
2773  if (!isSelectedAAAa || check1a) {
2774  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(16);
2775  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ16a")))->Fill(zVertex);
2776  }
2777 
2778  fTriggerMask=AliVEvent::kAny;
2779  Bool_t isSelectedBBBa = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2780  if (!isSelectedBBBa) {
2781  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(10);
2782  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ10a")))->Fill(zVertex);
2783  }
2784 
2785  if (titleVtx.Contains("Z")) {
2786  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(11);
2787  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ11a")))->Fill(zVertex);
2788  }
2789  else if (titleVtx.Contains("3D")) {
2790  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(12);
2791  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ12a")))->Fill(zVertex);
2792  } else {
2793  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(13);
2794  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ13a")))->Fill(zVertex);
2795  }
2796 
2797  if (TMath::Abs(zVertex)<=fAnalCuts->GetMaxVtxZ()) {
2798  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(14);
2799  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ14a")))->Fill(zVertex);
2800  }
2801 
2802  if ( fIsEventSelected ) {
2803  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(7);
2804  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ7a")))->Fill(zVertex);
2805  } else {
2806  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(15);
2807  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ15a")))->Fill(zVertex);
2808  }
2809 
2810  return;
2811 }
2812 
2813 //-----------------------------
2815  Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0,
2816  TClonesArray *mcArray) {
2817  //
2819  //
2820 
2821  // bachelor
2822  AliAODTrack *bachelor = (AliAODTrack*)lc2bacV0->GetBachelor();
2823  if (!bachelor) return -1;
2824  Int_t labBachelor = TMath::Abs(bachelor->GetLabel());
2825  if (labBachelor<0) return -1;
2826  AliAODMCParticle *partBachelor = (AliAODMCParticle*)mcArray->At(labBachelor);
2827  if (!partBachelor) return -1;
2828  if (TMath::Abs(partBachelor->GetPdgCode())!=pdgDgLc2bacV0[0]) return -1;
2829 
2830  Int_t labBacMother = partBachelor->GetMother();
2831  if (labBacMother<0) return -1;
2832  AliAODMCParticle *partBacMother = (AliAODMCParticle*)mcArray->At(labBacMother);
2833  if (!partBacMother) return -1;
2834  if (TMath::Abs(partBacMother->GetPdgCode())!=4122) return -1;
2835 
2836  // V0
2837  AliAODTrack *posV0Daugh = (AliAODTrack*)lc2bacV0->Getv0PositiveTrack();
2838  AliAODTrack *negV0Daugh = (AliAODTrack*)lc2bacV0->Getv0NegativeTrack();
2839  if (!posV0Daugh || !negV0Daugh) return -1;
2840 
2841  Int_t labV0pos = TMath::Abs(posV0Daugh->GetLabel());
2842  Int_t labV0neg = TMath::Abs(negV0Daugh->GetLabel());
2843  if (labV0pos<0 || labV0neg<0) return -1;
2844 
2845  AliAODMCParticle *partV0pos = (AliAODMCParticle*)mcArray->At(labV0neg);
2846  AliAODMCParticle *partV0neg = (AliAODMCParticle*)mcArray->At(labV0pos);
2847  if (!partV0pos || !partV0neg) return -1;
2848 
2849  if ( ! ( (TMath::Abs(partV0pos->GetPdgCode())==pdgDgV0[0] &&
2850  TMath::Abs(partV0neg->GetPdgCode())==pdgDgV0[1]) ||
2851  (TMath::Abs(partV0pos->GetPdgCode())==pdgDgV0[1] &&
2852  TMath::Abs(partV0neg->GetPdgCode())==pdgDgV0[0]) ) ) return -1;
2853  Int_t labV0posMother = partV0pos->GetMother();
2854  Int_t labV0negMother = partV0neg->GetMother();
2855 
2856  if (labV0posMother<0 || labV0negMother<0) return -1;
2857  if (labV0posMother!=labV0negMother) return -1;
2858 
2859  AliAODMCParticle *motherV0 = (AliAODMCParticle*)mcArray->At(labV0posMother);
2860  if (!motherV0) return-1;
2861 
2862  if (TMath::Abs(motherV0->GetPdgCode())!=pdgDgLc2bacV0[1]) return -1;
2863  Int_t labV0mother = motherV0->GetMother();
2864  if (labV0mother<0) return -1;
2865  AliAODMCParticle *gMotherV0 = (AliAODMCParticle*)mcArray->At(labV0mother);
2866  if (!gMotherV0) return-1;
2867 
2868  if ( !(pdgDgLc2bacV0[1]==310 && TMath::Abs(gMotherV0->GetPdgCode())==311) &&
2869  !(pdgDgLc2bacV0[1]==3122 && TMath::Abs(motherV0->GetPdgCode())==3122) ) return -1;
2870 
2871  if ( (pdgDgLc2bacV0[1]==310 && TMath::Abs(gMotherV0->GetPdgCode())==311) ) {
2872  Int_t labV0GMother = gMotherV0->GetMother();
2873  if (labV0GMother<0) return -1;
2874  AliAODMCParticle *ggMotherV0 = (AliAODMCParticle*)mcArray->At(labV0GMother);
2875  if (!ggMotherV0) return-1;
2876 
2877  if (TMath::Abs(ggMotherV0->GetPdgCode())!=4122) return -1;
2878  gMotherV0 = (AliAODMCParticle*)ggMotherV0;
2879  labV0mother=labV0GMother;
2880  }
2881  else if (pdgDgLc2bacV0[1]==3122 && TMath::Abs(motherV0->GetPdgCode())==3122) {
2882  if (TMath::Abs(gMotherV0->GetPdgCode())!=4122) return -1;
2883  }
2884 
2885  if (labBacMother!=labV0mother) {
2886  return -1;
2887  }
2888 
2889  return labBacMother;
2890 
2891 }
2892 
2893 //________________________________________________________________
2895  //
2897  //
2898 
2899  Int_t indexToBeReturned=-999;
2900 
2901  Int_t pdgLc=4122;
2902  Int_t pdgLambda=3122;
2903  Int_t pdgV0=310;
2904  Int_t pdgK0=311;
2905  Int_t pdgBachelor=2212;
2906  Int_t pdgBachelorPi=211;
2907 
2908  TString fillthis="";
2909  fillthis="histMcStatLc";
2910 
2911  AliAODMCParticle *searchLc = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iii));
2912  if(!searchLc) return -999;
2913  if (TMath::Abs(searchLc->GetPdgCode()) != pdgLc) return -999;
2914 
2915  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(0);
2916  indexToBeReturned = 0;
2917 
2918  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*1);
2919  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*1;
2920 
2921  Int_t nDaughLc = searchLc->GetNDaughters();
2922  if (nDaughLc!=2) {
2923  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
2924  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
2925  return indexToBeReturned;
2926  }
2927 
2928  Int_t index1=searchLc->GetDaughter(0);
2929  Int_t index2=searchLc->GetDaughter(1);
2930  if (index1<=0 || index2<=0) {
2931  return -999;
2932  }
2933 
2934  AliAODMCParticle *daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2935  AliAODMCParticle *daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2936  if (!daugh1 || !daugh2) return -999;
2937 
2938  Int_t daughPdg1 = TMath::Abs(daugh1->GetPdgCode());
2939  Int_t daughPdg2 = TMath::Abs(daugh2->GetPdgCode());
2940  if ( !( (daughPdg1==pdgBachelor && daughPdg2==pdgK0) ||
2941  (daughPdg2==pdgBachelor && daughPdg1==pdgK0) ||
2942  (daughPdg1==pdgLambda && daughPdg2==pdgBachelorPi) ||
2943  (daughPdg2==pdgLambda && daughPdg1==pdgBachelorPi) ) ) {
2944  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
2945  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
2946  return indexToBeReturned;
2947  }
2948 
2949  if (daughPdg1==pdgK0 || daughPdg1==pdgLambda) {
2950  index1=searchLc->GetDaughter(1);
2951  index2=searchLc->GetDaughter(0);
2952  }
2953  daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2954  daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2955  if (!daugh1 || !daugh2) return -999;
2956 
2957  daughPdg1=TMath::Abs(daugh1->GetPdgCode());
2958  daughPdg2=TMath::Abs(daugh2->GetPdgCode());
2959 
2960  if ( daughPdg1==pdgBachelor && daughPdg2==pdgK0 ) { // Lc+ -> p K0bar
2961 
2962  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*2);
2963  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*2;
2964 
2965  Int_t nDaughK0 = daugh2->GetNDaughters();
2966  if (nDaughK0!=1) return -999;
2967 
2968  Int_t indexK0daugh=daugh2->GetDaughter(0);
2969  if (indexK0daugh<=0) return -999;
2970 
2971  AliAODMCParticle *daughK0 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(indexK0daugh));
2972  if (!daughK0) return -999;
2973 
2974  Int_t daughK0Pdg=TMath::Abs(daughK0->GetPdgCode());
2975  if (daughK0Pdg!=pdgV0) {
2976  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*4); // K0L
2977  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*4;
2978  return indexToBeReturned;
2979  }
2980  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*3); // K0S
2981  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*3;
2982 
2983  Int_t nDaughK0S = daughK0->GetNDaughters();
2984  if (nDaughK0S!=2) {
2985  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
2986  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
2987  return indexToBeReturned;
2988  }
2989 
2990  index1=daughK0->GetDaughter(0);
2991  index2=daughK0->GetDaughter(1);
2992  if(index1<=0 || index2<=0) {
2993  return -999;
2994  }
2995 
2996  AliAODMCParticle *daughK0S1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2997  AliAODMCParticle *daughK0S2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2998  if (!daughK0S1 || !daughK0S2) return -999;
2999 
3000  Int_t daughK0S1pdg=TMath::Abs(daughK0S1->GetPdgCode());
3001  Int_t daughK0S2pdg=TMath::Abs(daughK0S2->GetPdgCode());
3002 
3003  if ( daughK0S1pdg==211 && daughK0S2pdg==211 ) {
3004  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*6); // K0S -> pi+ pi-
3005  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*6;
3006  } else {
3007  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
3008  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
3009  }
3010 
3011  } //if (daughPdg1==pdgBachelor && daughPdg2==pdgK0)
3012  else if ( daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda ) { // Lc+ -> pi+ Lambda
3013 
3014  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*7);
3015  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*7;
3016 
3017  Int_t nDaughL = daugh2->GetNDaughters();
3018  if (nDaughL!=2) {
3019  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
3020  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
3021  return indexToBeReturned;
3022  }
3023 
3024  index1=daugh2->GetDaughter(0);
3025  index2=daugh2->GetDaughter(1);
3026  if(index1<=0 || index2<=0) {
3027  return -999;
3028  }
3029 
3030  AliAODMCParticle *daughL1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
3031  AliAODMCParticle *daughL2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
3032  if (!daughL1 || !daughL2) return -999;
3033 
3034  Int_t daughL1pdg=TMath::Abs(daughL1->GetPdgCode());
3035  Int_t daughL2pdg=TMath::Abs(daughL2->GetPdgCode());
3036  if ( (daughL1pdg==211 && daughL2pdg==2212) ||
3037  (daughL2pdg==211 && daughL1pdg==2212) ) {
3038  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*9);
3039  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*9;
3040  } else {
3041  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
3042  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
3043  }
3044 
3045  } //else if (daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda)
3046 
3047  return indexToBeReturned;
3048 }
3049 
3050 //________________________________________________________________
3052  TString histoTitle,
3053  Bool_t isCandidateSelectedCuts,
3054  Bool_t isBachelorID) {
3055  //
3057  //
3058 
3059  Double_t alpha = vZero->Alpha();//AlphaV0();
3060  Double_t qT = vZero->QtProng();//PtArmV0();
3061 
3062  ((TH2F*)(fOutputAll->FindObject(histoTitle+"0")))->Fill(alpha,qT);
3063  if (isCandidateSelectedCuts) {
3064  ((TH2F*)(fOutputAll->FindObject(histoTitle)))->Fill(alpha,qT);
3065  if (isBachelorID)
3066  ((TH2F*)(fOutputPIDBach->FindObject(histoTitle)))->Fill(alpha,qT);
3067  }
3068 
3069 }
3070 
3071 //-------------------------------------------------------------------------------
3073  //
3075  //
3076 
3077  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
3078 
3079  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
3080  Bool_t onFlyV0 = v0part->GetOnFlyStatus(); // on-the-flight V0s
3081 
3082  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
3083 
3084  if ( !onFlyV0 )
3085  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(3); // it counts number of candidates coming from offline V0s
3086 
3087  if ( cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122)) )
3088  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(4);
3090  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(5);
3091  cutsAnal->SetUsePID(kFALSE);
3093  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(6);
3094  cutsAnal->SetUsePID(areCutsUsingPID);
3096  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(7);
3098  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(8);
3100  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(9);
3101 
3102  if ( cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122)) ) {
3103 
3105 
3106  Int_t aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kTracks);
3107  if ( (aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr ) {
3108  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
3109  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
3110  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates1")))->Fill( -aaa );
3111  else
3112  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates1")))->Fill( aaa );
3113  }
3114 
3115  cutsAnal->SetUsePID(kFALSE);
3116  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate);
3117  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
3118  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
3119  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
3120  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates2")))->Fill( -aaa );
3121  else
3122  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates2")))->Fill( aaa );
3123  }
3124  cutsAnal->SetUsePID(areCutsUsingPID);
3125 
3126  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kPID);
3127  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
3128  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
3129  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
3130  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates3")))->Fill( -aaa );
3131  else
3132  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates3")))->Fill( aaa );
3133  }
3134 
3135  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kAll);
3136  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
3137  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
3138  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
3139  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates4")))->Fill( -aaa );
3140  else
3141  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates4")))->Fill( aaa );
3142  }
3143 
3144  }
3145  }
3146 
3147  return;
3148 }
3149 
3150 //-------------------------------------------------------------------------------
3151 void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t isLc, Int_t checkLcOrigin) {
3152  //
3154  //
3155 
3156  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
3157  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
3158 
3159  Double_t invmassLc = part->InvMassLctoK0sP();
3160  Double_t invmassLc2Lpi = part->InvMassLctoLambdaPi();
3161 
3162  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
3163 
3164  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
3165  Double_t dcaV0ptp = v0part->GetDCA();
3166  Double_t invmassK0S = v0part->MassK0Short();
3167  Double_t invmassLambda = v0part->MassLambda();
3168  Double_t invmassLambdaBar = v0part->MassAntiLambda();
3169 
3170  Int_t isLc2LBarpi=0, isLc2Lpi=0;
3171  Int_t mcLabel = -1;
3172  Int_t isDp2K0Spi=0, isDs2K0SK=0;
3173  Int_t mcLabel2 = -1;
3174  Int_t mcLabel3 = -1;
3175  Int_t isKstar12K0Spi=0, isKstar22K0Spi=0;
3176  Int_t mcLabel4 = -1;
3177  Int_t mcLabel5 = -1;
3178  Double_t ptCandByMC = 0.;//fmcPartCandidate->Pt();
3179  Double_t yCandByMC = 0.;//fmcPartCandidate->Y();
3180  if (fUseMCInfo) {
3181  if (isLc) {
3182  Int_t pdgCand0 = 4122;
3183  Int_t pdgDgLctoV0bachelor0[2]={2212,310};
3184  Int_t pdgDgV0toDaughters0[2]={211,211};
3185  Int_t mcLabelLc2pK0S = part->MatchToMC(pdgCand0,pdgDgLctoV0bachelor0[1],pdgDgLctoV0bachelor0,pdgDgV0toDaughters0,mcArray,kTRUE);
3186  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabelLc2pK0S);
3187  if (lambdaCpartMC) {
3188  ptCandByMC = lambdaCpartMC->Pt();
3189  yCandByMC = lambdaCpartMC->Y();
3190  }
3191  }
3192 
3193  Int_t pdgCand = 4122;
3194  Int_t pdgDgLctoV0bachelor[2]={211,3122};
3195  Int_t pdgDgV0toDaughters[2]={2212,211};
3196  mcLabel = part->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE);
3197  if (mcLabel!=-1) {
3198  if (bachelor->Charge()<0) isLc2LBarpi=1;
3199  if (bachelor->Charge()>0) isLc2Lpi=1;
3200  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel);
3201  if (lambdaCpartMC) {
3202  ptCandByMC = lambdaCpartMC->Pt();
3203  yCandByMC = lambdaCpartMC->Y();
3204  }
3205  }
3206 
3207  Int_t pdgCand2 = 411; // D+ -> pi+ K0S
3208  Int_t pdgCand3 = 431; // Ds+ -> K+ K0S
3209  Int_t pdgDgCand2[2]={211,310};
3210  Int_t pdgDgCand3[2]={321,310};
3211  pdgDgV0toDaughters[0]=211;
3212  pdgDgV0toDaughters[1]=211;
3213  mcLabel2 = part->MatchToMC(pdgCand2,pdgDgCand2[1],pdgDgCand2,pdgDgV0toDaughters,mcArray,kTRUE);
3214  mcLabel3 = part->MatchToMC(pdgCand3,pdgDgCand3[1],pdgDgCand3,pdgDgV0toDaughters,mcArray,kTRUE);
3215  if (mcLabel2!=-1) {
3216  isDp2K0Spi=1;
3217  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel2);
3218  if (lambdaCpartMC) {
3219  ptCandByMC = lambdaCpartMC->Pt();
3220  yCandByMC = lambdaCpartMC->Y();
3221  }
3222  }
3223  if (mcLabel3!=-1) {
3224  isDs2K0SK=1;
3225  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel3);
3226  if (lambdaCpartMC) {
3227  ptCandByMC = lambdaCpartMC->Pt();
3228  yCandByMC = lambdaCpartMC->Y();
3229  }
3230  }
3231 
3232  Int_t pdgCand4 = 313; // K*(892)+ -> pi+ K0S
3233  Int_t pdgCand5 = 325; // K*(1430)+ -> pi+ K0S
3234  Int_t pdgDgCand4[2]={211,310};
3235  Int_t pdgDgCand5[2]={211,310};
3236  pdgDgV0toDaughters[0]=211;
3237  pdgDgV0toDaughters[1]=211;
3238  mcLabel4 = part->MatchToMC(pdgCand4,pdgDgCand4[1],pdgDgCand4,pdgDgV0toDaughters,mcArray,kTRUE);
3239  mcLabel5 = part->MatchToMC(pdgCand5,pdgDgCand5[1],pdgDgCand5,pdgDgV0toDaughters,mcArray,kTRUE);
3240  if (mcLabel4!=-1) {
3241  isKstar12K0Spi=1;
3242  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel4);
3243  if (lambdaCpartMC) {
3244  ptCandByMC = lambdaCpartMC->Pt();
3245  yCandByMC = lambdaCpartMC->Y();
3246  }
3247  }
3248  if (mcLabel5!=-1) {
3249  isKstar22K0Spi=1;
3250  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel5);
3251  if (lambdaCpartMC) {
3252  ptCandByMC = lambdaCpartMC->Pt();
3253  yCandByMC = lambdaCpartMC->Y();
3254  }
3255  }
3256  }
3257 
3258  Int_t isLcByMC = isLc+isLc2LBarpi*2+isLc2Lpi*4+isDp2K0Spi*8+isDs2K0SK*16+isKstar12K0Spi*32+isKstar22K0Spi*64;
3259 
3260  Bool_t isMCparticleInFiducialAcceptance = kTRUE;
3261  if (isLc || isLc2LBarpi || isLc2Lpi || isDp2K0Spi || isDs2K0SK || isKstar12K0Spi || isKstar22K0Spi) {
3262  isMCparticleInFiducialAcceptance = cutsAnal->IsInFiducialAcceptance(ptCandByMC,yCandByMC);
3263  }
3264 
3265  Int_t isK0S = 0;
3266  Int_t isLambda = 0;
3267  Int_t isLambdaBar = 0;
3268  Int_t isGamma = 0;
3269  if (fUseMCInfo) {
3270  Int_t pdgDg2prong[2] = {211, 211};
3271  Int_t labelK0S = v0part->MatchToMC(310,mcArray,2,pdgDg2prong);
3272  if (labelK0S>=0) isK0S = 1;
3273 
3274  pdgDg2prong[0] = 211;
3275  pdgDg2prong[1] = 2212;
3276  Int_t lambdaLabel = v0part->MatchToMC(3122,mcArray,2,pdgDg2prong);
3277  if (lambdaLabel>=0) {
3278  AliAODMCParticle *lambdaTrack = (AliAODMCParticle*)mcArray->At(lambdaLabel);
3279  if (lambdaTrack->GetPdgCode()==3122) isLambda = 1;
3280  else if (lambdaTrack->GetPdgCode()==-3122) isLambdaBar = 1;
3281  }
3282 
3283  pdgDg2prong[0] = 11;
3284  pdgDg2prong[1] = 11;
3285  Int_t gammaLabel = v0part->MatchToMC(22,mcArray,2,pdgDg2prong);
3286  if (gammaLabel>=0) {
3287  AliAODMCParticle *gammaTrack = (AliAODMCParticle*)mcArray->At(gammaLabel);
3288  if (gammaTrack->GetPdgCode()==22) isGamma = 1;
3289  }
3290  }
3291 
3292  Int_t isV0ByMC = isK0S+isLambdaBar*2+isLambda*4+isGamma*8;
3293 
3294  Int_t isBachelorSelected = (bachelor->TestFilterMask(BIT(4)))*1 + (!(bachelor->TestFilterMask(BIT(4))))*2;
3295  isBachelorSelected += (bachelor->GetLabel()<0)*4 + (bachelor->GetLabel()>=0)*8;
3296  if ( ( !(bachelor->HasPointOnITSLayer(0)) && !(bachelor->HasPointOnITSLayer(1)) ) )
3297  isBachelorSelected += 16;
3298  else {
3299  if ( bachelor->HasPointOnITSLayer(0) && !(bachelor->HasPointOnITSLayer(1)) )
3300  isBachelorSelected += 32;
3301  else if ( !(bachelor->HasPointOnITSLayer(0)) && bachelor->HasPointOnITSLayer(1) )
3302  isBachelorSelected += 64;
3303  else
3304  isBachelorSelected += 128;
3305  }
3306 
3307  AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
3308  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack();
3309 
3310  Int_t areV0daughtersSelected = (v0pos->TestFilterMask(BIT(4)))*1 + (!(v0pos->TestFilterMask(BIT(4))))*2;
3311  areV0daughtersSelected += (v0pos->GetLabel()<0)*4 + (v0pos->GetLabel()>=0)*8;
3312  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(0))*16;
3313  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(1))*32;
3314  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(2))*64;
3315  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(3))*128;
3316  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(4))*256;
3317  areV0daughtersSelected += (v0pos->HasPointOnITSLayer(5))*512;
3318 
3319  areV0daughtersSelected += (v0neg->TestFilterMask(BIT(4)))*1024 + (!(v0neg->TestFilterMask(BIT(4))))*2048;
3320  areV0daughtersSelected += (v0neg->GetLabel()<0)*4096 + (v0neg->GetLabel()>=0)*8192;
3321  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(0))*16384;
3322  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(1))*32768;
3323  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(2))*65536;
3324  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(3))*131072;
3325  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(4))*262144;
3326  areV0daughtersSelected += (v0neg->HasPointOnITSLayer(5))*524288;
3327 
3328  Double_t nSigmaITSpr=-999.;
3329  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,4,nSigmaITSpr);
3330  Double_t nSigmaTPCpr=-999.;
3331  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
3332  Double_t nSigmaTOFpr=-999.;
3333  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,4,nSigmaTOFpr);
3334 
3335  Double_t nSigmaITSpi=-999.;
3336  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,2,nSigmaITSpi);
3337  Double_t nSigmaTPCpi=-999.;
3338  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,2,nSigmaTPCpi);
3339  Double_t nSigmaTOFpi=-999.;
3340  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,2,nSigmaTOFpi);
3341 
3342  Double_t nSigmaITSka=-999.;
3343  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,3,nSigmaITSka);
3344  Double_t nSigmaTPCka=-999.;
3345  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,3,nSigmaTPCka);
3346  Double_t nSigmaTOFka=-999.;
3347  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,3,nSigmaTOFka);
3348 
3349 
3350  Int_t flagToCheckCandidate = 1*(TMath::Abs(invmassK0S-mk0sPDG)<=0.050);
3351  flagToCheckCandidate+=2*((TMath::Abs(invmassLambdaBar-mLPDG)<=0.050) && (bachelor->Charge()<0));
3352  flagToCheckCandidate+=4*((TMath::Abs(invmassLambda-mLPDG)<=0.050) && (bachelor->Charge()>0));
3353  flagToCheckCandidate+=8*((TMath::Abs(invmassLambdaBar-mLPDG)<=0.050) && (bachelor->Charge()>0));
3354  flagToCheckCandidate+=16*((TMath::Abs(invmassLambda-mLPDG)<=0.050) && (bachelor->Charge()<0));
3355 
3356  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
3357  fCandidateVariables[ 1] = fUseMCInfo+isV0ByMC; // 0: real data; 1: bkg; 2: K0S->pi+pi; 3: LambdaBar->pbar+pi+; 5: Lambda->p+pi-
3358  fCandidateVariables[ 2] = isBachelorSelected;
3359  fCandidateVariables[ 3] = areV0daughtersSelected;
3360  fCandidateVariables[ 4] = flagToCheckCandidate;
3361  fCandidateVariables[ 5] = invmassLc;
3362  fCandidateVariables[ 6] = invmassLc2Lpi;
3363  fCandidateVariables[ 7] = part->InvMass2Prongs(0,1,211,310); // D+ -> pi+ K0S
3364  fCandidateVariables[ 8] = part->InvMass2Prongs(0,1,321,310); // D+S -> K+ K0S
3365  fCandidateVariables[ 9] = invmassK0S;
3366  fCandidateVariables[10] = invmassLambda;
3367  fCandidateVariables[11] = invmassLambdaBar;
3368  fCandidateVariables[12] = v0part->InvMass2Prongs(0,1,11,11);
3369  fCandidateVariables[13] = part->GetDCA();
3370  fCandidateVariables[14] = dcaV0ptp;
3371  fCandidateVariables[15] = part->Getd0Prong(0);
3372  fCandidateVariables[16] = part->Getd0Prong(1);
3373  fCandidateVariables[17] = v0part->Getd0Prong(0);
3374  fCandidateVariables[18] = v0part->Getd0Prong(1);
3375  fCandidateVariables[19] = part->CosPointingAngle();
3377  fCandidateVariables[21] = v0part->RadiusSecVtx();
3378  fCandidateVariables[22] = nSigmaITSpr;
3379  fCandidateVariables[23] = nSigmaITSpi;
3380  fCandidateVariables[24] = nSigmaITSka;
3381  fCandidateVariables[25] = nSigmaTPCpr;
3382  fCandidateVariables[26] = nSigmaTPCpi;
3383  fCandidateVariables[27] = nSigmaTPCka;
3384  fCandidateVariables[28] = nSigmaTOFpr;
3385  fCandidateVariables[29] = nSigmaTOFpi;
3386  fCandidateVariables[30] = nSigmaTOFka;
3387  fCandidateVariables[31] = part->Y(4122);
3388  fCandidateVariables[32] = bachelor->Eta();
3389  fCandidateVariables[33] = v0pos->Eta();
3390  fCandidateVariables[34] = v0neg->Eta();
3391  fCandidateVariables[35] = part->P();
3392  fCandidateVariables[36] = part->Pt();
3393  fCandidateVariables[37] = v0part->P();
3394  fCandidateVariables[38] = v0part->Pt();
3395  fCandidateVariables[39] = bachelor->P();
3396  fCandidateVariables[40] = bachelor->Pt();
3397  fCandidateVariables[41] = v0pos->P();
3398  fCandidateVariables[42] = v0pos->Pt();
3399  fCandidateVariables[43] = v0neg->P();
3400  fCandidateVariables[44] = v0neg->Pt();
3401  fCandidateVariables[45] = part->DecayLength();
3402  fCandidateVariables[46] = part->DecayLengthV0();
3405  fCandidateVariables[49] = part->DecayLengthXY();
3406  fCandidateVariables[50] = part->DecayLengthXYV0();
3411 
3412  Double_t dcaForLc=0.;
3413  if (fAdditionalChecks) {
3414  Double_t xVtxLc=0, yVtxLc=0, zVtxLc=0;
3415  Double_t xLcMC=0,yLcMC=0,zLcMC=0;
3416  Double_t pxVtxBachelor=0, pyVtxBachelor=0, pzVtxBachelor=0;
3417  dcaForLc = PropagateToDCA(v0part,bachelor,fBzkG, xVtxLc, yVtxLc, zVtxLc, pxVtxBachelor, pyVtxBachelor, pzVtxBachelor);
3418  if (isLc) {
3419  Int_t pdgCand0 = 4122;
3420  Int_t pdgDgLctoV0bachelor0[2]={2212,310};
3421  Int_t pdgDgV0toDaughters0[2]={211,211};
3422  Int_t mcLabel0 = part->MatchToMC(pdgCand0,pdgDgLctoV0bachelor0[1],pdgDgLctoV0bachelor0,pdgDgV0toDaughters0,mcArray,kTRUE);
3423  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel0));
3424  if(partLc){
3425  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3426  if(partLcDaug0){
3427  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3428  }
3429  }
3430  } else if (isLc2LBarpi || isLc2Lpi) {
3431  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
3432  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3433  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3434  } else if (isDp2K0Spi) {
3435  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel2));
3436  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3437  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3438  } else if (isDs2K0SK) {
3439  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel3));
3440  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3441  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3442  } else if (isKstar12K0Spi) {
3443  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel4));
3444  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3445  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3446  } else if (isKstar22K0Spi) {
3447  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel5));
3448  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
3449  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
3450  }
3451 
3452  fCandidateVariables[75]=part->GetSecVtxX();
3453  fCandidateVariables[76]=part->GetSecVtxY();
3454  fCandidateVariables[77]=part->GetSecVtxZ();
3455  fCandidateVariables[78]=xVtxLc;
3456  fCandidateVariables[79]=yVtxLc;
3457  fCandidateVariables[80]=zVtxLc;
3458  fCandidateVariables[81]=xLcMC;
3459  fCandidateVariables[82]=yLcMC;
3460  fCandidateVariables[83]=zLcMC;
3461  fCandidateVariables[84]=bachelor->Px();
3462  fCandidateVariables[85]=bachelor->Py();
3463  fCandidateVariables[86]=pxVtxBachelor;
3464  fCandidateVariables[87]=pyVtxBachelor;
3465  fCandidateVariables[88]=pzVtxBachelor;
3466  fCandidateVariables[89]=v0part->Px();
3467  fCandidateVariables[90]=v0part->Py();
3468  fCandidateVariables[91]=v0part->Pz();
3469  fCandidateVariables[92]=fVtx1->GetX();
3470  fCandidateVariables[93]=fVtx1->GetY();
3471  fCandidateVariables[94]=fVtx1->GetZ();
3472  }
3473 
3474  fCandidateVariables[55]=dcaForLc;
3475 
3476  fCandidateVariables[56]=part->CosThetaStar(0,4122,2212,310);
3477  fCandidateVariables[57]=part->CosThetaStar(1,4122,2212,310);
3478  fCandidateVariables[58]=v0part->Eta();
3479  fCandidateVariables[59]=v0part->Y(310);
3480  fCandidateVariables[60]=bachelor->Charge();
3481  fCandidateVariables[61]=isMCparticleInFiducialAcceptance;
3482 
3483  fCandidateVariables[62] = part->InvMass2Prongs(0,1,211,310); // Kstar( 892)+ -> pi+K0S
3484  fCandidateVariables[63] = part->InvMass2Prongs(0,1,321,310); // Kstar(1430)+ -> pi+K0S
3485 
3486  fCandidateVariables[64]=-1;
3487  fCandidateVariables[65]=-1;
3488  fCandidateVariables[66]=-1;
3489  fCandidateVariables[67]=-1;
3490  fCandidateVariables[68]=-1;
3491  if (fUseMCInfo) {
3492  if (bachelor->GetLabel()!=-1) {
3493  AliAODMCParticle *partBachelor = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(bachelor->GetLabel())));
3494  if(partBachelor) fCandidateVariables[64]=partBachelor->GetPdgCode();
3495  }
3496  if (bachelor->GetLabel()!=-1 &&
3497  v0pos->GetLabel()!=-1 &&
3498  v0neg->GetLabel()!=-1) {
3499  const Int_t ndg=3;
3500  Int_t dgLabels[ndg]={TMath::Abs(bachelor->GetLabel()),
3501  TMath::Abs(v0pos->GetLabel()),
3502  TMath::Abs(v0neg->GetLabel())};
3503  Int_t ndgCk=0;
3504  Int_t *pdgDg=0;
3505  Int_t absLabelMother=-1;
3506  Int_t nDauCand=-1;
3508  dgLabels,ndg,ndgCk,pdgDg,absLabelMother,nDauCand);
3509  }
3510  if (v0pos->GetLabel()!=-1) {
3511  AliAODMCParticle *part1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(v0pos->GetLabel())));
3512  if(part1) fCandidateVariables[66]=part1->GetPdgCode();
3513  }
3514  if (v0neg->GetLabel()!=-1) {
3515  AliAODMCParticle *part2 = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(v0neg->GetLabel())));
3516  if(part2) fCandidateVariables[67]=part2->GetPdgCode();
3517  }
3518  if (v0pos->GetLabel()!=-1 &&
3519  v0neg->GetLabel()!=-1) {
3520  const Int_t ndg=2;
3521  Int_t dgLabels[ndg]={TMath::Abs(v0pos->GetLabel()),
3522  TMath::Abs(v0neg->GetLabel())};
3523  Int_t ndgCk=0;
3524  Int_t *pdgDg=0;
3525  Int_t absLabelMother=-1;
3526  Int_t nDauCand=-1;
3528  dgLabels,ndg,ndgCk,pdgDg,absLabelMother,nDauCand);
3529  }
3530  }
3531 
3532  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
3533  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
3534  AliPIDResponse *pidResponse=inputHandler->GetPIDResponse();
3535  fCandidateVariables[69]=pidResponse->GetTOFResponse().GetStartTimeMask(bachelor->P());
3536 
3537  AliPIDCombined *objectPIDCombined=new AliPIDCombined;
3538  objectPIDCombined->SetDefaultTPCPriors();
3539  objectPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
3540 
3541  Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
3542  UInt_t detUsed = objectPIDCombined->ComputeProbabilities(bachelor, pidResponse, probTPCTOF);
3543 
3544  Double_t probProton = -1.;
3545  // Double_t probPion = -1.;
3546  // Double_t probKaon = -1.;
3547  if (detUsed == (UInt_t)objectPIDCombined->GetDetectorMask() ) {
3548  AliDebug(2, Form("We have found the detector mask for TOF + TPC: probProton will be set to %f", probTPCTOF[AliPID::kProton]));
3549  probProton = probTPCTOF[AliPID::kProton];
3550  // probPion = probTPCTOF[AliPID::kPion];
3551  // probKaon = probTPCTOF[AliPID::kKaon];
3552  }
3553  else { // if you don't have both TOF and TPC, try only TPC
3554  objectPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
3555  AliDebug(2, "We did not find the detector mask for TOF + TPC, let's see only TPC");
3556  detUsed = objectPIDCombined->ComputeProbabilities(bachelor, pidResponse, probTPCTOF);
3557  AliDebug(2,Form(" detUsed (TPC case) = %d", detUsed));
3558  if (detUsed == (UInt_t)objectPIDCombined->GetDetectorMask()) {
3559  probProton = probTPCTOF[AliPID::kProton];
3560  // probPion = probTPCTOF[AliPID::kPion];
3561  // probKaon = probTPCTOF[AliPID::kKaon];
3562  AliDebug(2, Form("TPC only worked: probProton will be set to %f", probTPCTOF[AliPID::kProton]));
3563  }
3564  else {
3565  AliDebug(2, "Only TPC did not work...");
3566  }
3567  // resetting mask to ask for both TPC+TOF
3568  objectPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
3569  }
3570  AliDebug(2, Form("probProton = %f", probProton));
3571 
3572  // now we get the TPC and TOF single PID probabilities (only for Proton, or the tree will explode :) )
3573  Double_t probProtonTPC = -1.;
3574  Double_t probProtonTOF = -1.;
3575  Double_t pidTPC[AliPID::kSPECIES]={-1.};
3576  Double_t pidTOF[AliPID::kSPECIES]={-1.};
3577  Int_t respTPC = pidResponse->ComputePIDProbability(AliPIDResponse::kDetTPC, bachelor, AliPID::kSPECIES, pidTPC);
3578  Int_t respTOF = pidResponse->ComputePIDProbability(AliPIDResponse::kDetTOF, bachelor, AliPID::kSPECIES, pidTOF);
3579  if (respTPC == AliPIDResponse::kDetPidOk) probProtonTPC = pidTPC[AliPID::kProton];
3580  if (respTOF == AliPIDResponse::kDetPidOk) probProtonTOF = pidTOF[AliPID::kProton];
3581 
3582  fCandidateVariables[70]=probProton;
3583  fCandidateVariables[71]=probProtonTPC;
3584  fCandidateVariables[72]=probProtonTOF;
3585 
3586  fCandidateVariables[73]=checkLcOrigin;
3587 
3588  fCandidateVariables[74]=v0part->QtProng();
3589 
3590  delete objectPIDCombined;
3591 
3592  fVariablesTree->Fill();
3593 
3594  return;
3595 }
3596 
3597 //-------------------------------------------------------------------------------
3599  //
3601  //
3602 
3603  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
3604  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
3605  Int_t nVar = 75;
3606  if (fAdditionalChecks) nVar = 95;
3608  TString * fCandidateVariableNames = new TString[nVar];
3609  fCandidateVariableNames[ 0]="isLcByMC";
3610  fCandidateVariableNames[ 1]="isV0ByMC";
3611  fCandidateVariableNames[ 2]="flagToCheckBachelor";
3612  fCandidateVariableNames[ 3]="flagToCheckV0daughters";
3613  fCandidateVariableNames[ 4]="flagToCheckCandidate";
3614  fCandidateVariableNames[ 5]="massLc2K0Sp";
3615  fCandidateVariableNames[ 6]="massLc2Lambdapi";
3616  fCandidateVariableNames[ 7]="massD2K0Spi"; // D+ -> pi+ K0S
3617  fCandidateVariableNames[ 8]="massDS2K0SK"; // D+S -> K+ K0S
3618  fCandidateVariableNames[ 9]="massK0S";
3619  fCandidateVariableNames[10]="massLambda";
3620  fCandidateVariableNames[11]="massLambdaBar";
3621  fCandidateVariableNames[12]="massGamma";
3622  fCandidateVariableNames[13]="dcaLcptp"; // DCA Lc prong-to-prong
3623  fCandidateVariableNames[14]="dcaV0ptp";
3624  fCandidateVariableNames[15]="tImpParBach";
3625  fCandidateVariableNames[16]="tImpParV0";
3626  fCandidateVariableNames[17]="dcaV0postoPV";
3627  fCandidateVariableNames[18]="dcaV0negtoPV";
3628  fCandidateVariableNames[19]="cosPALc";
3629  fCandidateVariableNames[20]="cosPAK0S";
3630  fCandidateVariableNames[21]="rhoV0";
3631  fCandidateVariableNames[22]="nSigmaITSpr";
3632  fCandidateVariableNames[23]="nSigmaITSpi";
3633  fCandidateVariableNames[24]="nSigmaITSka";
3634  fCandidateVariableNames[25]="nSigmaTPCpr";
3635  fCandidateVariableNames[26]="nSigmaTPCpi";
3636  fCandidateVariableNames[27]="nSigmaTPCka";
3637  fCandidateVariableNames[28]="nSigmaTOFpr";
3638  fCandidateVariableNames[29]="nSigmaTOFpi";
3639  fCandidateVariableNames[30]="nSigmaTOFka";
3640  fCandidateVariableNames[31]="yLc";
3641  fCandidateVariableNames[32]="etaBach"; // etaBachelor
3642  fCandidateVariableNames[33]="etaV0pos"; // etaV0pos
3643  fCandidateVariableNames[34]="etaV0neg"; // etaV0neg
3644  fCandidateVariableNames[35]="LcP"; // @ DCA
3645  fCandidateVariableNames[36]="LcPt"; // @ DCA
3646  fCandidateVariableNames[37]="v0P"; // @ V0 DCA
3647  fCandidateVariableNames[38]="v0Pt"; // @ V0 DCA
3648  fCandidateVariableNames[39]="bachelorP"; // @ prim vtx
3649  fCandidateVariableNames[40]="bachelorPt"; // @ prim vtx
3650  fCandidateVariableNames[41]="V0positiveP"; // @ prim vtx
3651  fCandidateVariableNames[42]="V0positivePt"; // @ prim vtx
3652  fCandidateVariableNames[43]="V0negativeP"; // @ prim vtx
3653  fCandidateVariableNames[44]="V0negativePt"; // @ prim vtx
3654  fCandidateVariableNames[45]="decayLengthLc";
3655  fCandidateVariableNames[46]="decayLengthV0";
3656  fCandidateVariableNames[47]="cosPALcXY"; // cosPA XY x Lc
3657  fCandidateVariableNames[48]="cosPAV0XY"; // cosPA XY x V0
3658  fCandidateVariableNames[49]="decayLengthLcXY"; // decay length XY x Lc
3659  fCandidateVariableNames[50]="decayLengthV0XY"; // decay length XY x V0
3660  fCandidateVariableNames[51]="normalizedDecayLengthLc"; // normalized decay length x Lc
3661  fCandidateVariableNames[52]="normalizedDecayLengthV0"; // normalized decay length x V0
3662  fCandidateVariableNames[53]="normalizedDecayLengthXYLc"; // normalized decay length XY x Lc
3663  fCandidateVariableNames[54]="normalizedDecayLengthXYV0"; // normalized decay length XY x V0
3664  fCandidateVariableNames[55]="newLcDCA";
3665 
3666  fCandidateVariableNames[56]="cosThetaStarBachelor";
3667  fCandidateVariableNames[57]="cosThetaStarV0";
3668  fCandidateVariableNames[58]="etaV0";
3669  fCandidateVariableNames[59]="yV0";
3670  fCandidateVariableNames[60]="bachelorCharge";
3671  fCandidateVariableNames[61]="isMCparticleInFiducialAcceptance";
3672 
3673  fCandidateVariableNames[62]="massKstar12K0Spi"; // Kstar( 892)+ -> pi+ K0S
3674  fCandidateVariableNames[63]="massKstar22K0Spi"; // Kstar(1430)+ -> pi+ K0S
3675  fCandidateVariableNames[64]="pdgBachelor"; // pdg MC bachelor
3676  fCandidateVariableNames[65]="pdgCandidate"; // pdg MC candidate recovered via new method
3677  fCandidateVariableNames[66]="pdgV0pos"; // pdg MC V0 positive
3678  fCandidateVariableNames[67]="pdgV0neg"; // pdg MC V0 negative
3679  fCandidateVariableNames[68]="pdgV0Candidate"; // pdg MC V0candidate recovered via new method
3680  fCandidateVariableNames[69]="startTimeMask"; // start time mask
3681 
3682  fCandidateVariableNames[70]="combinedProtonProb";
3683  fCandidateVariableNames[71]="TPCProtonProb";
3684  fCandidateVariableNames[72]="TOFProtonProb";
3685  fCandidateVariableNames[73]="checkLcOrigin";
3686 
3687  fCandidateVariableNames[74]="qtProng0V0";
3688 
3689  if (fAdditionalChecks) {
3690  fCandidateVariableNames[75]="xVtxLcBad";
3691  fCandidateVariableNames[76]="yVtxLcBad";
3692  fCandidateVariableNames[77]="zVtxLcBad";
3693  fCandidateVariableNames[78]="xVtxLcGood";
3694  fCandidateVariableNames[79]="yVtxLcGood";
3695  fCandidateVariableNames[80]="zVtxLcGood";
3696  fCandidateVariableNames[81]="xVtxLcMC";
3697  fCandidateVariableNames[82]="yVtxLcMC";
3698  fCandidateVariableNames[83]="zVtxLcMC";
3699  fCandidateVariableNames[84]="pxVtxBachelorBad";
3700  fCandidateVariableNames[85]="pyVtxBachelorBad";
3701  fCandidateVariableNames[86]="pxVtxBachelorGood";
3702  fCandidateVariableNames[87]="pyVtxBachelorGood";
3703  fCandidateVariableNames[88]="pzVtxBachelorGood";
3704  fCandidateVariableNames[89]="pxVtxV0";
3705  fCandidateVariableNames[90]="pyVtxV0";
3706  fCandidateVariableNames[91]="pzVtxV0";
3707  fCandidateVariableNames[92]="xPvtx";
3708  fCandidateVariableNames[93]="yPvtx";
3709  fCandidateVariableNames[94]="zPvtx";
3710  }
3711 
3712  for (Int_t ivar=0; ivar<nVar; ivar++) {
3713  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3714  }
3715 
3716  return;
3717 }
3718 
3719 //__________________________________________________________________________
3721  //
3723  //
3724 
3725  fCEvents = new TH1F("fCEvents","conter",20,0,20);
3726  fCEvents->SetStats(kTRUE);
3727  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
3728  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
3729  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
3730  fCEvents->GetXaxis()->SetBinLabel(4,"CascadesHF exists");
3731  fCEvents->GetXaxis()->SetBinLabel(5,"MCarray exists");
3732  fCEvents->GetXaxis()->SetBinLabel(6,"MCheader exists");
3733  fCEvents->GetXaxis()->SetBinLabel(7,"GetNContributors()>0");
3734  fCEvents->GetXaxis()->SetBinLabel(8,"IsEventSelected");
3735  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
3736  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
3737  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
3738  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
3739  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
3740  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
3741  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3742  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
3743  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
3744  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3745  fCEvents->GetXaxis()->SetBinLabel(19,"Re-Fill Fail");
3746  fCEvents->GetXaxis()->SetBinLabel(20,"AOD Mismatch");
3747  //fCEvents->GetXaxis()->SetTitle("");
3748  fCEvents->GetYaxis()->SetTitle("counts");
3749 
3750  fOutput->Add(fCEvents);
3751  TString fillthis="";
3752 
3753  if (fUseMCInfo && fAdditionalChecks) {
3754  fillthis="histMcStatLc";
3755  TH1F* mcStatisticLc = new TH1F(fillthis.Data(),"#Lambda_{c} generated and their decays",21,-10.5,10.5);
3756  fOutput->Add(mcStatisticLc);
3757  }
3758 
3759  //fillthis="histopionV0SigmaVspTOF";
3760  //TH2F *hpionV0SigmaVspTOF=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3761  fillthis="histoprotonBachSigmaVspTOF";
3762  TH2F *hprotonBachSigmaVspTOF=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3763 
3764  //fOutput->Add(hpionV0SigmaVspTOF);
3765  fOutput->Add(hprotonBachSigmaVspTOF);
3766 
3767  //fillthis="histopionV0SigmaVspTPC";
3768  //TH2F *hpionV0SigmaVspTPC=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3769  fillthis="histoprotonBachSigmaVspTPC";
3770  TH2F *hprotonBachSigmaVspTPC=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3771 
3772  //fOutput->Add(hpionV0SigmaVspTPC);
3773  fOutput->Add(hprotonBachSigmaVspTPC);
3774 
3775  if (fUseMCInfo) {
3776 
3777  //fillthis="histopionV0SigmaVspTOFsgn";
3778  //TH2F *hpionV0SigmaVspTOFsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3779  fillthis="histoprotonBachSigmaVspTOFsgn";
3780  TH2F *hprotonBachSigmaVspTOFsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3781 
3782  //fOutput->Add(hpionV0SigmaVspTOFsgn);
3783  fOutput->Add(hprotonBachSigmaVspTOFsgn);
3784 
3785  //fillthis="histopionV0SigmaVspTPCsgn";
3786  //TH2F *hpionV0SigmaVspTPCsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3787  fillthis="histoprotonBachSigmaVspTPCsgn";
3788  TH2F *hprotonBachSigmaVspTPCsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3789 
3790  //fOutput->Add(hpionV0SigmaVspTPCsgn);
3791  fOutput->Add(hprotonBachSigmaVspTPCsgn);
3792 
3793 
3794  //fillthis="histopionV0SigmaVspTOFbkg";
3795  //TH2F *hpionV0SigmaVspTOFbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3796  fillthis="histoprotonBachSigmaVspTOFbkg";
3797  TH2F *hprotonBachSigmaVspTOFbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3798 
3799  //fOutput->Add(hpionV0SigmaVspTOFbkg);
3800  fOutput->Add(hprotonBachSigmaVspTOFbkg);
3801 
3802  //fillthis="histopionV0SigmaVspTPCbkg";
3803  //TH2F *hpionV0SigmaVspTPCbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3804  fillthis="histoprotonBachSigmaVspTPCbkg";
3805  TH2F *hprotonBachSigmaVspTPCbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3806 
3807  //fOutput->Add(hpionV0SigmaVspTPCbkg);
3808  fOutput->Add(hprotonBachSigmaVspTPCbkg);
3809 
3810  }
3811 
3812  if (fAdditionalChecks) {
3813 
3814  TH1F *hZ2 = new TH1F("hZ2","",100,-50.,50.);
3815  fOutput->Add(hZ2);
3816  TH1F *hZ3 = new TH1F("hZ3","",100,-50.,50.);
3817  fOutput->Add(hZ3);
3818  TH1F *hZ4 = new TH1F("hZ4","",100,-50.,50.);
3819  fOutput->Add(hZ4);
3820  TH1F *hZ5 = new TH1F("hZ5","",100,-50.,50.);
3821  fOutput->Add(hZ5);
3822  TH1F *hZ6 = new TH1F("hZ6","",100,-50.,50.);
3823  fOutput->Add(hZ6);
3824  TH1F *hZ7 = new TH1F("hZ7","",100,-50.,50.);
3825  fOutput->Add(hZ7);
3826  TH1F *hZ8 = new TH1F("hZ8","",100,-50.,50.);
3827  fOutput->Add(hZ8);
3828  TH1F *hZ9 = new TH1F("hZ9","",100,-50.,50.);
3829  fOutput->Add(hZ9);
3830  TH1F *hZ10 = new TH1F("hZ10","",100,-50.,50.);
3831  fOutput->Add(hZ10);
3832  TH1F *hZ11 = new TH1F("hZ11","",100,-50.,50.);
3833  fOutput->Add(hZ11);
3834  TH1F *hZ12 = new TH1F("hZ12","",100,-50.,50.);
3835  fOutput->Add(hZ12);
3836  TH1F *hZ13 = new TH1F("hZ13","",100,-50.,50.);
3837  fOutput->Add(hZ13);
3838  TH1F *hZ14 = new TH1F("hZ14","",100,-50.,50.);
3839  fOutput->Add(hZ14);
3840  TH1F *hZ15 = new TH1F("hZ15","",100,-50.,50.);
3841  fOutput->Add(hZ15);
3842  TH1F *hZ16 = new TH1F("hZ16","",100,-50.,50.);
3843  fOutput->Add(hZ16);
3844  }
3845 
3846  TH1F *hCandidateSelection = new TH1F("hCandidateSelection","",10,-0.5,9.5);
3847  hCandidateSelection->GetXaxis()->SetBinLabel(1,"IsEventSelected");
3848  hCandidateSelection->GetXaxis()->SetBinLabel(2,"IsSecondaryVtx");
3849  hCandidateSelection->GetXaxis()->SetBinLabel(3,"V0toPosNeg");
3850  hCandidateSelection->GetXaxis()->SetBinLabel(4,"offlineV0");
3851  hCandidateSelection->GetXaxis()->SetBinLabel(5,"isInFiducialAcceptance");
3852  hCandidateSelection->GetXaxis()->SetBinLabel(6,"analCuts::kTracks");
3853  hCandidateSelection->GetXaxis()->SetBinLabel(7,"analCuts::kCandidateNoPID");
3854  hCandidateSelection->GetXaxis()->SetBinLabel(8,"analCuts::kPID");
3855  hCandidateSelection->GetXaxis()->SetBinLabel(9,"analCuts::kCandidateWithPID");
3856  hCandidateSelection->GetXaxis()->SetBinLabel(10,"analCuts::kAll");
3857  fOutput->Add(hCandidateSelection);
3858 
3859  TH1F *hEventsWithCandidates = new TH1F("hEventsWithCandidates","conter",11,5.5,16.5);
3860  hEventsWithCandidates->GetXaxis()->SetBinLabel(1,"GetNContributors()>0");
3861  hEventsWithCandidates->GetXaxis()->SetBinLabel(2,"IsEventSelected");
3862  hEventsWithCandidates->GetXaxis()->SetBinLabel(3,"triggerClass!=CINT1");
3863  hEventsWithCandidates->GetXaxis()->SetBinLabel(4,"triggerMask!=kAnyINT");
3864  hEventsWithCandidates->GetXaxis()->SetBinLabel(5,"triggerMask!=kAny");
3865  hEventsWithCandidates->GetXaxis()->SetBinLabel(6,"vtxTitle.Contains(Z)");
3866  hEventsWithCandidates->GetXaxis()->SetBinLabel(7,"vtxTitle.Contains(3D)");
3867  hEventsWithCandidates->GetXaxis()->SetBinLabel(8,"vtxTitle.Doesn'tContain(Z-3D)");
3868  hEventsWithCandidates->GetXaxis()->SetBinLabel(9,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3869  hEventsWithCandidates->GetXaxis()->SetBinLabel(10,"!IsEventSelected");
3870  hEventsWithCandidates->GetXaxis()->SetBinLabel(11,"triggerMask!=kAnyINT || triggerClass!=CINT1");
3871  fOutput->Add(hEventsWithCandidates);
3872 
3873  if (fAdditionalChecks) {
3874 
3875  TH1F *hZ6a = new TH1F("hZ6a","",100,-50.,50.);
3876  fOutput->Add(hZ6a);
3877  TH1F *hZ7a = new TH1F("hZ7a","",100,-50.,50.);
3878  fOutput->Add(hZ7a);
3879  TH1F *hZ8a = new TH1F("hZ8a","",100,-50.,50.);
3880  fOutput->Add(hZ8a);
3881  TH1F *hZ9a = new TH1F("hZ9a","",100,-50.,50.);
3882  fOutput->Add(hZ9a);
3883  TH1F *hZ10a = new TH1F("hZ10a","",100,-50.,50.);
3884  fOutput->Add(hZ10a);
3885  TH1F *hZ11a = new TH1F("hZ11a","",100,-50.,50.);
3886  fOutput->Add(hZ11a);
3887  TH1F *hZ12a = new TH1F("hZ12a","",100,-50.,50.);
3888  fOutput->Add(hZ12a);
3889  TH1F *hZ13a = new TH1F("hZ13a","",100,-50.,50.);
3890  fOutput->Add(hZ13a);
3891  TH1F *hZ14a = new TH1F("hZ14a","",100,-50.,50.);
3892  fOutput->Add(hZ14a);
3893  TH1F *hZ15a = new TH1F("hZ15a","",100,-50.,50.);
3894  fOutput->Add(hZ15a);
3895  TH1F *hZ16a = new TH1F("hZ16a","",100,-50.,50.);
3896  fOutput->Add(hZ16a);
3897  }
3898 
3899  TH1F *hSwitchOnCandidates1 = new TH1F("hSwitchOnCandidates1","",15,-7.5,7.5);
3900  fOutput->Add(hSwitchOnCandidates1);
3901  TH1F *hSwitchOnCandidates2 = new TH1F("hSwitchOnCandidates2","",15,-7.5,7.5);
3902  fOutput->Add(hSwitchOnCandidates2);
3903  TH1F *hSwitchOnCandidates3 = new TH1F("hSwitchOnCandidates3","",15,-7.5,7.5);
3904  fOutput->Add(hSwitchOnCandidates3);
3905  TH1F *hSwitchOnCandidates4 = new TH1F("hSwitchOnCandidates4","",15,-7.5,7.5);
3906  fOutput->Add(hSwitchOnCandidates4);
3907 
3908  return;
3909 }
3910 
3911 //________________________________________________________________________
3913  //
3914  // This is to fill analysis histograms
3915  //
3916 
3917  TString fillthis="";
3918 
3919  Bool_t isBachelorID = (((cutsAnal->IsSelected(part,AliRDHFCuts::kPID))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // ID x bachelor
3920 
3921  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
3922  cutsAnal->SetUsePID(kFALSE);
3923 
3924  Double_t invmassLc = part->InvMassLctoK0sP();
3925  Double_t lambdacpt = part->Pt();
3926 
3927  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
3928  Double_t momBach = bachelor->P();
3929  Double_t ptBach = bachelor->Pt();
3930 
3931  AliAODv0 *v0part = (AliAODv0*)part->Getv0();
3932  Double_t momK0S = v0part->P();
3933  Double_t ptK0S = v0part->Pt();
3934  //Double_t dcaV0ptp = v0part->GetDCA();
3935  Double_t invmassK0S = v0part->MassK0Short();
3936 
3937  AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
3938  Double_t ptV0pos = v0pos->Pt();
3939  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack();
3940  Double_t ptV0neg = v0neg->Pt();
3941 
3942  if (!appendthis.Contains("SgnC") && !appendthis.Contains("SgnB") && !appendthis.Contains("SgnNoQ")) {
3943  fillthis="histpK0Svsp"+appendthis;
3944  //cout << fillthis << endl;
3946  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(momBach,momK0S);
3947  if (isBachelorID) ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(momBach,momK0S);
3948  }
3949  }
3950 
3951  fillthis="histLcMassByK0S"+appendthis;
3952  //cout << fillthis << endl;
3954  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
3955  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
3956  }
3957 
3958  if (!appendthis.Contains("SgnC") && !appendthis.Contains("SgnB") && !appendthis.Contains("SgnNoQ")) {
3959  fillthis="histK0SMass"+appendthis;
3960  // cout << fillthis << endl;
3961  cutsAnal->SetExcludedCut(2);
3963  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,invmassK0S);
3964  if (isBachelorID) ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,invmassK0S);
3965  }
3966  cutsAnal->SetExcludedCut(-1);
3967  }
3968 
3969  fillthis="histptK0S"+appendthis;
3970  //cout << fillthis << endl;
3971  cutsAnal->SetExcludedCut(15);
3973  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
3974  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
3975  }
3976 
3977  fillthis="histptP"+appendthis;
3978  //cout << fillthis << endl;
3979  cutsAnal->SetExcludedCut(4);
3981  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
3982  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
3983  }
3984 
3985  fillthis="histptPip"+appendthis;
3986  //cout << fillthis << endl;
3987  cutsAnal->SetExcludedCut(5);
3989  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
3990  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
3991  }
3992 
3993  fillthis="histptPim"+appendthis;
3994  //cout << fillthis << endl;
3995  cutsAnal->SetExcludedCut(6);
3997  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
3998  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
3999  }
4000 
4001  if (!appendthis.Contains("SgnC") && !appendthis.Contains("SgnB") && !appendthis.Contains("SgnNoQ")) {
4002  fillthis="histLambdaMass"+appendthis;
4003  // cout << fillthis << endl;
4004  cutsAnal->SetExcludedCut(13);
4006  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
4007  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
4008  }
4009 
4010  fillthis="histLambdaBarMass"+appendthis;
4011  // cout << fillthis << endl;
4012  cutsAnal->SetExcludedCut(13);
4014  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
4015  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
4016  }
4017 
4018  fillthis="histGammaMass"+appendthis;
4019  // cout << fillthis << endl;
4020  cutsAnal->SetExcludedCut(14);
4022  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
4023  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
4024  }
4025  }
4026 
4027  fillthis="histD0K0S"+appendthis;
4028  //cout << fillthis << endl;
4029  cutsAnal->SetExcludedCut(11);
4031  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
4032  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
4033  }
4034 
4035  fillthis="histD0P"+appendthis;
4036  //cout << fillthis << endl;
4037  cutsAnal->SetExcludedCut(10);
4039  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
4040  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
4041  }
4042 
4043  fillthis="histCosPAK0S"+appendthis;
4044  //cout << fillthis << endl;
4045  cutsAnal->SetExcludedCut(9);
4047  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
4048  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
4049  }
4050 
4051  fillthis="histCosThetaProtonCMS"+appendthis;
4052  //cout << fillthis << endl;
4053  cutsAnal->SetExcludedCut(16);
4055  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,cutsAnal->GetProtonEmissionAngleCMS(part));
4056  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,cutsAnal->GetProtonEmissionAngleCMS(part));
4057  }
4058 
4059  fillthis="histResignedD0"+appendthis;
4060  //cout << fillthis << endl;
4061  cutsAnal->SetExcludedCut(18);
4063  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,cutsAnal->GetReSignedd0(part));
4064  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,cutsAnal->GetReSignedd0(part));
4065  }
4066 
4067  cutsAnal->SetExcludedCut(-1);
4068 
4069  cutsAnal->SetUsePID(areCutsUsingPID);
4070 
4071  return;
4072 }
4073 //---------------------------
4075  Double_t &xVtxLc, Double_t &yVtxLc, Double_t &zVtxLc,
4076  Double_t &pxVtxBachelor, Double_t &pyVtxBachelor, Double_t &pzVtxBachelor) {
4077  //--------------------------------------------------------------------
4080  //--------------------------------------------------------------------
4081 
4082  // Get AliExternalTrackParam out of the AliAODTracks
4083  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
4084  bachelor->PxPyPz(pxpypz);
4085  bachelor->XvYvZv(xyz);
4086  bachelor->GetCovarianceXYZPxPyPz(cv);
4087  sign=bachelor->Charge();
4088  AliExternalTrackParam *t = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
4089 
4090  Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
4091  //Double_t alpha = GetAlpha(xyz,pxpypz), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
4092 
4093  // position and momentum of bachelor
4094  Double_t x1=xyz[0], y1=xyz[1], z1=xyz[2];
4095  Double_t px1=pxpypz[0], py1=pxpypz[1], pz1=pxpypz[2];
4096 
4097  // position and momentum of V0
4098  Double_t x2=v->DecayVertexV0X(),
4099  y2=v->DecayVertexV0Y(),
4100  z2=v->DecayVertexV0Z();
4101  Double_t px2=v->Px(),
4102  py2=v->Py(),
4103  pz2=v->Pz();
4104 
4105  /*
4106  AliAODTrack *trackP = (AliAODTrack*) v->GetDaughter(0);
4107  //Double_t pxpypzP[3]; trackP->PxPyPz(pxpypzP);
4108  //Double_t xyzP[3]; trackP->XvYvZv(xyzP);
4109  Double_t cvP[21]; trackP->GetCovarianceXYZPxPyPz(cvP);
4110  //Short_t signP=trackP->Charge();
4111  //AliExternalTrackParam *tP = new AliExternalTrackParam(xyzP,pxpypzP,cvP,signP);
4112 
4113  // Get AliExternalTrackParam out of the AliAODTrack
4114  AliAODTrack *trackN = (AliAODTrack*) v->GetDaughter(1);
4115  //Double_t pxpypzN[3]; trackN->PxPyPz(pxpypzN);
4116  //Double_t xyzN[3]; trackN->XvYvZv(xyzN);
4117  Double_t cvN[21]; trackN->GetCovarianceXYZPxPyPz(cvN);
4118  //Short_t signN=trackN->Charge();
4119  //AliExternalTrackParam *tN = new AliExternalTrackParam(xyzN,pxpypzN,cvN,signN);
4120 
4121  Double_t xyzV0[3]={x2,y2,z2};
4122  Double_t pxpypzV0[3]={px2,py2,pz2};
4123  Double_t cvV0[21]; for (Int_t ii=0; ii<21; ii++) cvV0[ii]=cvP[ii]+cvN[ii];
4124  AliNeutralTrackParam *trackV0 = new AliNeutralTrackParam(xyzV0,pxpypzV0,cvV0,0);
4125  */
4126 
4127  // calculation dca
4128  Double_t dd= Det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
4129  Double_t ax= Det(py1,pz1,py2,pz2);
4130  Double_t ay=-Det(px1,pz1,px2,pz2);
4131  Double_t az= Det(px1,py1,px2,py2);
4132 
4133  Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
4134 
4135  // bachelor point @ the DCA
4136  Double_t t1 = Det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
4137  Det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
4138  x1 += px1*t1; y1 += py1*t1; z1 += pz1*t1;
4139 
4140  //propagate track to the point of DCA
4141  Double_t rho1=x1*cs1 + y1*sn1;
4142  if (!t->PropagateTo(rho1,b)) {
4143  Error("PropagateToDCA","Propagation failed !");
4144  delete t; t=NULL;
4145  return 1.e+33;
4146  }
4147 
4148  Double_t pBachelorDCA[3]; t->GetPxPyPz(pBachelorDCA);
4149  pxVtxBachelor=pBachelorDCA[0], pyVtxBachelor=pBachelorDCA[1], pzVtxBachelor=pBachelorDCA[2];
4150 
4151  delete t; t=NULL;
4152 
4153  // V0 point @ the DCA
4154  Double_t t2 = Det(x1-x2,y1-y2,z1-z2,px1,py1,pz1,ax,ay,az)/
4155  Det(px2,py2,pz2,px1,py1,pz1,ax,ay,az);
4156  x2 += px2*t2; y2 += py2*t2; z2 += pz2*t2;
4157 
4158 
4159  // Lc decay vtx
4160  xVtxLc = 0.5*(x1+x2);
4161  yVtxLc = 0.5*(y1+y2);
4162  zVtxLc = 0.5*(z1+z2);
4163 
4164  return dca;
4165 
4166 }
4167 
4168 //---------------------------
4170 {
4171  //
4173  //
4174 
4175  Double_t alpha = 0.;
4176 
4177  const double kSafe = 1e-5;
4178  Double_t radPos2 = xyz[0]*xyz[0]+xyz[1]*xyz[1];
4179  Double_t radMax = 45.; // approximately ITS outer radius
4180  if (radPos2 < radMax*radMax) { // inside the ITS
4181  alpha = TMath::ATan2(pxpypz[1],pxpypz[0]);
4182  } else { // outside the ITS
4183  Float_t phiPos = TMath::Pi()+TMath::ATan2(-xyz[1], -xyz[0]);
4184  alpha =
4185  TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10);
4186  }
4187 
4188  Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
4189  // protection: avoid alpha being too close to 0 or +-pi/2
4190  if (TMath::Abs(sn)<2*kSafe) {
4191  if (alpha>0) alpha += alpha< TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
4192  else alpha += alpha>-TMath::Pi()/2. ? -2*kSafe : 2*kSafe;
4193  cs=TMath::Cos(alpha);
4194  sn=TMath::Sin(alpha);
4195  }
4196  else if (TMath::Abs(cs)<2*kSafe) {
4197  if (alpha>0) alpha += alpha> TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
4198  else alpha += alpha>-TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
4199  cs=TMath::Cos(alpha);
4200  sn=TMath::Sin(alpha);
4201  }
4202 
4203 
4204  return alpha;
4205 }
4206 
4207 //---------------------------
4209  Double_t a10, Double_t a11) const {
4210  //--------------------------------------------------------------------
4213  //--------------------------------------------------------------------
4214  return a00*a11 - a01*a10;
4215 }
4216 
4217 //---------------------------
4219  Double_t a10,Double_t a11,Double_t a12,
4220  Double_t a20,Double_t a21,Double_t a22) const {
4221  //--------------------------------------------------------------------
4224  //--------------------------------------------------------------------
4225  return a00*Det(a11,a12,a21,a22)-a01*Det(a10,a12,a20,a22)+a02*Det(a10,a11,a20,a21);
4226 }
4227 
4228 //----------------------------------------------------------------------------
4230  TClonesArray *mcArray)
4231 {
4232  //
4236  //
4237 
4238  AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(candidate->Getv0()); // the V0
4239  AliVTrack *trk = dynamic_cast<AliVTrack*>(candidate->GetBachelor()); // the bachelor
4240  if (!trk || !theV0) return -1;
4241 
4242  if (trk->GetLabel()==-1) return -1;
4243  Int_t bachLabels = TMath::Abs(trk->GetLabel());
4244  AliAODMCParticle*bachelorMC = dynamic_cast<AliAODMCParticle*>(mcArray->At(bachLabels));
4245  if (!bachelorMC) return -1;
4246  if (TMath::Abs(bachelorMC->GetPdgCode())!=2212) return -1;
4247  Int_t indexMotherBach = bachelorMC->GetMother();
4248  if (indexMotherBach==-1) return -1;
4249 
4250  Int_t pdgDg2prong[2] = {211,211};
4251  Int_t lab2Prong = theV0->MatchToMC(310,mcArray,2,pdgDg2prong); // the V0
4252  if(lab2Prong<0) return -1;
4253  AliAODMCParticle*partK0S = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
4254  if (!partK0S) return -1;
4255  Int_t indexMotherK0S = partK0S->GetMother();
4256  if (indexMotherK0S==-1) return -1;
4257  AliAODMCParticle*partK0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(indexMotherK0S));
4258  if (!partK0) return -1;
4259  Int_t indexMotherK0 = partK0->GetMother();
4260  if (indexMotherK0==-1) return -1;
4261 
4262  if (indexMotherBach!=indexMotherK0) return -1; // p e K0S sono fratelli
4263 
4264  AliAODMCParticle*partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(indexMotherK0));
4265  if (!partLc) return -1;
4266  Int_t ndg2 = partLc->GetDaughter(1)-partLc->GetDaughter(0)+1;
4267  if (ndg2==2) return -1;
4268 
4269  TString stringaCheck = Form(">>>>>>>> %d -> ",partLc->GetPdgCode());
4270  for(Int_t ii=0; ii<ndg2; ii++) {
4271  AliAODMCParticle* partDau=(AliAODMCParticle*)(mcArray->At(partLc->GetDaughter(0)+ii));
4272  stringaCheck.Append(Form(" %d",partDau->GetPdgCode()));
4273  }
4274  //printf("%s \n",stringaCheck.Data());
4275 
4276  return indexMotherBach;
4277 
4278 }
4279 //--------------------------------------------------------------------------
4281  Int_t dgLabels[10],Int_t ndg,
4282  Int_t &ndgCk, Int_t *pdgDg, Int_t &absLabelMother, Int_t &nDauCand) const
4283 {
4289 
4290  Int_t lab=-1,labMother=-1,pdgMother=0;
4291  AliAODMCParticle *part=0;
4292  AliAODMCParticle *mother=0;
4293 
4294  // loop on daughter labels
4295  TArrayI **labelMother = new TArrayI*[ndg];
4296  for(Int_t i=0; i<ndg; i++) labelMother[i] = new TArrayI(0);
4297  for(Int_t i=0; i<ndg; i++) {
4298  lab = TMath::Abs(dgLabels[i]);
4299  if(lab<0) {
4300  AliDebug(2,Form("daughter with negative label %d",lab));
4301  delete [] labelMother;
4302  return 0;
4303  }
4304  part = (AliAODMCParticle*)mcArray->At(lab);
4305  if(!part) {
4306  AliDebug(2,"no MC particle");
4307  delete [] labelMother;
4308  return 0;
4309  }
4310 
4311  mother = part;
4312  while(mother->GetMother()>=0) {
4313  labMother=mother->GetMother();
4314  mother = (AliAODMCParticle*)mcArray->At(labMother);
4315  if(!mother) {
4316  AliDebug(2,"no MC mother particle");
4317  break;
4318  }
4319  pdgMother = TMath::Abs(mother->GetPdgCode());
4320  if (pdgMother<10 || (pdgMother>18 && pdgMother<111)) {
4321  break;
4322  }
4323  labelMother[i]->Set(labelMother[i]->GetSize()+1);
4324  labelMother[i]->AddAt(labMother,labelMother[i]->GetSize()-1);
4325  }
4326 
4327  } // end loop on daughters
4328 
4329 
4330  TString stringaCheck;
4331  for(Int_t i=0; i<ndg; i++) {
4332  AliAODMCParticle*part0 = (AliAODMCParticle*)mcArray->At(TMath::Abs(dgLabels[i]));
4333  stringaCheck.Append(Form("part[%d]->GetLabel()=%d(%d) | ",i,dgLabels[i],part0->GetPdgCode()));
4334  stringaCheck.Append(Form("labelMother[%d] = ",i));
4335  for (Int_t jj=0;jj<labelMother[i]->GetSize(); jj++)
4336  stringaCheck.Append(Form("%d, ",labelMother[i]->At(jj)));
4337  }
4338  AliDebug(2,Form("%s \n",stringaCheck.Data()));
4339  Int_t pdgToBeReturned=0;
4340 
4341  TString stringaCheck2;
4342  ndgCk=ndg;
4343  pdgDg = new Int_t[ndgCk];
4344  for (Int_t index=1; index<ndg; index++) {
4345  Bool_t found=kFALSE;
4346  for (Int_t jj=0;jj<labelMother[index]->GetSize(); jj++) {
4347  for (Int_t ii=0;ii<labelMother[0]->GetSize(); ii++) {
4348  if (labelMother[0]->At(ii)==labelMother[index]->At(jj) &&
4349  labelMother[0]->At(ii)!=0 && labelMother[0]->At(ii)!=1 && !found) {
4350  mother = (AliAODMCParticle*)mcArray->At(labelMother[0]->At(ii));
4351  pdgToBeReturned=mother->GetPdgCode();
4352  absLabelMother=labelMother[0]->At(ii);
4353  AliDebug(2,Form("FOUND label for the mother of this candidate: %d (PDG=%d)\n",labelMother[0]->At(ii),pdgToBeReturned));
4354  //mother->Print();
4355  nDauCand=mother->GetNDaughters();
4356  found = kTRUE;
4357  AliAODMCParticle *partMC = (AliAODMCParticle*)mcArray->At(dgLabels[0]);
4358  pdgDg[0]=partMC->GetPdgCode();
4359  partMC = (AliAODMCParticle*)mcArray->At(dgLabels[index]);
4360  pdgDg[index]=partMC->GetPdgCode();
4361  if (index==1) stringaCheck2.Append(Form("found daughters -> %d(%d)",dgLabels[0],pdgDg[0]));
4362  stringaCheck2.Append(Form(" %d(%d)",dgLabels[index],pdgDg[index]));
4363  break;
4364  }
4365  }
4366  if (found) break;
4367  }
4368  }
4369  stringaCheck2.Prepend(Form("Ecco quanto trovato: %d(%d) with %d daughters; ",absLabelMother,pdgToBeReturned,nDauCand));
4370  AliDebug(2,Form("%s \n",stringaCheck2.Data()));
4371 
4372  delete [] labelMother;
4373  delete [] pdgDg;
4374 
4375  return pdgToBeReturned;
4376 
4377 }
4378 
4380 {
4381 
4382  AliAODRecoCascadeHF *partCopy = new AliAODRecoCascadeHF(*part);
4383 
4384  Double_t px[2]={partCopy->PxProng(0),partCopy->PxProng(1)};
4385  Double_t py[2]={partCopy->PyProng(0),partCopy->PyProng(1)};
4386  Double_t pz[2]={partCopy->PzProng(0),partCopy->PzProng(1)};
4387 
4388  Double_t pt = partCopy->Pt();
4389  Int_t pdgD=4122;
4390  UInt_t pdgLc2pK0S[2]={2212,310};
4391  Double_t minv2 = partCopy->InvMass2(2,pdgLc2pK0S);
4392  Double_t mass=TMath::Sqrt(minv2);
4393  Double_t rapid = partCopy->Y(pdgD);
4394 
4395  TString fillthis;
4396 
4398  fillthis="hMassVsPtVsY"+appendthis;
4399  //cout << fillthis << endl;
4400  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
4401 
4402  fillthis="phiVSthetaVSpt"+appendthis;
4403  //cout << fillthis << endl;
4404  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,part->Phi(),part->Theta());
4405  }
4406 
4407  Int_t nRotated=0;
4408  Double_t massRot=0;// calculated later only if candidate is acceptable
4409  // 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])));
4410  // Double_t ptOrig=pt;
4411  Double_t rotStep=(fMaxAngleForRot-fMinAngleForRot)/(fNRotations-1); // -1 is to ensure that the last rotation is done with angle=fMaxAngleForRot
4412 
4413  for(Int_t irot=0; irot<fNRotations; irot++){
4414  Double_t phirot=fMinAngleForRot+rotStep*irot;
4415  Double_t tmpx=px[0];
4416  Double_t tmpy=py[0];
4417  px[0]=tmpx*TMath::Cos(phirot)-tmpy*TMath::Sin(phirot);
4418  py[0]=tmpx*TMath::Sin(phirot)+tmpy*TMath::Cos(phirot);
4419  partCopy->SetPxPyPzProngs(2,px,py,pz);
4420  pt = partCopy->Pt();
4421  minv2 = partCopy->InvMass2(2,pdgLc2pK0S);
4422  massRot=TMath::Sqrt(minv2);
4423  rapid = partCopy->Y(pdgD);
4424  //if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
4425  if ( cuts->IsInFiducialAcceptance(pt,partCopy->Y(4122)) ) {
4427 
4428  fillthis="histLcMassByK0S"+appendthis;
4429  //cout << fillthis << endl;
4430  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot,pt);
4431 
4432  fillthis="hMassVsPtVsYRot"+appendthis;
4433  //cout << fillthis << endl;
4434  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
4435 
4436  fillthis="phiVSthetaVSptRot"+appendthis;
4437  //cout << fillthis << endl;
4438  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->Phi(),partCopy->Theta());
4439 
4440  fillthis="hDeltaMass"+appendthis;
4441  //cout << fillthis << endl;
4442  ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot-mass);
4443  //if(fFullAnalysis){
4444  //Double_t pointRot[5]={mass,massRot-mass,ptOrig,pt-ptOrig,angleProngXY};
4445  //fillthis="hDeltaMassFullAnalysis"+appendthis;
4447  //((THnSparse*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pointRot);
4448  //}
4449  nRotated++;
4450  //}
4451  }
4452 
4453  // fill additional histos for track-rotated candidates
4454  fillthis="histptK0S"+appendthis;
4455  //cout << fillthis << endl;
4456  cuts->SetExcludedCut(15);
4458  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[1]*px[1]+py[1]*py[1]));
4459  }
4460 
4461  fillthis="histptP"+appendthis;
4462  //cout << fillthis << endl;
4463  cuts->SetExcludedCut(4);
4465  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[0]*px[0]+py[0]*py[0]));
4466  }
4467 
4468  fillthis="histptPip"+appendthis;
4469  //cout << fillthis << endl;
4470  cuts->SetExcludedCut(5);
4472  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0PositiveTrack())->Pt());
4473  }
4474 
4475  fillthis="histptPim"+appendthis;
4476  //cout << fillthis << endl;
4477  cuts->SetExcludedCut(6);
4479  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0NegativeTrack())->Pt());
4480  }
4481 
4482  fillthis="histLambdaMass"+appendthis;
4483  //cout << fillthis << endl;
4484  cuts->SetExcludedCut(13);
4486  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassLambda());
4487  }
4488 
4489  fillthis="histLambdaBarMass"+appendthis;
4490  //cout << fillthis << endl;
4491  cuts->SetExcludedCut(13);
4493  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassAntiLambda());
4494  }
4495 
4496  fillthis="histGammaMass"+appendthis;
4497  //cout << fillthis << endl;
4498  cuts->SetExcludedCut(14);
4500  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->InvMass2Prongs(0,1,11,11));
4501  }
4502 
4503  fillthis="histCosPAK0S"+appendthis;
4504  //cout << fillthis << endl;
4505  cuts->SetExcludedCut(9);
4507  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->CosV0PointingAngle());
4508  }
4509 
4510  fillthis="histCosThetaProtonCMS"+appendthis;
4511  //cout << fillthis << endl;
4512  cuts->SetExcludedCut(16);
4514  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,cuts->GetProtonEmissionAngleCMS(partCopy));
4515  }
4516 
4517  fillthis="histResignedD0"+appendthis;
4518  //cout << fillthis << endl;
4519  cuts->SetExcludedCut(18);
4521  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(pt,cuts->GetReSignedd0(partCopy));
4522  }
4523  cuts->SetExcludedCut(-1);
4524 
4525  } // isInFiducialAcceptance
4526 
4527  px[0]=tmpx;
4528  py[0]=tmpy;
4529  }
4530  fillthis="hNormRotated"+appendthis;
4531  //cout << fillthis << endl;
4532  ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(nRotated);
4533 
4534  delete partCopy;
4535 
4536  return;
4537 
4538 }
4539 
4540 //----------------------------------------------------
4542 {
4543  //
4544  // Define analysis histograms for SNG separated for origin (from c, from b and from no-quark)
4545  //
4546 
4547  if (!fUseMCInfo) return;
4548  if (!fCheckOrigin) return;
4549 
4550  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
4551  Double_t mK0SPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
4552  Double_t mMinLambdaPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass()+
4553  TDatabasePDG::Instance()->GetParticle(211)->Mass();
4554 
4555  TString nameHistoSgnC=" ", nameHistoSgnB=" ", nameHistoSgnNoQ=" ";
4556  TString titleHistoSgnC=" ", titleHistoSgnB=" ", titleHistoSgnNoQ=" ";
4557 
4558  // pt(Lc)
4559  Double_t *binLimpTLc=new Double_t[11+1]; // 11 pT(Lc) bins
4560  binLimpTLc[ 0]= 0.;
4561  binLimpTLc[ 1]= 1.;
4562  binLimpTLc[ 2]= 2.;
4563  binLimpTLc[ 3]= 3.;
4564  binLimpTLc[ 4]= 4.;
4565  binLimpTLc[ 5]= 5.;
4566  binLimpTLc[ 6]= 6.;
4567  binLimpTLc[ 7]= 8.;
4568  binLimpTLc[ 8]=12.;
4569  binLimpTLc[ 9]=17.;
4570  binLimpTLc[10]=25.;
4571  binLimpTLc[11]=35.;
4572 
4573  // pt(prong)
4574  Double_t *binLimpTprong=new Double_t[41+1]; // 41 pT(prong) bins
4575  binLimpTprong[ 0]= 0.0;
4576  binLimpTprong[ 1]= 0.1;
4577  binLimpTprong[ 2]= 0.2;
4578  binLimpTprong[ 3]= 0.3;
4579  binLimpTprong[ 4]= 0.4;
4580  binLimpTprong[ 5]= 0.5;
4581  binLimpTprong[ 6]= 0.6;
4582  binLimpTprong[ 7]= 0.7;
4583  binLimpTprong[ 8]= 0.8;
4584  binLimpTprong[ 9]= 0.9;
4585  binLimpTprong[10]= 1.0;
4586  binLimpTprong[11]= 1.2;
4587  binLimpTprong[12]= 1.4;
4588  binLimpTprong[13]= 1.6;
4589  binLimpTprong[14]= 1.8;
4590  binLimpTprong[15]= 2.0;
4591  binLimpTprong[16]= 2.2;
4592  binLimpTprong[17]= 2.4;
4593  binLimpTprong[18]= 2.6;
4594  binLimpTprong[19]= 2.8;
4595  binLimpTprong[20]= 3.0;
4596  binLimpTprong[21]= 3.5;
4597  binLimpTprong[22]= 4.0;
4598  binLimpTprong[23]= 4.5;
4599  binLimpTprong[24]= 5.0;
4600  binLimpTprong[25]= 5.5;
4601  binLimpTprong[26]= 6.0;
4602  binLimpTprong[27]= 6.5;
4603  binLimpTprong[28]= 7.0;
4604  binLimpTprong[29]= 7.5;
4605  binLimpTprong[30]= 8.0;
4606  binLimpTprong[31]= 9.0;
4607  binLimpTprong[32]=10.0;
4608  binLimpTprong[33]=11.0;
4609  binLimpTprong[34]=12.0;
4610  binLimpTprong[35]=13.0;
4611  binLimpTprong[36]=14.0;
4612  binLimpTprong[37]=15.0;
4613  binLimpTprong[38]=20.0;
4614  binLimpTprong[39]=25.0;
4615  binLimpTprong[40]=30.0;
4616  binLimpTprong[41]=35.0;
4617 
4618  if (fUseOnTheFlyV0) {
4619 
4620  nameHistoSgnC="histLcMassByK0SSgnC";
4621  nameHistoSgnB="histLcMassByK0SSgnB";
4622  nameHistoSgnNoQ="histLcMassByK0SSgnNoQ";
4623  titleHistoSgnC="#Lambda_{c} #leftarrow 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]";
4624  titleHistoSgnB="#Lambda_{c} #leftarrow b - 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]";
4625  titleHistoSgnNoQ="#Lambda_{c} #leftarrow no quark - 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]";
4626  TH2F* spectrumLcMassByK0SSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4627  TH2F* spectrumLcMassByK0SSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4628  TH2F* spectrumLcMassByK0SSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4629 
4630  TH2F* allspectrumLcMassByK0SSgnC = (TH2F*)spectrumLcMassByK0SSgnC->Clone();
4631  TH2F* allspectrumLcMassByK0SSgnB = (TH2F*) spectrumLcMassByK0SSgnB->Clone();
4632  TH2F* allspectrumLcMassByK0SSgnNoQ = (TH2F*) spectrumLcMassByK0SSgnNoQ->Clone();
4633  TH2F* pidBachspectrumLcMassByK0SSgnC = (TH2F*)spectrumLcMassByK0SSgnC->Clone();
4634  TH2F* pidBachspectrumLcMassByK0SSgnB = (TH2F*) spectrumLcMassByK0SSgnB->Clone();
4635  TH2F* pidBachspectrumLcMassByK0SSgnNoQ = (TH2F*) spectrumLcMassByK0SSgnNoQ->Clone();
4636 
4637  fOutputAll->Add(allspectrumLcMassByK0SSgnC);
4638  fOutputAll->Add(allspectrumLcMassByK0SSgnB);
4639  fOutputAll->Add(allspectrumLcMassByK0SSgnNoQ);
4640  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgnC);
4641  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgnB);
4642  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgnNoQ);
4643 
4644  nameHistoSgnC="histptK0SSgnC";
4645  nameHistoSgnB="histptK0SSgnB";
4646  nameHistoSgnNoQ="histptK0SSgnNoQ";
4647  titleHistoSgnC="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4648  titleHistoSgnB="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4649  titleHistoSgnNoQ="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4650  TH2F* ptK0SSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4651  TH2F* ptK0SSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4652  TH2F* ptK0SSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,41,binLimpTprong);
4653 
4654  nameHistoSgnC="histptPSgnC";
4655  nameHistoSgnB="histptPSgnB";
4656  nameHistoSgnNoQ="histptPSgnNoQ";
4657  titleHistoSgnC="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4658  titleHistoSgnB="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4659  titleHistoSgnNoQ="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4660  TH2F* ptPSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4661  TH2F* ptPSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4662  TH2F* ptPSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,41,binLimpTprong);
4663 
4664  nameHistoSgnC="histptPipSgnC";
4665  nameHistoSgnB="histptPipSgnB";
4666  nameHistoSgnNoQ="histptPipSgnNoQ";
4667  titleHistoSgnC="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4668  titleHistoSgnB="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4669  titleHistoSgnNoQ="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4670  TH2F* ptPiPSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4671  TH2F* ptPiPSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4672  TH2F* ptPiPSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4673 
4674  nameHistoSgnC="histptPimSgnC";
4675  nameHistoSgnB="histptPimSgnB";
4676  nameHistoSgnNoQ="histptPimSgnNoQ";
4677  titleHistoSgnC="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4678  titleHistoSgnB="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4679  titleHistoSgnNoQ="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4680  TH2F* ptPiMSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4681  TH2F* ptPiMSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4682  TH2F* ptPiMSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4683 
4684  nameHistoSgnC="histD0K0SSgnC";
4685  nameHistoSgnB="histD0K0SSgnB";
4686  nameHistoSgnNoQ="histD0K0SSgnNoQ";
4687  titleHistoSgnC="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4688  titleHistoSgnB="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4689  titleHistoSgnNoQ="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4690  TH2F* d0K0SSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,1000,-1.,1.);
4691  TH2F* d0K0SSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,1000,-1.,1.);
4692  TH2F* d0K0SSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,1000,-1.,1.);
4693 
4694  nameHistoSgnC="histD0PSgnC";
4695  nameHistoSgnB="histD0PSgnB";
4696  nameHistoSgnNoQ="histD0PSgnNoQ";
4697  titleHistoSgnC="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4698  titleHistoSgnB="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4699  titleHistoSgnNoQ="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4700  TH2F* d0PSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,1000,-1.,1.);
4701  TH2F* d0PSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,1000,-1.,1.);
4702  TH2F* d0PSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,1000,-1.,1.);
4703 
4704  nameHistoSgnC="histCosPAK0SSgnC";
4705  nameHistoSgnB="histCosPAK0SSgnB";
4706  nameHistoSgnNoQ="histCosPAK0SSgnNoQ";
4707  titleHistoSgnC="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4708  titleHistoSgnB="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4709  titleHistoSgnNoQ="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4710  TH2F *cosPAK0SSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,0.99,1.);
4711  TH2F *cosPAK0SSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,0.99,1.);
4712  TH2F *cosPAK0SSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,0.99,1.);
4713 
4714  nameHistoSgnC="histCosThetaProtonCMSSgnC";
4715  nameHistoSgnB="histCosThetaProtonCMSSgnB";
4716  nameHistoSgnNoQ="histCosThetaProtonCMSSgnNoQ";
4717  titleHistoSgnC="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4718  titleHistoSgnB="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4719  titleHistoSgnNoQ="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4720  TH2F *cosThePrSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,-1.,1.);
4721  TH2F *cosThePrSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,-1.,1.);
4722  TH2F *cosThePrSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,-1.,1.);
4723 
4724  nameHistoSgnC="histResignedD0SgnC";
4725  nameHistoSgnB="histResignedD0SgnB";
4726  nameHistoSgnNoQ="histResignedD0SgnNoQ";
4727  titleHistoSgnC="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4728  titleHistoSgnB="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4729  titleHistoSgnNoQ="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4730  TH2F *resignedD0SgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,-0.1,0.1);
4731  TH2F *resignedD0SgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,-0.1,0.1);
4732  TH2F *resignedD0SgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,-0.1,0.1);
4733 
4734  TH2F* allptK0SSgnC = (TH2F*)ptK0SSgnC->Clone();
4735  TH2F* allptK0SSgnB = (TH2F*)ptK0SSgnB->Clone();
4736  TH2F* allptK0SSgnNoQ = (TH2F*)ptK0SSgnNoQ->Clone();
4737  TH2F* allptPSgnC = (TH2F*)ptPSgnC->Clone();
4738  TH2F* allptPSgnB = (TH2F*)ptPSgnB->Clone();
4739  TH2F* allptPSgnNoQ = (TH2F*)ptPSgnNoQ->Clone();
4740  TH2F* allptPiPSgnC = (TH2F*)ptPiPSgnC->Clone();
4741  TH2F* allptPiPSgnB = (TH2F*)ptPiPSgnB->Clone();
4742  TH2F* allptPiPSgnNoQ = (TH2F*)ptPiPSgnNoQ->Clone();
4743  TH2F* allptPiMSgnC = (TH2F*)ptPiMSgnC->Clone();
4744  TH2F* allptPiMSgnB = (TH2F*)ptPiMSgnB->Clone();
4745  TH2F* allptPiMSgnNoQ = (TH2F*)ptPiMSgnNoQ->Clone();
4746  TH2F* alld0K0SSgnC = (TH2F*)d0K0SSgnC->Clone();
4747  TH2F* alld0K0SSgnB = (TH2F*)d0K0SSgnB->Clone();
4748  TH2F* alld0K0SSgnNoQ = (TH2F*)d0K0SSgnNoQ->Clone();
4749  TH2F* alld0PSgnC = (TH2F*)d0PSgnC->Clone();
4750  TH2F* alld0PSgnB = (TH2F*)d0PSgnB->Clone();
4751  TH2F* alld0PSgnNoQ = (TH2F*)d0PSgnNoQ->Clone();
4752  TH2F* allcosPAK0SSgnC = (TH2F*)cosPAK0SSgnC->Clone();
4753  TH2F* allcosPAK0SSgnB = (TH2F*)cosPAK0SSgnB->Clone();
4754  TH2F* allcosPAK0SSgnNoQ = (TH2F*)cosPAK0SSgnNoQ->Clone();
4755  TH2F* allcosThePrSgnC = (TH2F*)cosThePrSgnC->Clone();
4756  TH2F* allcosThePrSgnB = (TH2F*)cosThePrSgnB->Clone();
4757  TH2F* allcosThePrSgnNoQ = (TH2F*)cosThePrSgnNoQ->Clone();
4758  TH2F* allresignedD0SgnC = (TH2F*)resignedD0SgnC->Clone();
4759  TH2F* allresignedD0SgnB = (TH2F*)resignedD0SgnB->Clone();
4760  TH2F* allresignedD0SgnNoQ = (TH2F*)resignedD0SgnNoQ->Clone();
4761 
4762  TH2F* pidptK0SSgnC = (TH2F*)ptK0SSgnC->Clone();
4763  TH2F* pidptK0SSgnB = (TH2F*)ptK0SSgnB->Clone();
4764  TH2F* pidptK0SSgnNoQ = (TH2F*)ptK0SSgnNoQ->Clone();
4765  TH2F* pidptPSgnC = (TH2F*)ptPSgnC->Clone();
4766  TH2F* pidptPSgnB = (TH2F*)ptPSgnB->Clone();
4767  TH2F* pidptPSgnNoQ = (TH2F*)ptPSgnNoQ->Clone();
4768  TH2F* pidptPiPSgnC = (TH2F*)ptPiPSgnC->Clone();
4769  TH2F* pidptPiPSgnB = (TH2F*)ptPiPSgnB->Clone();
4770  TH2F* pidptPiPSgnNoQ = (TH2F*)ptPiPSgnNoQ->Clone();
4771  TH2F* pidptPiMSgnC = (TH2F*)ptPiMSgnC->Clone();
4772  TH2F* pidptPiMSgnB = (TH2F*)ptPiMSgnB->Clone();
4773  TH2F* pidptPiMSgnNoQ = (TH2F*)ptPiMSgnNoQ->Clone();
4774  TH2F* pidd0K0SSgnC = (TH2F*)d0K0SSgnC->Clone();
4775  TH2F* pidd0K0SSgnB = (TH2F*)d0K0SSgnB->Clone();
4776  TH2F* pidd0K0SSgnNoQ = (TH2F*)d0K0SSgnNoQ->Clone();
4777  TH2F* pidd0PSgnC = (TH2F*)d0PSgnC->Clone();
4778  TH2F* pidd0PSgnB = (TH2F*)d0PSgnB->Clone();
4779  TH2F* pidd0PSgnNoQ = (TH2F*)d0PSgnNoQ->Clone();
4780  TH2F* pidcosPAK0SSgnC = (TH2F*)cosPAK0SSgnC->Clone();
4781  TH2F* pidcosPAK0SSgnB = (TH2F*)cosPAK0SSgnB->Clone();
4782  TH2F* pidcosPAK0SSgnNoQ = (TH2F*)cosPAK0SSgnNoQ->Clone();
4783  TH2F* pidcosThePrSgnC = (TH2F*)cosThePrSgnC->Clone();
4784  TH2F* pidcosThePrSgnB = (TH2F*)cosThePrSgnB->Clone();
4785  TH2F* pidcosThePrSgnNoQ = (TH2F*)cosThePrSgnNoQ->Clone();
4786  TH2F* pidresignedD0SgnC = (TH2F*)resignedD0SgnC->Clone();
4787  TH2F* pidresignedD0SgnB = (TH2F*)resignedD0SgnB->Clone();
4788  TH2F* pidresignedD0SgnNoQ = (TH2F*)resignedD0SgnNoQ->Clone();
4789 
4790  fOutputAll->Add(allptK0SSgnC);
4791  fOutputAll->Add(allptK0SSgnB);
4792  fOutputAll->Add(allptK0SSgnNoQ);
4793  fOutputAll->Add(allptPSgnC);
4794  fOutputAll->Add(allptPSgnB);
4795  fOutputAll->Add(allptPSgnNoQ);
4796  fOutputAll->Add(allptPiPSgnC);
4797  fOutputAll->Add(allptPiPSgnB);
4798  fOutputAll->Add(allptPiPSgnNoQ);
4799  fOutputAll->Add(allptPiMSgnC);
4800  fOutputAll->Add(allptPiMSgnB);
4801  fOutputAll->Add(allptPiMSgnNoQ);
4802  fOutputAll->Add(alld0K0SSgnC);
4803  fOutputAll->Add(alld0K0SSgnB);
4804  fOutputAll->Add(alld0K0SSgnNoQ);
4805  fOutputAll->Add(alld0PSgnC);
4806  fOutputAll->Add(alld0PSgnB);
4807  fOutputAll->Add(alld0PSgnNoQ);
4808  fOutputAll->Add(allcosPAK0SSgnC);
4809  fOutputAll->Add(allcosPAK0SSgnB);
4810  fOutputAll->Add(allcosPAK0SSgnNoQ);
4811  fOutputAll->Add(allcosThePrSgnC);
4812  fOutputAll->Add(allcosThePrSgnB);
4813  fOutputAll->Add(allcosThePrSgnNoQ);
4814  fOutputAll->Add(allresignedD0SgnC);
4815  fOutputAll->Add(allresignedD0SgnB);
4816  fOutputAll->Add(allresignedD0SgnNoQ);
4817 
4818  fOutputPIDBach->Add(pidptK0SSgnC);
4819  fOutputPIDBach->Add(pidptK0SSgnB);
4820  fOutputPIDBach->Add(pidptK0SSgnNoQ);
4821  fOutputPIDBach->Add(pidptPSgnC);
4822  fOutputPIDBach->Add(pidptPSgnB);
4823  fOutputPIDBach->Add(pidptPSgnNoQ);
4824  fOutputPIDBach->Add(pidptPiPSgnC);
4825  fOutputPIDBach->Add(pidptPiPSgnB);
4826  fOutputPIDBach->Add(pidptPiPSgnNoQ);
4827  fOutputPIDBach->Add(pidptPiMSgnC);
4828  fOutputPIDBach->Add(pidptPiMSgnB);
4829  fOutputPIDBach->Add(pidptPiMSgnNoQ);
4830  fOutputPIDBach->Add(pidd0K0SSgnC);
4831  fOutputPIDBach->Add(pidd0K0SSgnB);
4832  fOutputPIDBach->Add(pidd0K0SSgnNoQ);
4833  fOutputPIDBach->Add(pidd0PSgnC);
4834  fOutputPIDBach->Add(pidd0PSgnB);
4835  fOutputPIDBach->Add(pidd0PSgnNoQ);
4836  fOutputPIDBach->Add(pidcosPAK0SSgnC);
4837  fOutputPIDBach->Add(pidcosPAK0SSgnB);
4838  fOutputPIDBach->Add(pidcosPAK0SSgnNoQ);
4839  fOutputPIDBach->Add(pidcosThePrSgnC);
4840  fOutputPIDBach->Add(pidcosThePrSgnB);
4841  fOutputPIDBach->Add(pidcosThePrSgnNoQ);
4842  fOutputPIDBach->Add(pidresignedD0SgnC);
4843  fOutputPIDBach->Add(pidresignedD0SgnB);
4844  fOutputPIDBach->Add(pidresignedD0SgnNoQ);
4845 
4846  }
4847 
4848  nameHistoSgnC="histLcMassByK0SOfflineSgnC";
4849  nameHistoSgnB="histLcMassByK0SOfflineSgnB";
4850  nameHistoSgnNoQ="histLcMassByK0SOfflineSgnNoQ";
4851  titleHistoSgnC="#Lambda_{c} #leftarrow 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]";
4852  titleHistoSgnB="#Lambda_{c} #leftarrow b - 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]";
4853  titleHistoSgnNoQ="#Lambda_{c} #leftarrow no quark - 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]";
4854  TH2F* spectrumLcMassOfflineByK0SSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4855  TH2F* spectrumLcMassOfflineByK0SSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4856  TH2F* spectrumLcMassOfflineByK0SSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
4857 
4858  TH2F* allspectrumLcMassOfflineByK0SSgnC = (TH2F*)spectrumLcMassOfflineByK0SSgnC->Clone();
4859  TH2F* allspectrumLcMassOfflineByK0SSgnB = (TH2F*) spectrumLcMassOfflineByK0SSgnB->Clone();
4860  TH2F* allspectrumLcMassOfflineByK0SSgnNoQ = (TH2F*) spectrumLcMassOfflineByK0SSgnNoQ->Clone();
4861  TH2F* pidBachspectrumLcMassOfflineByK0SSgnC = (TH2F*)spectrumLcMassOfflineByK0SSgnC->Clone();
4862  TH2F* pidBachspectrumLcMassOfflineByK0SSgnB = (TH2F*) spectrumLcMassOfflineByK0SSgnB->Clone();
4863  TH2F* pidBachspectrumLcMassOfflineByK0SSgnNoQ = (TH2F*) spectrumLcMassOfflineByK0SSgnNoQ->Clone();
4864  fOutputAll->Add(allspectrumLcMassOfflineByK0SSgnC);
4865  fOutputAll->Add(allspectrumLcMassOfflineByK0SSgnB);
4866  fOutputAll->Add(allspectrumLcMassOfflineByK0SSgnNoQ);
4867  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgnC);
4868  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgnB);
4869  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgnNoQ);
4870 
4871  nameHistoSgnC="histptK0SOfflineSgnC";
4872  nameHistoSgnB="histptK0SOfflineSgnB";
4873  nameHistoSgnNoQ="histptK0SOfflineSgnNoQ";
4874  titleHistoSgnC="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4875  titleHistoSgnB="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4876  titleHistoSgnNoQ="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
4877  TH2F* ptK0SOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4878  TH2F* ptK0SOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4879  TH2F* ptK0SOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,41,binLimpTprong);
4880 
4881  nameHistoSgnC="histptPOfflineSgnC";
4882  nameHistoSgnB="histptPOfflineSgnB";
4883  nameHistoSgnNoQ="histptPOfflineSgnNoQ";
4884  titleHistoSgnC="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4885  titleHistoSgnB="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4886  titleHistoSgnNoQ="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
4887  TH2F* ptPOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4888  TH2F* ptPOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4889  TH2F* ptPOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,41,binLimpTprong);
4890 
4891  nameHistoSgnC="histptPipOfflineSgnC";
4892  nameHistoSgnB="histptPipOfflineSgnB";
4893  nameHistoSgnNoQ="histptPipOfflineSgnNoQ";
4894  titleHistoSgnC="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4895  titleHistoSgnB="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4896  titleHistoSgnNoQ="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
4897  TH2F* ptPiPOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4898  TH2F* ptPiPOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4899  TH2F* ptPiPOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4900 
4901  nameHistoSgnC="histptPimOfflineSgnC";
4902  nameHistoSgnB="histptPimOfflineSgnB";
4903  nameHistoSgnNoQ="histptPimOfflineSgnNoQ";
4904  titleHistoSgnC="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4905  titleHistoSgnB="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4906  titleHistoSgnNoQ="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
4907  TH2F* ptPiMOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,41,binLimpTprong);
4908  TH2F* ptPiMOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4909  TH2F* ptPiMOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnB.Data(),11,binLimpTLc,41,binLimpTprong);
4910 
4911  nameHistoSgnC="histD0K0SOfflineSgnC";
4912  nameHistoSgnB="histD0K0SOfflineSgnB";
4913  nameHistoSgnNoQ="histD0K0SOfflineSgnNoQ";
4914  titleHistoSgnC="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4915  titleHistoSgnB="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4916  titleHistoSgnNoQ="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
4917  TH2F* d0K0SOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,1000,-1.,1.);
4918  TH2F* d0K0SOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,1000,-1.,1.);
4919  TH2F* d0K0SOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,1000,-1.,1.);
4920 
4921  nameHistoSgnC="histD0POfflineSgnC";
4922  nameHistoSgnB="histD0POfflineSgnB";
4923  nameHistoSgnNoQ="histD0POfflineSgnNoQ";
4924  titleHistoSgnC="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4925  titleHistoSgnB="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4926  titleHistoSgnNoQ="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
4927  TH2F* d0POfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),11,binLimpTLc,1000,-1.,1.);
4928  TH2F* d0POfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),11,binLimpTLc,1000,-1.,1.);
4929  TH2F* d0POfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),11,binLimpTLc,1000,-1.,1.);
4930 
4931  nameHistoSgnC="histCosPAK0SOfflineSgnC";
4932  nameHistoSgnB="histCosPAK0SOfflineSgnB";
4933  nameHistoSgnNoQ="histCosPAK0SOfflineSgnNoQ";
4934  titleHistoSgnC="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4935  titleHistoSgnB="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4936  titleHistoSgnNoQ="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4937  TH2F *cosPAK0SOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,0.99,1.);
4938  TH2F *cosPAK0SOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,0.99,1.);
4939  TH2F *cosPAK0SOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,0.99,1.);
4940 
4941  nameHistoSgnC="histCosThetaProtonCMSOfflineSgnC";
4942  nameHistoSgnB="histCosThetaProtonCMSOfflineSgnB";
4943  nameHistoSgnNoQ="histCosThetaProtonCMSOfflineSgnNoQ";
4944  titleHistoSgnC="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4945  titleHistoSgnB="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4946  titleHistoSgnNoQ="cosien of proton emission angle in Lc rest frame; p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
4947  TH2F *cosThePrOfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,-1.,1.);
4948  TH2F *cosThePrOfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,-1.,1.);
4949  TH2F *cosThePrOfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,-1.,1.);
4950 
4951  nameHistoSgnC="histResignedD0OfflineSgnC";
4952  nameHistoSgnB="histResignedD0OfflineSgnB";
4953  nameHistoSgnNoQ="histResignedD0OfflineSgnNoQ";
4954  titleHistoSgnC="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4955  titleHistoSgnB="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4956  titleHistoSgnNoQ="Proton d0 with different sign convention; p_{T}(#Lambda_{c}) [GeV/c]; d0 [cm]; Entries";
4957  TH2F *resignedD0OfflineSgnC = new TH2F(nameHistoSgnC.Data(),titleHistoSgnC.Data(),41,binLimpTprong,100,-0.1,0.1);
4958  TH2F *resignedD0OfflineSgnB = new TH2F(nameHistoSgnB.Data(),titleHistoSgnB.Data(),41,binLimpTprong,100,-0.1,0.1);
4959  TH2F *resignedD0OfflineSgnNoQ = new TH2F(nameHistoSgnNoQ.Data(),titleHistoSgnNoQ.Data(),41,binLimpTprong,100,-0.1,0.1);
4960 
4961  TH2F* allptK0SOfflineSgnC = (TH2F*)ptK0SOfflineSgnC->Clone();
4962  TH2F* allptK0SOfflineSgnB = (TH2F*)ptK0SOfflineSgnB->Clone();
4963  TH2F* allptK0SOfflineSgnNoQ = (TH2F*)ptK0SOfflineSgnNoQ->Clone();
4964  TH2F* allptPOfflineSgnC = (TH2F*)ptPOfflineSgnC->Clone();
4965  TH2F* allptPOfflineSgnB = (TH2F*)ptPOfflineSgnB->Clone();
4966  TH2F* allptPOfflineSgnNoQ = (TH2F*)ptPOfflineSgnNoQ->Clone();
4967  TH2F* allptPiPOfflineSgnC = (TH2F*)ptPiPOfflineSgnC->Clone();
4968  TH2F* allptPiPOfflineSgnB = (TH2F*)ptPiPOfflineSgnB->Clone();
4969  TH2F* allptPiPOfflineSgnNoQ = (TH2F*)ptPiPOfflineSgnNoQ->Clone();
4970  TH2F* allptPiMOfflineSgnC = (TH2F*)ptPiMOfflineSgnC->Clone();
4971  TH2F* allptPiMOfflineSgnB = (TH2F*)ptPiMOfflineSgnB->Clone();
4972  TH2F* allptPiMOfflineSgnNoQ = (TH2F*)ptPiMOfflineSgnNoQ->Clone();
4973  TH2F* alld0K0SOfflineSgnC = (TH2F*)d0K0SOfflineSgnC->Clone();
4974  TH2F* alld0K0SOfflineSgnB = (TH2F*)d0K0SOfflineSgnB->Clone();
4975  TH2F* alld0K0SOfflineSgnNoQ = (TH2F*)d0K0SOfflineSgnNoQ->Clone();
4976  TH2F* alld0POfflineSgnC = (TH2F*)d0POfflineSgnC->Clone();
4977  TH2F* alld0POfflineSgnB = (TH2F*)d0POfflineSgnB->Clone();
4978  TH2F* alld0POfflineSgnNoQ = (TH2F*)d0POfflineSgnNoQ->Clone();
4979  TH2F* allcosPAK0SOfflineSgnC = (TH2F*)cosPAK0SOfflineSgnC->Clone();
4980  TH2F* allcosPAK0SOfflineSgnB = (TH2F*)cosPAK0SOfflineSgnB->Clone();
4981  TH2F* allcosPAK0SOfflineSgnNoQ = (TH2F*)cosPAK0SOfflineSgnNoQ->Clone();
4982  TH2F* allcosThePrOfflineSgnC = (TH2F*)cosThePrOfflineSgnC->Clone();
4983  TH2F* allcosThePrOfflineSgnB = (TH2F*)cosThePrOfflineSgnB->Clone();
4984  TH2F* allcosThePrOfflineSgnNoQ = (TH2F*)cosThePrOfflineSgnNoQ->Clone();
4985  TH2F* allresignedD0OfflineSgnC = (TH2F*)resignedD0OfflineSgnC->Clone();
4986  TH2F* allresignedD0OfflineSgnB = (TH2F*)resignedD0OfflineSgnB->Clone();
4987  TH2F* allresignedD0OfflineSgnNoQ = (TH2F*)resignedD0OfflineSgnNoQ->Clone();
4988 
4989  TH2F* pidptK0SOfflineSgnC = (TH2F*)ptK0SOfflineSgnC->Clone();
4990  TH2F* pidptK0SOfflineSgnB = (TH2F*)ptK0SOfflineSgnB->Clone();
4991  TH2F* pidptK0SOfflineSgnNoQ = (TH2F*)ptK0SOfflineSgnNoQ->Clone();
4992  TH2F* pidptPOfflineSgnC = (TH2F*)ptPOfflineSgnC->Clone();
4993  TH2F* pidptPOfflineSgnB = (TH2F*)ptPOfflineSgnB->Clone();
4994  TH2F* pidptPOfflineSgnNoQ = (TH2F*)ptPOfflineSgnNoQ->Clone();
4995  TH2F* pidptPiPOfflineSgnC = (TH2F*)ptPiPOfflineSgnC->Clone();
4996  TH2F* pidptPiPOfflineSgnB = (TH2F*)ptPiPOfflineSgnB->Clone();
4997  TH2F* pidptPiPOfflineSgnNoQ = (TH2F*)ptPiPOfflineSgnNoQ->Clone();
4998  TH2F* pidptPiMOfflineSgnC = (TH2F*)ptPiMOfflineSgnC->Clone();
4999  TH2F* pidptPiMOfflineSgnB = (TH2F*)ptPiMOfflineSgnB->Clone();
5000  TH2F* pidptPiMOfflineSgnNoQ = (TH2F*)ptPiMOfflineSgnNoQ->Clone();
5001  TH2F* pidd0K0SOfflineSgnC = (TH2F*)d0K0SOfflineSgnC->Clone();
5002  TH2F* pidd0K0SOfflineSgnB = (TH2F*)d0K0SOfflineSgnB->Clone();
5003  TH2F* pidd0K0SOfflineSgnNoQ = (TH2F*)d0K0SOfflineSgnNoQ->Clone();
5004  TH2F* pidd0POfflineSgnC = (TH2F*)d0POfflineSgnC->Clone();
5005  TH2F* pidd0POfflineSgnB = (TH2F*)d0POfflineSgnB->Clone();
5006  TH2F* pidd0POfflineSgnNoQ = (TH2F*)d0POfflineSgnNoQ->Clone();
5007  TH2F* pidcosPAK0SOfflineSgnC = (TH2F*)cosPAK0SOfflineSgnC->Clone();
5008  TH2F* pidcosPAK0SOfflineSgnB = (TH2F*)cosPAK0SOfflineSgnB->Clone();
5009  TH2F* pidcosPAK0SOfflineSgnNoQ = (TH2F*)cosPAK0SOfflineSgnNoQ->Clone();
5010  TH2F* pidcosThePrOfflineSgnC = (TH2F*)cosThePrOfflineSgnC->Clone();
5011  TH2F* pidcosThePrOfflineSgnB = (TH2F*)cosThePrOfflineSgnB->Clone();
5012  TH2F* pidcosThePrOfflineSgnNoQ = (TH2F*)cosThePrOfflineSgnNoQ->Clone();
5013  TH2F* pidresignedD0OfflineSgnC = (TH2F*)resignedD0OfflineSgnC->Clone();
5014  TH2F* pidresignedD0OfflineSgnB = (TH2F*)resignedD0OfflineSgnB->Clone();
5015  TH2F* pidresignedD0OfflineSgnNoQ = (TH2F*)resignedD0OfflineSgnNoQ->Clone();
5016 
5017  fOutputAll->Add(allptK0SOfflineSgnC);
5018  fOutputAll->Add(allptK0SOfflineSgnB);
5019  fOutputAll->Add(allptK0SOfflineSgnNoQ);
5020  fOutputAll->Add(allptPOfflineSgnC);
5021  fOutputAll->Add(allptPOfflineSgnB);
5022  fOutputAll->Add(allptPOfflineSgnNoQ);
5023  fOutputAll->Add(allptPiPOfflineSgnC);
5024  fOutputAll->Add(allptPiPOfflineSgnB);
5025  fOutputAll->Add(allptPiPOfflineSgnNoQ);
5026  fOutputAll->Add(allptPiMOfflineSgnC);
5027  fOutputAll->Add(allptPiMOfflineSgnB);
5028  fOutputAll->Add(allptPiMOfflineSgnNoQ);
5029  fOutputAll->Add(alld0K0SOfflineSgnC);
5030  fOutputAll->Add(alld0K0SOfflineSgnB);
5031  fOutputAll->Add(alld0K0SOfflineSgnNoQ);
5032  fOutputAll->Add(alld0POfflineSgnC);
5033  fOutputAll->Add(alld0POfflineSgnB);
5034  fOutputAll->Add(alld0POfflineSgnNoQ);
5035  fOutputAll->Add(allcosPAK0SOfflineSgnC);
5036  fOutputAll->Add(allcosPAK0SOfflineSgnB);
5037  fOutputAll->Add(allcosPAK0SOfflineSgnNoQ);
5038  fOutputAll->Add(allcosThePrOfflineSgnC);
5039  fOutputAll->Add(allcosThePrOfflineSgnB);
5040  fOutputAll->Add(allcosThePrOfflineSgnNoQ);
5041  fOutputAll->Add(allresignedD0OfflineSgnC);
5042  fOutputAll->Add(allresignedD0OfflineSgnB);
5043  fOutputAll->Add(allresignedD0OfflineSgnNoQ);
5044 
5045  fOutputPIDBach->Add(pidptK0SOfflineSgnC);
5046  fOutputPIDBach->Add(pidptK0SOfflineSgnB);
5047  fOutputPIDBach->Add(pidptK0SOfflineSgnNoQ);
5048  fOutputPIDBach->Add(pidptPOfflineSgnC);
5049  fOutputPIDBach->Add(pidptPOfflineSgnB);
5050  fOutputPIDBach->Add(pidptPOfflineSgnNoQ);
5051  fOutputPIDBach->Add(pidptPiPOfflineSgnC);
5052  fOutputPIDBach->Add(pidptPiPOfflineSgnB);
5053  fOutputPIDBach->Add(pidptPiPOfflineSgnNoQ);
5054  fOutputPIDBach->Add(pidptPiMOfflineSgnC);
5055  fOutputPIDBach->Add(pidptPiMOfflineSgnB);
5056  fOutputPIDBach->Add(pidptPiMOfflineSgnNoQ);
5057  fOutputPIDBach->Add(pidd0K0SOfflineSgnC);
5058  fOutputPIDBach->Add(pidd0K0SOfflineSgnB);
5059  fOutputPIDBach->Add(pidd0K0SOfflineSgnNoQ);
5060  fOutputPIDBach->Add(pidd0POfflineSgnC);
5061  fOutputPIDBach->Add(pidd0POfflineSgnB);
5062  fOutputPIDBach->Add(pidd0POfflineSgnNoQ);
5063  fOutputPIDBach->Add(pidcosPAK0SOfflineSgnC);
5064  fOutputPIDBach->Add(pidcosPAK0SOfflineSgnB);
5065  fOutputPIDBach->Add(pidcosPAK0SOfflineSgnNoQ);
5066  fOutputPIDBach->Add(pidcosThePrOfflineSgnC);
5067  fOutputPIDBach->Add(pidcosThePrOfflineSgnB);
5068  fOutputPIDBach->Add(pidcosThePrOfflineSgnNoQ);
5069  fOutputPIDBach->Add(pidresignedD0OfflineSgnC);
5070  fOutputPIDBach->Add(pidresignedD0OfflineSgnB);
5071  fOutputPIDBach->Add(pidresignedD0OfflineSgnNoQ);
5072 
5073 }
Double_t NormalizedDecayLengthXY() const
Double_t NormalizedDecayLength() const
void FillTheTree(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t isLc, Int_t originLc)
Bool_t fIsEventSelected
flag to activate protection against AOD-dAOD mismatch.
Float_t GetMinRatioSignalNOverCrossRowsTPC() const
Definition: AliRDHFCuts.h:280
double Double_t
Definition: External.C:58
Definition: External.C:260
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
Definition: External.C:236
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)
void FillLc2pK0Sspectrum(AliAODRecoCascadeHF *part, Int_t isLc, Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t originLc)
histos
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
const char * GetMinCrossedRowsTPCPtDep() const
Definition: AliRDHFCuts.h:278
AliAODv0 * Getv0() const
char Char_t
Definition: External.C:18
Double_t InvMassLctoLambdaPi() const
static Int_t CheckMatchingAODdeltaAODevents()
void MakeSingleAnalysisForSystK0SP(AliAODEvent *aodEvent, TClonesArray *mcArray, AliRDHFCutsLctoV0 *cutsAnal)
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:244
Double_t CosV0PointingAngleXY() const
Double_t MassLambda()
Definition: AliPicoBase.h:44
Double_t GetAlpha(Double_t xyz[3], Double_t pxpypz[3])