1 |
/* |
2 |
* LiveTimeCollection.h |
3 |
* |
4 |
* Created on: 30-marth-2010 |
5 |
* Author: Vitaly Malakhov |
6 |
*/ |
7 |
|
8 |
/*! @file LiveTimeCollection.h The LiveTimeCollection class definition file */ |
9 |
|
10 |
#ifndef LIVETIMECOLLECTION_H_ |
11 |
#define LIVETIMECOLLECTION_H_ |
12 |
|
13 |
#include "../SmartCollection/SmartCollection.h" |
14 |
/*! @brief A collection which calculate a sum of live time of all events not survived cuts before an action |
15 |
* and change live time of an event survived all cuts for the sum live time before apply OnGood method. |
16 |
* That mean that if an action deals with LiveTime then it will use not just live time of last survived events |
17 |
* but of all events having not survived all cuts before the action. For each action sum of live time is calculated |
18 |
* independently since it may be differ from each other. It is recomended to add LiveTime collection |
19 |
* as a cut to for example Smart collection object after adding LTQualCut(), DataQualCut("",TRG) and cuts selected |
20 |
* geographical regions. |
21 |
*/ |
22 |
class LiveTimeCollection: public SmartCollection { |
23 |
|
24 |
public: |
25 |
|
26 |
/*! @brief Constructor. |
27 |
* |
28 |
* @param collectionName The collection's name. |
29 |
* @param owns If true, the collection will own the cuts and the actions, ie., it will |
30 |
* destroy them in its destructor. |
31 |
* @param livetimereport File were report of Live Time analysis will be written |
32 |
*/ |
33 |
LiveTimeCollection(const char *collectionName, bool owns = true, TString livetimereport = "./livetimereport.txt") : |
34 |
SmartCollection(collectionName, owns), _currenttime(0), _livetimereport(livetimereport) { |
35 |
} |
36 |
|
37 |
/*! @brief Destructor. */ |
38 |
~LiveTimeCollection() { |
39 |
} |
40 |
|
41 |
/*! @brief Adds an action to the SmartCollection */ |
42 |
void AddAction(CollectionAction *action); |
43 |
|
44 |
/*! @brief This method increase live time counter if event haven't survive a cut. |
45 |
* |
46 |
*/ |
47 |
void OnBad(PamLevel2 *event, int actNumber, unsigned int inc); |
48 |
|
49 |
/*! @brief Return general live time counter for actNumber'th action */ |
50 |
Float_t GetSumLiveTime(unsigned int actNumber); |
51 |
|
52 |
/*! @brief Applies cut like it is done in SmartCollection::AplyCut but also before apply OnGood method |
53 |
* it change live time of an event survived all cuts for live time which is the sum of live times |
54 |
* of all event having not survived all cuts before the action. |
55 |
*/ |
56 |
int ApplyCut(PamLevel2 *event); |
57 |
|
58 |
/*! @brief Write report file */ |
59 |
void Finalize(); |
60 |
|
61 |
private: |
62 |
|
63 |
std::vector<UInt_t> _sumLT; |
64 |
UInt_t _currenttime; |
65 |
TString _livetimereport; |
66 |
|
67 |
protected: |
68 |
|
69 |
std::vector<UInt_t> _sum; |
70 |
|
71 |
}; |
72 |
|
73 |
#endif /* LIVETIMECOLLECTION_H_ */ |