1 ////////////////////////////////////////////////////////////////////////////
3 // Event info for TRD performance train //
6 // Markus Fasel <M.Fasel@gsi.de> //
8 ////////////////////////////////////////////////////////////////////////////
13 #include "AliESDHeader.h"
14 #include "AliESDRun.h"
16 #include "AliTRDeventInfo.h"
18 ClassImp(AliTRDeventInfo)
19 Int_t const AliTRDeventInfo::fgkMultBin[AliTRDeventInfo::kCentralityClasses-1] = {
20 700, 1400, 2100, 2800/*, 3500*/
22 Float_t const AliTRDeventInfo::fgkCentBin[AliTRDeventInfo::kCentralityClasses-1] = {
23 0.1, 0.2, 0.5, 0.8/*, 1.*/
25 //____________________________________________________________________
26 AliTRDeventInfo::AliTRDeventInfo():
34 // Default Constructor
39 //____________________________________________________________________
40 AliTRDeventInfo::AliTRDeventInfo(AliESDHeader *header, AliESDRun *run):
48 // Constructor with Arguments
52 /* for(Int_t ilevel(0); ilevel<3; ilevel++){
53 printf("L%d :: ", ilevel);
54 Int_t itrig(0); TString tn;
56 tn = fHeader->GetTriggerInputName(itrig++, ilevel);
57 printf("%s ", tn.Data());
58 } while(tn.CompareTo(""));
63 //____________________________________________________________________
64 AliTRDeventInfo::AliTRDeventInfo(const AliTRDeventInfo &info):
66 ,fHeader(info.fHeader)
68 ,fCentrality(info.fCentrality)
78 //____________________________________________________________________
79 AliTRDeventInfo& AliTRDeventInfo::operator=(const AliTRDeventInfo& info){
84 if(this == &info) return *this;
85 fHeader = info.fHeader;
87 fCentrality = info.fCentrality;
93 //____________________________________________________________________
94 AliTRDeventInfo::~AliTRDeventInfo(){
97 // Delete the entries if it is the Owner
102 //____________________________________________________________________
103 void AliTRDeventInfo::Delete(const Option_t *){
106 // Delete the entries if it is the Owner
109 if(fHeader) delete fHeader;
110 if(fRun) delete fRun;
116 //____________________________________________________________________
117 void AliTRDeventInfo::SetOwner()
122 fHeader = new AliESDHeader(*fHeader);
123 fRun = new AliESDRun(*fRun);
126 //____________________________________________________________________
127 UShort_t AliTRDeventInfo::GetBunchFill() const
130 return fHeader->GetBunchCrossNumber();
133 //____________________________________________________________________
134 Int_t AliTRDeventInfo::GetCentralityBin(Float_t cenPer)
136 // calculate centrality bin
137 for(Int_t icen(0); icen<kCentralityClasses-1; icen++){
138 if(cenPer<fgkCentBin[icen]) return icen;
143 //____________________________________________________________________
144 Int_t AliTRDeventInfo::GetMultiplicityBin(Int_t n)
146 // calculate centrality bin
147 for(Int_t im(0); im<kCentralityClasses-1; im++){
148 if(n<fgkMultBin[im]) return kCentralityClasses-im-1;
153 //____________________________________________________________________
154 void AliTRDeventInfo::GetListOfIsolatedBunches(TH1D* hbc, Int_t bunchSpacing) {
156 // Find the isolated bunch crossings
158 // from I.Arsene first implementation in AliTRDcheckESD
161 Bool_t isIsolated[kLHCbunches]; memset(isIsolated, 0, kLHCbunches*sizeof(Bool_t));
162 for(Int_t bcBin(1); bcBin<=hbc->GetNbinsX(); bcBin++) {
163 Int_t bc(TMath::Nint(hbc->GetBinCenter(bcBin)));
164 if(bc<0 || bc>=kLHCbunches) continue; // outside LHC range
165 Double_t entries(hbc->GetBinContent(bcBin));
166 if(entries<1.) continue; // not filled
169 Bool_t kFOUND(kTRUE);
170 for(Int_t ibc = TMath::Max(1,bcBin-bunchSpacing); ibc <= TMath::Min(Int_t(kLHCbunches), bcBin+bunchSpacing); ibc++) {
171 if(ibc==bcBin) continue;
172 if(hbc->GetBinContent(ibc)>0.) {
177 isIsolated[bc] = kFOUND;
178 if(kFOUND) nBunches++;
179 } // end loop over BC bins
181 printf("Isolated bunches [%d] @ min bunch spacing [%d]:\n{", nBunches, bunchSpacing);
182 for(Int_t ibc(0); ibc<kLHCbunches; ++ibc) if(isIsolated[ibc]) printf("%4d, ", ibc);