AliPhysics  0b37c46 (0b37c46)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
54 public:
56 
64 
72 
82  void Connect();
83 
93  void Release();
94 
101 
107  TObject *GetData() const { return fData; }
108 
109 private:
116 
120 };
121 
138 public:
145 
155 
164 
173 
184 
195 
203 
209  TObject *GetData() const { return fUserStorage ? fUserStorage->GetData() : nullptr; }
210 
211 private:
213 
215  ClassDef(AliEmcalTrackSelResultUserPtr, 1);
217 };
218 
250 public:
251 
260 
269  AliEmcalTrackSelResultPtr(AliVTrack *trk, Bool_t selectionStatus, TObject *userobject = nullptr);
270 
276 
277 #if !defined(__CINT__) && !defined(__MAKECINT__)
278 
283 #endif
284 
292 
293 #if !defined(__CINT__) && !defined (__MAKECINT__)
294 
301 #endif
302 
307 
314  Bool_t operator==(const AliEmcalTrackSelResultPtr &other) const;
315 
323  Bool_t operator<(const AliEmcalTrackSelResultPtr &other) const;
324 
331  virtual Bool_t IsEqual(const TObject *o) const;
332 
333  virtual Int_t Compare(const TObject *o) const;
334 
339  AliVTrack * operator*() const;
340 
346  AliVTrack * operator->() const;
347 
352  operator bool() const { return fSelectionResult; }
353 
354 
359  void PrintStream(std::ostream &stream) const;
360 
365  void SetTrack(AliVTrack *track) { fTrack = track; }
366 
371  void SetSelectionResult(Bool_t selectionResult) { fSelectionResult = selectionResult; }
372 
378 
383  AliVTrack *GetTrack() const { return fTrack; }
384 
389  const TObject *GetUserInfo() const { return fUserInfo.GetData(); }
390 
396 
397 protected:
398  AliVTrack *fTrack;
401 
403  ClassDef(AliEmcalTrackSelResultPtr, 1);
405 };
406 
414 std::ostream &operator<<(std::ostream &stream, const AliEmcalTrackSelResultPtr &ref);
415 
430 public:
435 
440 
453  bool RunAllTests() const;
454 
465  bool TestOperatorBool() const;
466 
475  bool TestCopyConstructor() const;
476 
485  bool TestOperatorAssign() const;
486 
497  bool TestUserInfo() const;
498 
499 protected:
500 
501  bool AssertBool(const AliEmcalTrackSelResultPtr &test, bool testvalue) const;
502 
503  bool AssertPayload(const AliEmcalTrackSelResultPtr &test, void *payload) const;
504 
506  ClassDef(TestAliEmcalTrackSelResultPtr, 1);
508 };
509 
510 }
511 
512 }
513 
514 #endif /* ALIEMCALTRACKSELRESULTPTR_H */
Bool_t fSelectionResult
Result of the track selection (true - selected, false - rejected)
Bool_t operator<(const AliEmcalTrackSelResultPtr &other) const
bool TestOperatorBool() const
Test for operator bool.
AliEmcalTrackSelResultPtr & operator=(const AliEmcalTrackSelResultPtr &ref)
AliEmcalTrackSelResultUserStorage * fUserStorage
Underlying user storage for reference counting.
bool TestCopyConstructor() const
Test copy constructor with user information.
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)
Helper class handling the lifetime of the user object handled by AliEmcalTrackSelResultUserPtr.
bool TestOperatorAssign() const
Tests assignment operatator with user info.
virtual Bool_t IsEqual(const TObject *o) const
virtual Int_t Compare(const TObject *o) const
int Int_t
Definition: External.C:63
Unit test for class AliEmcalTrackSelResultPtr.
TObject * GetData() const
Get the user data handled by the storage.
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.
bool TestUserInfo() const
Test handling of user storage.
std::ostream & operator<<(std::ostream &stream, const AliEmcalTrackSelResultPtr &ref)
Bool_t operator==(const AliEmcalTrackSelResultPtr &other) const
bool AssertBool(const AliEmcalTrackSelResultPtr &test, bool testvalue) const
AliEmcalTrackSelResultUserPtr fUserInfo
Selection flag (optional)
AliEmcalTrackSelResultUserStorage & operator=(const AliEmcalTrackSelResultUserStorage &)
void test(int runnumber=195345)
bool Bool_t
Definition: External.C:53
AliEmcalTrackSelResultUserPtr & operator=(const AliEmcalTrackSelResultUserPtr &ref)
Assignment operator.
bool AssertPayload(const AliEmcalTrackSelResultPtr &test, void *payload) const
Handler for user objects attached to the track selection result ptr.
AliVTrack * fTrack
Pointer to selected track.
void PrintStream(std::ostream &stream) const