#include "AliAnalysisManager.h"
#include "AliESDEvent.h"
-#include "AliVVevent.h"
-#include "AliVVtrack.h"
#include "AliESDtrackCuts.h"
#include "AliVEventHandler.h"
#include "AliTPCseed.h"
#include "AliTPCclusterMI.h"
-#include "AliVVfriendEvent.h"
-#include "AliVVfriendTrack.h"
+#include "AliVfriendEvent.h"
+#include "AliVfriendTrack.h"
+#include "AliESDInputHandler.h"
#include "AliAnalysisTaskPt.h"
//________________________________________________________________________
AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name)
-: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0), fUseFriends(kFALSE)
+: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0), fUseFriends(kFALSE), fHistNTPCCl(0), fHistNESDtracks(0), fHistNESDfriendtracks(0)
+
{
// Constructor
TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
if (!tree) {
Printf("ERROR: Could not read chain from input slot 0");
- } else {
+ }
+ else {
// Disable all branches and enable only the needed ones
// The next two lines are different when data produced as AliESDEvent is read
/*
*/
AliVEventHandler *esdH = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ TString classInputHandler = esdH->ClassName();
+
+ Printf("----> AliAnalysisTaskPt: ClassName of handler = %s", classInputHandler.Data());
if (!esdH) {
Printf("ERROR: Could not get ESDInputHandler");
- } else {
+ }
+ else {
Printf("----> AliAnalysisTaskPt::ConnectInputData Getting the event from handler %p", esdH);
- //fESD = dynamic_cast<AliESDEvent*>(esdH->GetEvent());
- fESD = esdH->GetVVEvent();
- if (fUseFriends){
- fESDfriend = esdH->GetVVFriendEvent();
+ fESD = esdH->GetEvent();
+ if (fUseFriends){
+ Printf("...We have to use the friends...");
+ if (classInputHandler.Contains("HLT")) { // we are running in HLT
+ fESDfriend = esdH->GetVfriendEvent();
+ }
+ else { /// we are running offline
+ if (esdH && esdH->GetTree()) {
+ Printf("...We got the tree...");
+ if (esdH->GetTree()->GetBranch("ESDfriend.")){
+ Printf("Yu-huuuu!!! friend branch found");
+ fESDfriend = ((AliESDInputHandler*)esdH)->GetESDfriend();
+ }
+ else {
+ Printf("No friend branch found");
+ }
+ }
+ }
+ Printf("and the result is: fESDfriend = %p", fESDfriend);
+ }
+ else {
+ Printf("The friends are not requested");
}
}
if (!fESD) {
fHistQ->GetYaxis()->SetTitle("dN/dQ");
fHistQ->SetMarkerStyle(kFullCircle);
+ fHistNTPCCl = new TH1F("fHistNTPCCl", "Number of TPC clusters", 160, -0.5, 159.5);
+ fHistNTPCCl->GetXaxis()->SetTitle("n. TPC Cl.");
+ fHistNTPCCl->GetYaxis()->SetTitle("dN/d(n. TPC Cl)");
+ fHistNTPCCl->SetMarkerStyle(kFullCircle);
+
+ fHistNESDtracks = new TH1F("fHistNESDtracks", "Number of ESD friend tracks", 1000, -0.5, 999.5);
+ fHistNESDtracks->GetXaxis()->SetTitle("n. ESD friend tracks");
+ fHistNESDtracks->GetYaxis()->SetTitle("dN/d(n. ESD friend tracks)");
+ fHistNESDtracks->SetMarkerStyle(kFullCircle);
+
+ fHistNESDfriendtracks = new TH1F("fHistNESDfriendtracks", "Number of ESD tracks", 1000, -0.5, 999.5);
+ fHistNESDfriendtracks->GetXaxis()->SetTitle("n. ESD tracks");
+ fHistNESDfriendtracks->GetYaxis()->SetTitle("dN/d(n. ESD tracks)");
+ fHistNESDfriendtracks->SetMarkerStyle(kFullCircle);
+
fListOut->Add(fHistPt);
fListOut->Add(fHistQ);
+ fListOut->Add(fHistNTPCCl);
+ fListOut->Add(fHistNESDtracks);
+ fListOut->Add(fHistNESDfriendtracks);
PostData(0, fListOut);
Printf("ERROR: fESD not available");
return;
}
- if (!fESDfriend) {
- Printf("ERROR: fESDfriend not available");
- return;
+
+ /*
+ if (fUseFriends){
+ Printf("In Exec: ...We have to use the friends...");
+ fESDfriend = fESD->FindFriend();
+ Printf("...and we got friends = %p", fESDfriend);
+ if (!fESDfriend) {
+ Printf("ERROR: fESDfriend not available");
+ return;
+ }
+ }
+ */
+
+ if (fUseFriends){
+ Printf("In Exec: ...We have to use the friends...");
+ Printf("...and we got friends = %p", fESDfriend);
+ 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());
+ Int_t nESDtracks = fESD->GetNumberOfTracks();
+ Int_t nESDfriendtracks = 0;
+ if (fUseFriends) nESDfriendtracks = fESDfriend->GetNumberOfTracks();
+ Printf("There are %d tracks in this event", nESDtracks);
+ Printf("... and there are %d friends in this event", nESDfriendtracks);
+
+ fHistNESDtracks->Fill(nESDtracks);
+ fHistNESDfriendtracks->Fill(nESDfriendtracks);
// Track loop to fill a pT spectrum
- for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
- AliVVtrack* track = fESD->GetTrack(iTracks);
+ for (Int_t iTracks = 0; iTracks < nESDtracks; iTracks++) {
+ Printf("Checking track %d", iTracks);
+ const AliVTrack* track = dynamic_cast<AliVTrack*>(fESD->GetTrack(iTracks));
if (!track) {
Printf("ERROR: Could not receive track %d", iTracks);
continue;
}
Printf("track %d has pt = %f", iTracks, track->Pt());
fHistPt->Fill(track->Pt());
+ fHistNTPCCl->Fill(track->GetTPCNcls());
} //track loop
if (fUseFriends){
+ Printf("In the loop over the friends");
// Friend Track loop
- for (Int_t iFriend = 0; iFriend < fESDfriend->GetNumberOfTracks(); iFriend++) {
- //Printf("Getting friend %d", iFriend);
- const AliVVfriendTrack* friendTrack = fESDfriend->GetTrack(iFriend);
+ for (Int_t iFriend = 0; iFriend < nESDfriendtracks; iFriend++) {
+ Printf("Getting friend %d", iFriend);
+ const AliVfriendTrack* friendTrack = fESDfriend->GetTrack(iFriend);
if (!friendTrack) {
Printf("ERROR: Could not receive track %d", iFriend);
continue;
- }
- TObject* calibObject;
- AliTPCseed* seed = NULL;
- //AliTPCseed* seed = friendTrack->GetTPCseed();
- //if (seed){
- 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 %p", 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);
- }
+ }
+ else {
+ Printf("friend track = %p", friendTrack);
+ }
+
+ AliTPCseed seed;
+ Int_t err = friendTrack->GetTPCseed( seed );
+ Printf("err = %d", err);
+ if( err==0 ){
+ 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("Schade... seed is %p", seed);
+ else {
+ Printf("Row %d does not contain clusters", irow);
+ }
}
+ }
+ else {
+ //Printf("Schade... seed is %p", seed);
}
}
}