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