1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 // MC bad chunk identifier
19 // --- david.dobrigkeit.chinellato@cern.ch
21 // Loops over all chunks and fills a TTree object with a TString locating
22 // chunk name for each event and a "number of global tracks" variable.
24 // TTree is filled event-by-event but has only very few data members,
25 // so memory consumption should still be reasonable.
27 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 #include <Riostream.h>
38 #include "AliESDEvent.h"
39 #include "AliESDtrack.h"
40 #include "AliInputEventHandler.h"
41 #include "AliAnalysisManager.h"
42 //#include "AliMCEventHandler.h"
43 //#include "AliMCEvent.h"
44 //#include "AliStack.h"
45 #include "AliAnalysisTaskBadChunkID.h"
50 ClassImp(AliAnalysisTaskBadChunkID)
52 AliAnalysisTaskBadChunkID::AliAnalysisTaskBadChunkID()
53 : AliAnalysisTaskSE(), fList(0), fTree(0),
64 AliAnalysisTaskBadChunkID::AliAnalysisTaskBadChunkID(const char *name)
65 : AliAnalysisTaskSE(name), fList(0), fTree(0),
73 // Output slot #0 writes into a TList container (Cascade)
74 DefineOutput(1, TList::Class());
75 DefineOutput(2, TTree::Class());
79 AliAnalysisTaskBadChunkID::~AliAnalysisTaskBadChunkID()
81 //------------------------------------------------
83 //------------------------------------------------
97 //________________________________________________________________________
98 void AliAnalysisTaskBadChunkID::UserCreateOutputObjects()
105 fList->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
108 fHistNEvents = new TH1F("fHistNEvents",
111 fList->Add(fHistNEvents);
117 //------------------------------------------------
119 fTree = new TTree("fTree","V0Candidates");
121 //------------------------------------------------
122 // fTree Branch definitions - V0 Tree
123 //------------------------------------------------
125 //-----------BASIC-INFO---------------------------
126 /*1*/ fTree->Branch("fNGlobalTracks",&fNGlobalTracks,"fNGlobalTracks/I");
127 /*2*/ fTree->Branch("fNTracks",&fNTracks,"fNTracks/I");
128 /*3*/ fTree->Branch("fRunNumber",&fRunNumber,"fRunNumber/I");
129 /*4*/ fTree->Branch("fFileName",&fFileName,16000,0);
131 //List of Histograms: Normal
134 //TTree Object: Saved to base directory. Should cache to disk while saving.
135 //(Important to avoid excessive memory usage, particularly when merging)
138 }// end UserCreateOutputObjects
141 //________________________________________________________________________
142 void AliAnalysisTaskBadChunkID::UserExec(Option_t *)
145 // Called for each event
147 AliESDEvent *lESDevent = 0x0;
148 //AliMCEvent *lMCevent = 0x0;
149 //AliStack *lMCstack = 0x0;
151 // Connect to the InputEvent
152 // After these lines, we should have an ESD/AOD event
154 // Appropriate for ESD analysis!
156 lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
158 AliWarning("ERROR: lESDevent not available \n");
162 /* Anyhow not needed for cross-check
164 lMCevent = MCEvent();
166 Printf("ERROR: Could not retrieve MC event \n");
167 cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
171 lMCstack = lMCevent->Stack();
173 Printf("ERROR: Could not retrieve MC stack \n");
174 cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
179 //------------------------------------------------
180 // Track Multiplicity Information Acquistion
181 //------------------------------------------------
184 Int_t lNGlobalTracks = 0;
186 lNTracks = lESDevent->GetNumberOfTracks();
188 //----- Loop on Tracks --------------------------------------------------------------
189 for (Int_t iCurrentTrack = 0; iCurrentTrack < lNTracks; iCurrentTrack++)
190 {// This is the begining of the loop on tracks
191 AliESDtrack *lThisTrack=((AliESDEvent*)lESDevent)->GetTrack(iCurrentTrack);
193 // kITSrefit refit condition: Global Track
194 if( !(lThisTrack->GetStatus() & AliESDtrack::kITSrefit)) continue;
197 //----- End Loop on Tracks ----------------------------------------------------------
199 fHistNEvents->Fill(0.5); // valid event
200 fNGlobalTracks = lNGlobalTracks;
202 fRunNumber = lESDevent->GetRunNumber();
204 //Gymnastics to get the chunk number...
205 TString lFileName = CurrentFileName();
206 // TObjArray *lLocationArray = lFileName.Tokenize("/");
207 fFileName = fInputHandler->GetTree()->GetCurrentFile()->GetName();
208 // delete lLocationArray;
211 //Printf("%i in run %i, Nglob = %i, Ntrack = %i \n",fChunkNumber,fRunNumber,fNGlobalTracks,fNTracks);
218 //________________________________________________________________________
219 void AliAnalysisTaskBadChunkID::Terminate(Option_t *)
221 // Draw result to the screen
222 // Called once at the end of the query
224 // Not interesting at this point.