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