| 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), _gapNumb(0) { |
| 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 Return live time counter of that events which hadn't calculated with general counter due to a time gap */ |
| 53 |
Float_t GetBadsumLiveTime(unsigned int actNumber); |
| 54 |
|
| 55 |
/*! @brief Applies cut like it is done in SmartCollection::AplyCut but also before apply OnGood method |
| 56 |
* it change live time of an event survived all cuts for live time which is the sum of live times |
| 57 |
* of all event having not survived all cuts before the action. |
| 58 |
*/ |
| 59 |
int ApplyCut(PamLevel2 *event); |
| 60 |
|
| 61 |
/*! @brief Write report file */ |
| 62 |
void Finalize(); |
| 63 |
|
| 64 |
private: |
| 65 |
|
| 66 |
std::vector<UInt_t> _sumLT; |
| 67 |
UInt_t _currenttime; |
| 68 |
TString _livetimereport; |
| 69 |
|
| 70 |
protected: |
| 71 |
|
| 72 |
std::vector<UInt_t> _sum; |
| 73 |
std::vector<UInt_t> _badsum; |
| 74 |
UInt_t _gapNumb; |
| 75 |
|
| 76 |
}; |
| 77 |
|
| 78 |
#endif /* LIVETIMECOLLECTION_H_ */ |