ClassImp(AliAnalysisTaskTriggerStudy)
+const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"C0MBS2","C0VBA","C0VBC","C0OM2"};
+
AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy()
: AliAnalysisTaskSE("TaskTriggerStudy"),
- fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix("")
+ fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix(""),fNTrackletsCut(1000000)
{
// constructor
}
AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy(const char * name)
: AliAnalysisTaskSE(name),
- fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix("")
+ fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix(""),fNTrackletsCut(1000000)
{
//
// Standard constructur which should be used
const AliMultiplicity* mult = fESD->GetMultiplicity();
Int_t ntracklets = mult->GetNumberOfTracklets();
+ if(ntracklets > fNTrackletsCut) return;
+
// Reset histo suffix and fill reference histograms without any suffix
fHistoSuffix = "";
GetHistoTracklets("all","All events")->Fill(ntracklets);
Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger
// TOF triggers
- // FIXME: implement real triggers
- Bool_t c0OM2 = kFALSE;
- Bool_t c0OM3 = kFALSE;
+ // FIXME: move to triggeranalysis?
+ AliESDHeader*h = fESD->GetHeader(); // taken the header from AliESDEvent
+ Bool_t c0OM2 = h->IsTriggerInputFired("0OM2"); // thr >= 2 (input 19)
+ Bool_t c0OM3 = h->IsTriggerInputFired("0OM3"); // thr >= 3 (input 20)
// Some macros for the online triggers
Bool_t cMBS2A = c0sm2 && c0v0A;
Bool_t cMBS2C = c0sm2 && c0v0C;
Bool_t cMBAC = c0v0A && c0v0C;
+
- FillTriggerOverlaps("All", "All Events", nFastOrOffline,c0v0A,c0v0C,c0OM2,c0OM3,cMBS2A,cMBS2C,cMBAC);
+ Bool_t vdArray[kNVDEntries];
+ vdArray[kVDC0MBS2] = c0sm2;
+ vdArray[kVDC0VBA] = c0v0A;
+ vdArray[kVDC0VBC] = c0v0C;
+ vdArray[kVDC0OM2] = c0OM2;
+
+ FillTriggerOverlaps("All", "All Events",vdArray);
// loop over trigger classes in the event
if(cMBS2C) GetHistoTracklets("cMBS2C","Events were trigger cMBS2C fired")->Fill(ntracklets);
if(cMBAC ) GetHistoTracklets("cMBAC ","Events were trigger cMBAC fired")->Fill(ntracklets);
// if() GetHistoTracklets("","Events were trigger fired");
+
+ // Fill trigger overlaps
+ FillTriggerOverlaps("All", "All Events in trigger class",vdArray);
+
delete tokens;
}
return h;
}
-void AliAnalysisTaskTriggerStudy::FillTriggerOverlaps (const char * name, const char * title,
- Int_t nFastOrOffline,
- Bool_t v0A, Bool_t v0C, Bool_t OM2, Bool_t OM3,
- Bool_t cMBS2A,Bool_t cMBS2C, Bool_t cMBAC) {
+void AliAnalysisTaskTriggerStudy::FillTriggerOverlaps (const char * name, const char * title, Bool_t * vdArray){
//Fills a histo with the different trigger statistics in a venn like diagramm. Books it if needed.
// Get or book histo
AliInfo(Form("Booking histo %s",hname.Data()));
Bool_t oldStatus = TH1::AddDirectoryStatus();
TH1::AddDirectory(kFALSE);
- Int_t nbins = 14;
- h = new TH1I (hname, title, nbins, 0.5, nbins+0.5);
+ Int_t nbins = 0;
+ for(Int_t ientry = 0; ientry < kNVDEntries; ientry++){
+ nbins = nbins | (1<<ientry);
+ }
+
+ h = new TH1I (hname, title, nbins, -0.5, nbins-0.5);
fHistoList->GetList()->Add(h);
TH1::AddDirectory(oldStatus);
+
+ // we look at the combinations of n triggers
+ // We set a bit for each trigger to fill the diagram
+ // This is much simpler and faster than any recursive function
+ h->GetXaxis()->SetBinLabel(1,"NONE");
+ for(Int_t ibin = 1; ibin < nbins; ibin++){
+ TString binname = "";
+ Bool_t first = kTRUE;
+ for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){
+ if (ibin & (1<<ivdentry)) {
+ if(!first) binname += " & ";
+ binname += kVDNames[ivdentry];
+ first=kFALSE;
+ }
+ }
+ h->GetXaxis()->SetBinLabel(ibin+1,binname.Data());
+ }
+
}
- // we look at the combinations of 4 triggers
- Int_t ibin = 1;
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0A & V0C & OM2");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0C & OM2");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0A & OM2");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0A & V0C");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0A");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & V0C");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2 & OM2");
- h->GetXaxis()->SetBinLabel(ibin++,"OM2 & V0A");
- h->GetXaxis()->SetBinLabel(ibin++,"OM2 & V0C");
- h->GetXaxis()->SetBinLabel(ibin++,"V0A & V0C");
- h->GetXaxis()->SetBinLabel(ibin++,"FO2");
- h->GetXaxis()->SetBinLabel(ibin++,"V0A");
- h->GetXaxis()->SetBinLabel(ibin++,"V0C");
- h->GetXaxis()->SetBinLabel(ibin++,"OM2");
+ UInt_t mask = 0;
+ for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){
+ if(vdArray[ivdentry]) {
+ mask = mask | (1<<ivdentry);
+ // cout << " 1 " ;
+ } //else cout << " 0 ";
+ }
+ // cout << hex << " = " << mask << endl;
- Bool_t fo2 = nFastOrOffline>=2;
-
- if(fo2 && v0A && v0C && OM2) { h->Fill(1);}
- if(fo2 && !v0A && v0C && OM2) { h->Fill(2);}
- if(fo2 && v0A && !v0C && OM2) { h->Fill(3);}
- if(fo2 && v0A && v0C && !OM2) { h->Fill(4);}
- if(fo2 && v0A && !v0C && !OM2) { h->Fill(5);}
- if(fo2 && !v0A && v0C && !OM2) { h->Fill(6);}
- if(fo2 && !v0A && !v0C && OM2) { h->Fill(7);}
- if(!fo2 && v0A && !v0C && OM2) { h->Fill(8);}
- if(!fo2 && !v0A && v0C && OM2) { h->Fill(9);}
- if(!fo2 && v0A && v0C && !OM2) { h->Fill(10);}
- if(fo2 && !v0A && !v0C && !OM2) { h->Fill(11);}
- if(!fo2 && v0A && !v0C && !OM2) { h->Fill(12);}
- if(!fo2 && !v0A && v0C && !OM2) { h->Fill(13);}
- if(!fo2 && !v0A && !v0C && OM2) { h->Fill(14);}
+ h->Fill(mask);
}
class AliTriggerAnalysis;
class AliAnalysisTaskTriggerStudy : public AliAnalysisTaskSE {
+ // offline trigger enum
+ enum {kC0MBS1,kC0MBS2,kC0MBS3,kC0MBS4,kC0MBS5,kC0VBA,kC0VBC,kC0OM2,kCO0M3};
+ // enum for triggers to be included in the venn-like histogram
+ enum {kVDC0MBS2,kVDC0VBA,kVDC0VBC,kVDC0OM2,kNVDEntries};
+
public:
AliAnalysisTaskTriggerStudy();
void SetIsMC(Bool_t flag=kTRUE) { fIsMC = flag;}
AliHistoListWrapper * GetHistoList() { return fHistoList;}
+ void SetNTrackletsCut(Int_t cut) { fNTrackletsCut = cut;}
+
TH1 * GetHistoTracklets (const char * name, const char * title);
- void FillTriggerOverlaps (const char * name, const char * title, Int_t nFastOrOffline, Bool_t v0A, Bool_t v0C, Bool_t OM2,
- Bool_t OM3, Bool_t cMBS2A,Bool_t cMBS2C, Bool_t cMBAC) ;
+ void FillTriggerOverlaps (const char * name, const char * title, Bool_t * vdArray) ;
virtual void UserCreateOutputObjects();
virtual void UserExec(Option_t *option);
AliTriggerAnalysis * fTriggerAnalysis; // trigger analysis object, to get the offline triggers
TString fHistoSuffix; // suffix appended to all histos, set in the user exec.
+ Int_t fNTrackletsCut; // max number of tracklets
+ static const char * kVDNames[]; // names of the venn hist
AliAnalysisTaskTriggerStudy& operator=(const AliAnalysisTaskTriggerStudy& task);
ClassDef(AliAnalysisTaskTriggerStudy, 2)
-void TriggerStudyResults(const char * filename = "outTrigger/LHC10g1f_130844/trigger_study.root") {
+void TriggerStudyResults(const char * filename = "outTrigger/LHC10g1f_130844/trigger_study.root", TString trigger = "MB") {
TFile * f = new TFile (filename);
// Draw trigger venn diagram
TH1 * hVenn = (TH1*) f->Get("hTrigStat_All");
+ hVenn->Draw();
Int_t colors[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15};
TPie * pie = new TPie(hVenn);
Int_t nbin = hVenn->GetNbinsX();
pie->SetLabelsOffset(.01);
pie->SetLabelFormat("");//#splitline{%val (%perc)}{%txt}");
pie->SetFillColors(colors);
- pie->SetTextSize(0.01)
+ // pie->SetTextSize(0.01);
pie->Draw("");
pie->MakeLegend(0.224832, 0.66958, 0.833893, 0.97028);
cout << pie << endl;
// Make a table of trigger efficiencies for all histos results
- // FIXME: select on trigger class here?
AliLatexTable table(2,"cc");
// table.InsertCustomRow("\\multicolumn{c}{2}{Integrated efficiency}");
- table.InsertCustomRow("Trigger Name & Efficiency\\\\");
+ table.InsertCustomRow(Form("Trigger Name & Efficiency (%s)\\\\",trigger.Data()));
table.InsertHline();
TList * l = gDirectory->GetListOfKeys();
TIterator * iter = l->MakeIterator();
TKey * key = 0;
- TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all");
+ TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all"); // FIXME: get the normalization for a given trigger?
while (key = (TKey*) iter->Next()){
TString name = key->GetName();
if(!name.Contains("Tracklets")) continue;
+ if(!name.Contains(trigger)) continue;
if(name.Contains("all")) continue;
TH1F * h = (TH1F*) gDirectory->Get(name);
TString label = name(name.Index("_")+1, name.Index("_",name.Index("_")+1)-name.Index("_")-1);