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