#include "AliRunTag.h"
#include "AliEventTag.h"
#include "AliLog.h"
+#include "AliRunTagCuts.h"
+#include "AliLHCTagCuts.h"
+#include "AliDetectorTagCuts.h"
+#include "AliEventTagCuts.h"
#include <TObjArray.h>
#include <TAxis.h>
fRunCut(0x0),
fLHCCut(0x0),
fDetCut(0x0),
- fEvCut(0x0){
+ fEvCut(0x0),
+ fRunTagCut(0x0),
+ fEventTagCut(0x0),
+ fDetectorTagCut(0x0),
+ fLHCTagCut(0x0),
+ fBinNumber(0)
+{
// Default constructor. Initializes the THnSparseI,
// the initial size of the array and the array itself
fN = fChunkSize;
fRunCut(0x0),
fLHCCut(0x0),
fDetCut(0x0),
- fEvCut(0x0){
+ fEvCut(0x0),
+ fRunTagCut(0x0),
+ fEventTagCut(0x0),
+ fDetectorTagCut(0x0),
+ fLHCTagCut(0x0),
+ fBinNumber(0){
// Constructor. Initializes the THnSparseI,
// the initial size of the pool array and the array itself
// It uses the provided array of variables to create TTreeFormulas
delete fLHCCut;
delete fDetCut;
delete fEvCut;
+
+ delete fRunTagCut;
+ delete fEventTagCut;
+ delete fDetectorTagCut;
+ delete fLHCTagCut;
+
}
return 0x0;
}
+ fBinNumber++;
+
fChain->SetEntryList(fPool[fCurrentBin++],"ne");
return fChain;
}
if (current != fTagChain->GetTreeNumber()) {
// Update the formula leaves if a new file is processed by the chain
- if (fRunCut) fRunCut->UpdateFormulaLeaves();
- if (fLHCCut) fLHCCut->UpdateFormulaLeaves();
- if (fDetCut) fDetCut->UpdateFormulaLeaves();
- if (fEvCut) fEvCut->UpdateFormulaLeaves();
+// if (fRunCut) fRunCut->UpdateFormulaLeaves();
+// if (fLHCCut) fLHCCut->UpdateFormulaLeaves();
+// if (fDetCut) fDetCut->UpdateFormulaLeaves();
+// if (fEvCut) fEvCut->UpdateFormulaLeaves();
+
+ if (fEventTagCut) fEventTagCut->InitializeTriggerClasses(tag->GetActiveTriggerClasses());
for (Int_t ivar=0; ivar<fHnSparseI.GetNdimensions(); ++ivar)
- if (fVars[ivar]) fVars[ivar]->UpdateFormulaLeaves();
+ if (fVars[ivar]) fVars[ivar]->UpdateFormulaLeaves();
// Create the ESD/AOD chain if not done
if (!fChain) {
// Update the tree number
current = fTagChain->GetTreeNumber();
}
+
+ // Deprecated use of TTreeFormulas
+// // Apply Run, LHC, and detector cuts if they exist
+// if(!fRunCut || fRunCut->EvalInstance(iTagFiles) == 1) {
+// if(!fLHCCut || fLHCCut->EvalInstance(iTagFiles) == 1) {
+// if(!fDetCut || fDetCut->EvalInstance(iTagFiles) == 1) {
+
- // Apply Run, LHC, and detector cuts if they exist
- if(!fRunCut || fRunCut->EvalInstance(iTagFiles) == 1) {
- if(!fLHCCut || fLHCCut->EvalInstance(iTagFiles) == 1) {
- if(!fDetCut || fDetCut->EvalInstance(iTagFiles) == 1) {
+// // Get access to the event data in the TTreeFormula
+// if (fEvCut) fEvCut->GetNdata();
+// for (Int_t ivar=0; ivar<fHnSparseI.GetNdimensions(); ++ivar)
+// if (fVars[ivar]) fVars[ivar]->GetNdata();
+// // Loop on events
+// // const TClonesArray *tagList = tag->GetEventTags();
+// Int_t iFiles = tag->GetNFiles();
+// for (int ifs = 0; ifs<iFiles; ifs++) {
+// AliFileTag *eftag = (AliFileTag *) tag->GetFileTag(ifs);
+
+// guid = eftag->GetGUID();
+// turl = eftag->GetTURL();
+// path = eftag->GetPath();
+
+// Int_t iEvents = eftag->GetNEvents();
+// for(Int_t i = 0; i < iEvents; i++) {
+// evTag = (AliEventTag *) eftag->GetEventTag(i);
+
+
+// if(!fEvCut || fEvCut->EvalInstance(i) == 1) {
+// TEntryList *fLocalList = new TEntryList();
+// fLocalList->SetTreeName(fChain->GetName());
+// fLocalList->SetFileName(turl.Data());
+// fLocalList->Enter(i);
+
+
+// // Add this event to the corresponding pool
+// {
+// // Increment the bin content corrresponding to the vector "x" by "w",
+// // and store the event index iev to the array associated with the bin,
+// // then return the bin index.
+
+// for (Int_t ivar=0; ivar<ndim; ++ivar) x[ivar] = fVars[ivar]->EvalInstance(i);
+
+// Int_t bin = fHnSparseI.Fill(x);
+// // Check if we have to enlarge the array of pointers
+// if (bin>=fN) Set(bin+fChunkSize);
+// // Allocate the TEntryList if this is the first use of it
+// if (!fPool[bin]) fPool[bin] = new TEntryList();
+// // Add the event iev to the corresponding bin
+// fPool[bin]->Add(fLocalList);
+// }
+// }
+// }//event loop
+
+// for (Int_t ipool=0; ipool<fHnSparseI.GetNbins(); ++ipool)
+// fPool[ipool]->OptimizeStorage();
+
+// // Add the current file to the ESD/AOD chain
+// if(!path.IsNull()) fChain->AddFile(path);
+// else if(!turl.IsNull()) fChain->AddFile(turl);
+// }
+// }//detector tag cuts
+// }//lhc tag cuts
+// }//run tag cut
- // Get access to the event data in the TTreeFormula
- if (fEvCut) fEvCut->GetNdata();
- for (Int_t ivar=0; ivar<fHnSparseI.GetNdimensions(); ++ivar)
- if (fVars[ivar]) fVars[ivar]->GetNdata();
+ // Apply Run, LHC, and detector cuts if they exist
+ if(!fRunTagCut || fRunTagCut->IsAccepted(tag)) {
+ if(!fLHCTagCut || fLHCTagCut->IsAccepted(tag->GetLHCTag())) {
+ if(!fDetectorTagCut || fDetectorTagCut->IsAccepted(tag->GetDetectorTags())) {
+
+// // Get access to the event data in the TTreeFormula
+// if (fEvCut) fEvCut->GetNdata();
+ for (Int_t ivar=0; ivar<fHnSparseI.GetNdimensions(); ++ivar)
+ if (fVars[ivar]) fVars[ivar]->GetNdata();
// Loop on events
- const TClonesArray *tagList = tag->GetEventTags();
- Int_t iEvents = tagList->GetEntries();
- for(Int_t i = 0; i < iEvents; i++) {
- evTag = (AliEventTag *) tagList->At(i);
-
- guid = evTag->GetGUID();
- turl = evTag->GetTURL();
- path = evTag->GetPath();
-
-
- if(!fEvCut || fEvCut->EvalInstance(i) == 1) {
- TEntryList *fLocalList = new TEntryList();
- fLocalList->SetTreeName(fChain->GetName());
- fLocalList->SetFileName(turl.Data());
- fLocalList->Enter(i);
-
-
- // Add this event to the corresponding pool
- {
- // Increment the bin content corrresponding to the vector "x" by "w",
- // and store the event index iev to the array associated with the bin,
- // then return the bin index.
-
- for (Int_t ivar=0; ivar<ndim; ++ivar) x[ivar] = fVars[ivar]->EvalInstance(i);
+ // const TClonesArray *tagList = tag->GetEventTags();
+ Int_t iFiles = tag->GetNFiles();
+ for (int ifs = 0; ifs<iFiles; ifs++) {
+ AliFileTag *eftag = (AliFileTag *) tag->GetFileTag(ifs);
+
+ guid = eftag->GetGUID();
+ turl = eftag->GetTURL();
+ path = eftag->GetPath();
+
+ Int_t iEvents = eftag->GetNEvents();
+ for(Int_t i = 0; i < iEvents; i++) {
+ evTag = (AliEventTag *) eftag->GetEventTag(i);
+
+
+ if(!fEventTagCut || fEventTagCut->IsAccepted(evTag)) {
+ TEntryList *fLocalList = new TEntryList();
+ fLocalList->SetTreeName(fChain->GetName());
+ fLocalList->SetFileName(turl.Data());
+ fLocalList->Enter(i);
- Int_t bin = fHnSparseI.Fill(x);
- // Check if we have to enlarge the array of pointers
- if (bin>=fN) Set(bin+fChunkSize);
- // Allocate the TEntryList if this is the first use of it
- if (!fPool[bin]) fPool[bin] = new TEntryList();
- // Add the event iev to the corresponding bin
- fPool[bin]->Add(fLocalList);
+
+ // Add this event to the corresponding pool
+ {
+ // Increment the bin content corrresponding to the vector "x" by "w",
+ // and store the event index iev to the array associated with the bin,
+ // then return the bin index.
+
+ for (Int_t ivar=0; ivar<ndim; ++ivar) x[ivar] = fVars[ivar]->EvalInstance(i);
+
+ Int_t bin = fHnSparseI.Fill(x);
+ // Check if we have to enlarge the array of pointers
+ if (bin>=fN) Set(bin+fChunkSize);
+ // Allocate the TEntryList if this is the first use of it
+ if (!fPool[bin]) fPool[bin] = new TEntryList();
+ // Add the event iev to the corresponding bin
+ fPool[bin]->Add(fLocalList);
+ }
}
- }
- }//event loop
+ }//event loop
- for (Int_t ipool=0; ipool<fHnSparseI.GetNbins(); ++ipool)
- fPool[ipool]->OptimizeStorage();
-
- // Add the current file to the ESD/AOD chain
- if(!path.IsNull()) fChain->AddFile(path);
- else if(!turl.IsNull()) fChain->AddFile(turl);
-
+ for (Int_t ipool=0; ipool<fHnSparseI.GetNbins(); ++ipool)
+ fPool[ipool]->OptimizeStorage();
+
+ // Add the current file to the ESD/AOD chain
+ if(!path.IsNull()) fChain->AddFile(path);
+ else if(!turl.IsNull()) fChain->AddFile(turl);
+ }
}//detector tag cuts
}//lhc tag cuts
}//run tag cut
+
}//tag file loop
delete [] x;
fEvCut = new TTreeFormula("fEv",cut,fTagChain);
}
+// _________________________________________________________________________
+void AliEventPoolSparse::SetRunCut(AliRunTagCuts* cut)
+{
+ fRunTagCut = cut;
+}
+// _________________________________________________________________________
+void AliEventPoolSparse::SetEventCut(AliEventTagCuts* cut)
+{
+ fEventTagCut = cut;
+}
+// _________________________________________________________________________
+void AliEventPoolSparse::SetDetectorCut(AliDetectorTagCuts* cut)
+{
+ fDetectorTagCut = cut;
+}
+// _________________________________________________________________________
+void AliEventPoolSparse::SetLHCCut(AliLHCTagCuts* cut)
+{
+ fLHCTagCut = cut;
+}
+
// _________________________________________________________________________
void AliEventPoolSparse::Set(Int_t n){
// Set size of the array of pointers to n.