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