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