}
//______________________________________________________________________________
-void AliAnalysisManager::InitInpuData(AliVEvent* esdEvent)
+void AliAnalysisManager::InitInputData(AliVEvent* esdEvent, AliESDfriend* esdFriend)
{
// Method to propagte to all the connected tasks the HLT event.
TString classInputHandler = fInputEventHandler->ClassName();
if (classInputHandler.Contains("HLT")){
TObjArray* arrTasks = GetTasks();
- fInputEventHandler->InitTaskInputData(esdEvent, arrTasks);
+ fInputEventHandler->InitTaskInputData(esdEvent, esdFriend, arrTasks);
}
else {
Fatal("PropagateHLTEvent", "Input Handler not of type HLT, we cannot use this method!");
class AliAnalysisGrid;
class AliAnalysisStatistics;
class AliVEvent;
+class AliESDfriend;
class AliAnalysisManager : public TNamed {
void Lock();
void UnLock();
void Changed();
- void InitInpuData(AliVEvent* esdEvent);
+ void InitInputData(AliVEvent* esdEvent, AliESDfriend* esdFriend);
protected:
void CreateReadCache();
void ImportWrappers(TList *source);
#include "AliVVtrack.h"
#include "AliESDtrackCuts.h"
#include "AliVEventHandler.h"
+#include "../TPC/Rec/AliTPCseed.h"
+#include "../TPC/Rec/AliTPCclusterMI.h"
#include "AliAnalysisTaskPt.h"
//________________________________________________________________________
AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name)
-: AliAnalysisTask(name, ""), fESD(0), fHistPt(0), fCuts(0), fEv(0)
+: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0)
{
// Constructor
// Input slot #0 works with a TChain
DefineInput(0, TChain::Class());
// Output slot #0 writes into a TH1 container
- DefineOutput(0, TH1F::Class());
+ DefineOutput(0, TList::Class());
}
//________________________________________________________________________
Printf("----> AliAnalysisTaskPt::ConnectInputData Getting the event from handler %p", esdH);
//fESD = dynamic_cast<AliESDEvent*>(esdH->GetEvent());
fESD = esdH->GetEvent();
+ fESDfriend = esdH->GetFriendEvent();
}
if (!fESD) {
- Printf("ERROR, the dynamic cast did not work");
+ Printf("ERROR, no ESD event");
+ }
+ if (!fESDfriend) {
+ Printf("ERROR, no ESD friend");
}
}
- Printf("fESD = %p", fESD);
+ Printf("fESD = %p, fESDfriend = %p", fESD, fESDfriend);
printf("<---- AliAnalysisTaskPt::ConnectInputData\n");
}
// Create histograms
// Called once
+ fListOut = new TList();
+ fListOut->SetOwner();
+ fListOut->SetName("listHistos");
fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
fHistPt->SetMarkerStyle(kFullCircle);
+ fHistQ = new TH1F("fHistQ", "TPC clusters: Q distribution", 1000, 0, 10000);
+ fHistQ->GetXaxis()->SetTitle("Q");
+ fHistQ->GetYaxis()->SetTitle("dN/dQ");
+ fHistQ->SetMarkerStyle(kFullCircle);
+
+ fListOut->Add(fHistPt);
+ fListOut->Add(fHistQ);
+
+ PostData(0, fListOut);
+
fCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(1);
- PostData(0, fHistPt);
}
//________________________________________________________________________
Printf("ERROR: fESD not available");
return;
}
+ if (!fESDfriend) {
+ Printf("ERROR: fESDfriend not available");
+ return;
+ }
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+ Printf("... and there are %d friends in this event", fESDfriend->GetNumberOfTracks());
// Track loop to fill a pT spectrum
for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
fHistPt->Fill(track->Pt());
} //track loop
+
+ // Friend Track loop
+ for (Int_t iFriend = 0; iFriend < fESDfriend->GetNumberOfTracks(); iFriend++) {
+ AliESDfriendTrack* friendTrack = fESDfriend->GetTrack(iFriend);
+ if (!friendTrack) {
+ Printf("ERROR: Could not receive track %d", iFriend);
+ continue;
+ }
+ TObject* calibObject;
+ AliTPCseed* seed = NULL;
+ for (Int_t idx = 0; (calibObject = friendTrack->GetCalibObject(idx)); ++idx) {
+ Printf(" |Cal %d = %p", idx, calibObject);
+ if ((seed = dynamic_cast<AliTPCseed*>(calibObject))) {
+ Printf("Found TPC seed");
+ for (Int_t irow = 0; irow < 160; irow++){
+ AliTPCclusterMI* cluMI = seed->GetClusterPointer(irow);
+ if (cluMI){
+ Printf("Found cluster at row %d", irow);
+ Float_t q = cluMI->GetQ();
+ Printf("Q = %f", q);
+ fHistQ->Fill(q);
+ }
+ else {
+ Printf("Row %d does not contain clusters", irow);
+ }
+ }
+ }
+ }
+ }
+
// Post output data.
- PostData(0, fHistPt);
+ PostData(0, fListOut);
fEv++;
}
Printf("Terminate called: fESD = %p", fESD);
- fHistPt = dynamic_cast<TH1F*> (GetOutputData(0));
- if (!fHistPt) {
- Printf("ERROR: fHistPt not available");
- return;
- }
+ fListOut = dynamic_cast<TList*> (GetOutputData(0));
+
+ if (fListOut) {
+ fHistPt = dynamic_cast<TH1F*>(fListOut->FindObject("fHistPt"));
+ if (!fHistPt) {
+ Printf("ERROR: fHistPt not available");
+ return;
+ }
- TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
- c1->cd(1)->SetLogy();
- fHistPt->DrawCopy("E");
+ TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
+ c1->cd(1)->SetLogy();
+ fHistPt->DrawCopy("E");
+ }
+ else {
+ Printf("In Terminate: no TList found");
+ }
+
}
class TH1F;
class AliESDEvent;
+class AliESDfriend;
class AliVVevent;
class AliESDtrackCuts;
+class TList;
#include "AliAnalysisTask.h"
class AliAnalysisTaskPt : public AliAnalysisTask {
public:
- AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fHistPt(0), fCuts(0), fEv(0) {}
+ AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0) {}
AliAnalysisTaskPt(const char *name);
virtual ~AliAnalysisTaskPt() {}
virtual void Terminate(Option_t *);
private:
- AliVVevent *fESD; //ESD object
- TH1F *fHistPt; //Pt spectrum
- AliESDtrackCuts* fCuts;
+ AliVVevent* fESD; // ESD object
+ AliESDfriend* fESDfriend; // ESD friend object
+ TH1F* fHistPt; // Pt spectrum
+ AliESDtrackCuts* fCuts; // cuts
Int_t fEv;
-
+ TH1F* fHistQ; // TPC clusters Q spectrum
+ TList* fListOut; // output list
+
AliAnalysisTaskPt(const AliAnalysisTaskPt&); // not implemented
AliAnalysisTaskPt& operator=(const AliAnalysisTaskPt&); // not implemented
list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny);
list.push_back(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
list.push_back(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
+ list.push_back(kAliHLTDataTypeESDfriendObject|kAliHLTDataOriginAny);
}
// #################################################################################
// see header file for class documentation
if (!targetMap) return;
- targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
+ /* targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
new TObjString("configuration object"));
targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelationsCentrality"),
new TObjString("centrality configuration object"));
-
+ */
return;
}
fAnalysisManager->AddTask(task);
AliAnalysisDataContainer *cinput = fAnalysisManager->GetCommonInputContainer();
Printf("Defining output file");
- AliAnalysisDataContainer *coutput1 = fAnalysisManager->CreateContainer("pt", TH1::Class(),
+ AliAnalysisDataContainer *coutput1 = fAnalysisManager->CreateContainer("pt", TList::Class(),
AliAnalysisManager::kOutputContainer, "Pt.ESD.root");
// connect containers
// -- Get ESD object
// -------------------
AliESDEvent *esdEvent = NULL;
+ AliESDfriend *esdFriend = NULL;
for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
if( !esdEvent ){
esdEvent->GetStdContent();
}
printf("----> ESDEvent %p has %d tracks: \n", esdEvent, esdEvent->GetNumberOfTracks());
+ for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDfriendObject); iter != NULL; iter = GetNextInputObject() ) {
+ esdFriend = dynamic_cast<AliESDfriend*>(const_cast<TObject*>( iter ) );
+ if( !esdFriend ){
+ HLTWarning("Wrong ESDFriend object received");
+ iResult = -1;
+ continue;
+ }
+ }
+ printf("----> ESDFriend %p has %d tracks: \n", esdFriend, esdFriend->GetNumberOfTracks());
- fAnalysisManager->InitInpuData(esdEvent);
+ fAnalysisManager->InitInputData(esdEvent, esdFriend);
// fInputHandler->BeginEvent(0);
fAnalysisManager->ExecAnalysis();
fInputHandler->FinishEvent();
}
//______________________________________________________________________________
-Bool_t AliHLTTestInputHandler::InitTaskInputData(AliVEvent* esdEvent, TObjArray* arrTasks) {
+Bool_t AliHLTTestInputHandler::InitTaskInputData(AliVEvent* esdEvent, AliESDfriend* friendEvent, TObjArray* arrTasks) {
// Method to propagte to all the connected tasks the HLT event.
// The method gets the list of tasks from the manager
Printf("----> AliHLTTestInputHandler::InitTaskInpuData: Setting the event...");
SetEvent(esdEvent);
+ SetFriendEvent(friendEvent);
// set transient pointer to event inside tracks
fEvent->ConnectTracks();
Printf("----> AliHLTTestInputHandler::InitTaskInpuData: ...Event set");
class TObjArray;
class AliVEvent;
+class AliESDfriend;
class AliHLTTestInputHandler : public AliVEventHandler {
virtual Bool_t TerminateIO() {return kTRUE;}
// Especially needed for HLT
- Bool_t InitTaskInputData(AliVEvent* /*esdEvent*/, TObjArray* /*arrTasks*/);
+ Bool_t InitTaskInputData(AliVEvent* /*esdEvent*/, AliESDfriend* /*friendEvent*/, TObjArray* /*arrTasks*/);
AliVEvent* GetEvent() const {return fEvent;}
void SetEvent(AliVEvent *event) {fEvent = event;}
+
+ AliESDfriend* GetFriendEvent() const {return fFriendEvent;}
+ void SetFriendEvent(AliESDfriend *friendEvent) {fFriendEvent = friendEvent;}
private:
AliHLTTestInputHandler(const AliVEventHandler& handler);
AliHLTTestInputHandler& operator=(const AliVEventHandler& handler);
- AliVEvent *fEvent; //! Pointer to the event
+ AliVEvent *fEvent; //! Pointer to the event
+ AliESDfriend *fFriendEvent; //! Pointer to the friend event
ClassDef(AliHLTTestInputHandler, 1);
};
class TTree;
class TObjArray;
class AliVEvent;
+class AliESDfriend;
class AliVEventHandler : public TNamed {
void Changed();
virtual void SetCacheSize(Long64_t) {}
virtual TList *GetUserInfo() const {return 0x0;};
- // HLT
- virtual Bool_t InitTaskInputData(AliVEvent* /*event*/, TObjArray* /*arrTasks*/) {printf("OOOOPS!!!\n"); return kTRUE;};
- virtual AliVEvent* GetEvent() const {return 0x0;};
+ // HLT
+ virtual Bool_t InitTaskInputData(AliVEvent* /*event*/, AliESDfriend* /*esdFriend*/, TObjArray* /*arrTasks*/) {printf("OOOOPS!!!\n"); return kTRUE;};
+ virtual AliVEvent* GetEvent() const {return 0x0;};
+ virtual AliESDfriend* GetFriendEvent() const {return 0x0;};
private :
ClassDef(AliVEventHandler, 1);