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