AliPhysics  e46d415 (e46d415)
AliEmcalTrackSelResultPtr.h
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2017, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #ifndef ALIEMCALTRACKSELRESULTPTR_H
28 #define ALIEMCALTRACKSELRESULTPTR_H
29 
30 #include <TObject.h>
31 #include <iosfwd>
32 
33 class AliVTrack;
34 
35 namespace PWG {
36 
37 namespace EMCAL {
38 
55 public:
57 
65 
75  void Connect();
76 
86  void Release();
87 
94 
100  TObject *GetData() const { return fData; }
101 
102 protected:
103 
111 
112 private:
119 
123 };
124 
141 public:
148 
158 
167 
176 
187 
198 
206 
212  TObject *GetData() const { return fUserStorage ? fUserStorage->GetData() : nullptr; }
213 
214 private:
216 
218  ClassDef(AliEmcalTrackSelResultUserPtr, 1);
220 };
221 
253 public:
254 
263 
272  AliEmcalTrackSelResultPtr(AliVTrack *trk, Bool_t selectionStatus, TObject *userobject = nullptr);
273 
279 
280 #if !defined(__CINT__) && !defined(__MAKECINT__)
281 
286 #endif
287 
295 
296 #if !defined(__CINT__) && !defined (__MAKECINT__)
297 
304 #endif
305 
310 
317  Bool_t operator==(const AliEmcalTrackSelResultPtr &other) const;
318 
326  Bool_t operator<(const AliEmcalTrackSelResultPtr &other) const;
327 
334  virtual Bool_t IsEqual(const TObject *o) const;
335 
336  virtual Int_t Compare(const TObject *o) const;
337 
342  AliVTrack * operator*() const;
343 
349  AliVTrack * operator->() const;
350 
355  operator bool() const { return fSelectionResult; }
356 
357 
362  void PrintStream(std::ostream &stream) const;
363 
368  void SetTrack(AliVTrack *track) { fTrack = track; }
369 
374  void SetSelectionResult(Bool_t selectionResult) { fSelectionResult = selectionResult; }
375 
380  void SetUserInfo(TObject *userinfo) { fUserInfo = AliEmcalTrackSelResultUserPtr(userinfo); }
381 
386  AliVTrack *GetTrack() const { return fTrack; }
387 
392  const TObject *GetUserInfo() const { return fUserInfo.GetData(); }
393 
398  Bool_t GetSelectionResult() const { return fSelectionResult; }
399 
400 protected:
401  AliVTrack *fTrack;
404 
406  ClassDef(AliEmcalTrackSelResultPtr, 1);
408 };
409 
417 std::ostream &operator<<(std::ostream &stream, const AliEmcalTrackSelResultPtr &ref);
418 
433 public:
438 
443 
456  bool RunAllTests() const;
457 
468  bool TestOperatorBool() const;
469 
478  bool TestCopyConstructor() const;
479 
488  bool TestOperatorAssign() const;
489 
500  bool TestUserInfo() const;
501 
502 protected:
503 
504  bool AssertBool(const AliEmcalTrackSelResultPtr &test, bool testvalue) const;
505 
506  bool AssertPayload(const AliEmcalTrackSelResultPtr &test, void *payload) const;
507 
509  ClassDef(TestAliEmcalTrackSelResultPtr, 1);
511 };
512 
513 }
514 
515 }
516 
517 #endif /* ALIEMCALTRACKSELRESULTPTR_H */
Bool_t fSelectionResult
Result of the track selection (true - selected, false - rejected)
AliEmcalTrackSelResultUserStorage * fUserStorage
Underlying user storage for reference counting.
Structure containing the result of a given track selection step.
TObject * GetData() const
Get the object handled by the storage.
Int_t GetReferenceCount() const
Get the number of pointer instances connected to the storage.
void SetSelectionResult(Bool_t selectionResult)
Namespace for EMCAL framework classes and task.
Helper class handling the lifetime of the user object handled by AliEmcalTrackSelResultUserPtr.
int Int_t
Definition: External.C:63
Unit test for class AliEmcalTrackSelResultPtr.
TObject * GetData() const
Get the user data handled by the storage.
bool operator<(const AliAnalysisTaskDmesonJets::AliHFJetDefinition &lhs, const AliAnalysisTaskDmesonJets::AliHFJetDefinition &rhs)
TH1 * Compare(TH1 *def, TH1 *oth)
Definition: Compare.C:124
Namespace for PWG framework classes.
void Release()
Release user pointer from the storage.
void SetTrack(AliVTrack *track)
Set the track object handled by the track selection.
void Connect()
Connect new user pointer instance to the storage.
std::ostream & operator<<(std::ostream &stream, const AliEmcalTrackSelResultPtr &ref)
AliEmcalTrackSelResultUserPtr fUserInfo
Selection flag (optional)
AliEmcalTrackSelResultUserStorage & operator=(const AliEmcalTrackSelResultUserStorage &)
void test(int runnumber=195345)
bool operator==(const AliAnalysisTaskDmesonJets::AliHFJetDefinition &lhs, const AliAnalysisTaskDmesonJets::AliHFJetDefinition &rhs)
bool Bool_t
Definition: External.C:53
Handler for user objects attached to the track selection result ptr.
AliVTrack * fTrack
Pointer to selected track.