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