--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// Various utilities usefull for analysis
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include "AliAnalysisDataContainer.h"
+#include "AliTagAnalysis.h"
+#include "AliEventTagCuts.h"
+#include "AliRunTagCuts.h"
+#include "AliXMLCollection.h"
+#include "AliAnalysisGoodies.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisTask.h"
+ //#include "AliPhotonAnalysisTask.h"
+#include "AliLog.h"
+
+#include <Riostream.h>
+#include <TAlienCollection.h>
+#include <TChain.h>
+#include <TFileMerger.h>
+#include <TGrid.h>
+#include <TROOT.h>
+#include <TSystem.h>
+
+
+//______________________________________________________________________________
+AliAnalysisGoodies::AliAnalysisGoodies() :
+ fESDTreeName("esdTree"),
+ fnumberOfTasks(0),
+ fTaskList(0),
+ fTaskInType(0),
+ fTaskOuType(0)
+{
+ fTimer.Reset() ;
+
+ TString token = gSystem->Getenv("GRID_TOKEN") ;
+
+ if ( token == "OK" )
+ TGrid::Connect("alien://");
+ else
+ AliInfo("You are not connected to the GRID") ;
+}
+
+//______________________________________________________________________________
+void AliAnalysisGoodies::Help() const
+{
+ AliInfo("Analysis utilities:\n") ;
+ printf(" *** Copy : copy files ESD files listed in an xml collection from AliEn catalog to local storage and creates a local xml collection \n") ;
+ printf(" usage: Copy(in, out)\n") ;
+ printf(" in: a xml esd collection file name \n") ;
+ printf(" ou: the local directory where to save the esd root files \n") ;
+ printf(" *** Make : makes esd collection from tags \n") ;
+ printf(" usage: Make(tags, esds)\n") ;
+ printf(" tags: is either a tag root file or an xml tag collection \n") ;
+ printf(" esds: is an esd collection \n") ;
+ printf(" *** Merge : merges files listed in a xml collection \n") ;
+ printf(" usage Merge(collection, outputDile)\n") ;
+ printf(" collection: is a xml collection \n") ;
+ printf(" *** Process : process the events with an Analysis Task \n") ;
+ printf(" usage: Process(esdFile, tagCuts) \n") ;
+ printf(" esdFile: can be a root file with the ESD Tree ( ex: esd?AliESDs.root) \n") ;
+ printf(" or a root file with the Tag Tree ( ex: tag?Run100.Event0_100.ESD.tag.root) \n") ;
+ printf(" or a local or alien xml file with the ESD collection ( ex: esd?esdCollection.xml) \n") ;
+ printf(" or a local or alien xml file with the TAG collection ( ex: tag?tagCollection.xml) \n") ;
+ printf(" or a TChain of esd TTrees \n") ;
+ printf(" tagCuts: is the AliEventTagCuts (needed only for tag? cases \n") ;
+ printf(" *** Register: register files already stored in a MSS into the AliEn catalog\n") ;
+ printf(" usage: Register(lfndir, pfndir, pfnFileName) \n") ;
+ printf(" lfndir : AliEn directory ( ex: /alice/data/2006/LHC06c/PHOS_TestBeam/\n") ;
+ printf(" pfndir : MSS directory ( ex: /castor/cern.ch/alice/testbeam/phos/2006 \n") ;
+ printf(" file : text file with a list of the file names to be registered\n ") ;
+
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Alien2Local(const TString collectionNameIn, const TString localDir)
+{
+ // copy files ESD files listed in an xml collection from AliEn catalog to local storage and creates a local xml collection
+ // usage: Alien2Local(in, out)
+ // in: a xml esd collection file name
+ // ou: the local directory where to save the esd root files
+
+ Bool_t rv = kTRUE ;
+
+ fTimer.Start() ;
+
+ AliXMLCollection collectionIn(collectionNameIn) ;
+
+ AliXMLCollection * collectionOu = new AliXMLCollection() ;
+ TString collectionNameOu(collectionIn.GetCollectionName()) ;
+ collectionNameOu.Append("Local") ;
+ collectionOu->SetCollectionName(collectionNameOu) ;
+ collectionOu->WriteHeader() ;
+
+ TFileMerger merger ;
+
+ const char* ocwd = gSystem->WorkingDirectory();
+
+ while ( collectionIn.Next() ) {
+ gSystem->ChangeDirectory(localDir) ;
+ TString fileTURL = collectionIn.GetTURL() ;
+
+ TString tempo(fileTURL) ;
+ tempo.Remove(tempo.Last('/'), tempo.Length()) ;
+ TString evtsNumber = tempo(tempo.Last('/')+1, tempo.Length())+"/";
+ tempo.Remove(tempo.Last('/'), tempo.Length()) ;
+ TString runNumber = tempo(tempo.Last('/')+1, tempo.Length())+"/" ;
+ TString dir = localDir + runNumber ;
+ gSystem->MakeDirectory(dir) ;
+ gSystem->ChangeDirectory(dir) ;
+ dir += evtsNumber + "/";
+ gSystem->MakeDirectory(dir) ;
+ gSystem->ChangeDirectory(dir) ;
+ dir += collectionIn.GetFileName() ;
+ TEventList * list = collectionIn.GetEventList() ;
+
+ collectionOu->WriteBody(collectionIn.GetCurrentEvent(), collectionIn.GetGUID(), collectionIn.GetLFN(), collectionIn.GetTURL(), list) ;
+
+ printf("Copying %s to %s\n", fileTURL.Data(), dir.Data()) ;
+ merger.Cp(fileTURL, dir) ;
+ }
+ collectionOu->Export() ;
+ gSystem->ChangeDirectory(ocwd) ;
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Make(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const
+{
+ // makes esd collection from tags
+ // usage Make(tags, esds)
+ // tags: is either a tag root file or an xml tag collection
+ // esds: is an esd collection
+
+ Bool_t rv = kTRUE ;
+
+ if ( !evtCuts && !runCuts ) {
+ AliError("No Tag cuts provided") ;
+ return kFALSE ;
+ }
+
+ TString file(in) ;
+ if ( file.Contains(".root") )
+ rv = MakeEsdCollectionFromTagFile(runCuts, evtCuts, file.Data(), out) ;
+ else if ( file.Contains(".xml") )
+ rv = MakeEsdCollectionFromTagCollection(runCuts, evtCuts, file.Data(), out) ;
+ else {
+ AliError(Form("%s is not a valid file format", in)) ;
+ rv = kFALSE ;
+ }
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagFile(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const
+{
+ // Makes an esd collection from a root tag file
+ Bool_t rv = kTRUE ;
+ // Open the file collection
+ printf("*** Create Collection ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** file = |%s| \n",in);
+
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ rv = tagAna->AddTagsFile(in);
+ if ( ! rv )
+ return rv ;
+
+ tagAna->CreateXMLCollection(out, runCuts, evtCuts) ;
+
+ return rv ;
+
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts, const char * in, const char * out) const
+{
+ // Makes an esd collection from a xml tag collection
+ Bool_t rv = kTRUE ;
+ // Open the file collection
+ printf("*** Create Collection ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",in);
+
+ TAlienCollection * collection = TAlienCollection::Open(in);
+ TGridResult* result = collection->GetGridResult("");
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ tagAna->ChainGridTags(result);
+
+ tagAna->CreateXMLCollection(out, runCuts, evtCuts) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(const char * runCuts, const char * evtCuts, const char * in, const char * out) const
+{
+ // Makes an esd collection from a xml tag collection
+ Bool_t rv = kTRUE ;
+ // Open the file collection
+ printf("*** Create Collection ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",in);
+
+ TAlienCollection * collection = TAlienCollection::Open(in);
+ TGridResult* result = collection->GetGridResult("");
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ tagAna->ChainGridTags(result);
+
+ tagAna->CreateXMLCollection(out, runCuts, evtCuts) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Merge(const char * collectionFile, const char * subFile, const char * outFile)
+{
+ // merges files listed in a xml collection
+ // usage Merge(collection, outputFile))
+ // collection: is a xml collection
+
+ Bool_t rv = kFALSE ;
+
+ if ( strstr(collectionFile, ".xml") == 0 ) {
+ AliError("Input collection file must be an \".xml\" file\n") ;
+ return kFALSE ;
+ }
+
+ fTimer.Start() ;
+
+ // Open the file collection
+ printf("*** Create Collection ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",collectionFile);
+
+ TAlienCollection * collection = TAlienCollection::Open(collectionFile);
+ TGridResult* result = collection->GetGridResult("");
+
+ Int_t index = 0 ;
+ const char * turl ;
+ TFileMerger merger ;
+ if (!outFile) {
+ TString tempo(collectionFile) ;
+ if ( subFile)
+ tempo.ReplaceAll(".xml", subFile) ;
+ else
+ tempo.ReplaceAll(".xml", "_Merged.root") ;
+ outFile = tempo.Data() ;
+ }
+ merger.OutputFile(outFile) ;
+
+ while ( (turl = result->GetKey(index, "turl")) ) {
+ char file[2048] ;
+ if ( subFile )
+ sprintf(file, "%s#%s", turl, subFile) ;
+ else
+ sprintf(file, "%s", turl) ;
+
+ printf("%s\n", file) ;
+ merger.AddFile(file) ;
+ index++ ;
+ }
+
+ if (index)
+ merger.Merge() ;
+
+ AliInfo(Form("Files merged into %s\n", outFile)) ;
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Process(TChain * chain)
+{
+ // process events starting from a chain of esd Trees
+ Bool_t rv = kFALSE ;
+
+ fTimer.Start() ;
+
+ rv = ProcessChain(chain) ;
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Process(const char * inFile)
+{
+ // process the events with an Analysis Task
+ // usage Process(esdFile)
+ // esdFile: is of the form opt?file_lfn
+ Bool_t rv = kFALSE ;
+ AliRunTagCuts * runCuts = 0x0 ;
+ AliEventTagCuts * evtCuts = 0x0 ;
+
+ rv = Process(inFile, runCuts, evtCuts) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Process(const char * inFile, AliRunTagCuts *runCuts, AliEventTagCuts * evtCuts )
+{
+ // process the events with an Analysis Task
+ // usage Process(esdFile, runtagCuts, evtTagCuts)
+ // esdFile: is of the form opt?file_lfn
+
+ Bool_t rv = kFALSE ;
+
+ fTimer.Start() ;
+
+ TString file(inFile) ;
+ if ( file.Contains("esd?") && file.Contains(".root") ) {
+ file.ReplaceAll("esd?", "") ;
+ rv = ProcessEsdFile(file.Data()) ;
+
+ } else if ( file.Contains("esd?") && file.Contains(".xml") ) {
+ file.ReplaceAll("esd?", "") ;
+ rv = ProcessEsdXmlCollection(file.Data()) ;
+
+ } else if (file.Contains("tag?") && file.Contains(".root") ) {
+ file.ReplaceAll("tag?", "") ;
+ rv = ProcessTagFile(file.Data(), runCuts, evtCuts) ;
+
+ } else if (file.Contains("tag?") && file.Contains(".xml") ) {
+ file.ReplaceAll("tag?", "") ;
+ rv = ProcessTagXmlCollection(file.Data(), runCuts, evtCuts) ;
+
+ } else {
+ AliError(Form("%s is not a valid file format", inFile)) ;
+ rv = kFALSE ;
+ }
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Process(const char * inFile, const char * runCuts, const char * evtCuts)
+{
+ // process the events with an Analysis Task
+ // usage Process(esdFile, runtagCuts, evtTagCuts)
+ // esdFile: is of the form opt?file_lfn
+
+ Bool_t rv = kFALSE ;
+
+ fTimer.Start() ;
+
+ TString file(inFile) ;
+ if ( file.Contains("esd?") && file.Contains(".root") ) {
+ file.ReplaceAll("esd?", "") ;
+ rv = ProcessEsdFile(file.Data()) ;
+
+ } else if ( file.Contains("esd?") && file.Contains(".xml") ) {
+ file.ReplaceAll("esd?", "") ;
+ rv = ProcessEsdXmlCollection(file.Data()) ;
+
+ } else if (file.Contains("tag?") && file.Contains(".root") ) {
+ file.ReplaceAll("tag?", "") ;
+ rv = ProcessTagFile(file.Data(), runCuts, evtCuts) ;
+
+ } else if (file.Contains("tag?") && file.Contains(".xml") ) {
+ file.ReplaceAll("tag?", "") ;
+ rv = ProcessTagXmlCollection(file.Data(), runCuts, evtCuts) ;
+
+ } else {
+ AliError(Form("%s is not a valid file format", inFile)) ;
+ rv = kFALSE ;
+ }
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessChain(TChain * chain) const
+{
+ // Procees a TChain.
+
+ Bool_t rv = kTRUE ;
+
+ if (! fTaskList ) {
+ AliError("No tasks defined") ;
+ return kFALSE ;
+ }
+
+ // Make the analysis manager
+ AliAnalysisManager * mgr = new AliAnalysisManager() ;
+
+ // Make tasks
+ // The top input must be common to all top tasks
+ TClass * classIn = fTaskInType[0] ;
+ AliAnalysisDataContainer * taskInput = mgr->CreateContainer("Input Container", classIn, AliAnalysisManager::kInputContainer) ;
+ Int_t index ;
+ for (index = 0; index < fnumberOfTasks; index++) {
+ AliAnalysisTask * task = fTaskList[index] ;
+ mgr->AddTask(task) ;
+
+ // Create containers for input/output
+ TClass * classOu = fTaskOuType[index] ;
+ AliAnalysisDataContainer * taskOutput = mgr->CreateContainer("Output Container", classOu, AliAnalysisManager::kOutputContainer) ;
+ mgr->ConnectInput (task, 0, taskInput);
+ mgr->ConnectOutput(task, 0, taskOutput);
+ }
+
+ // Open data
+ taskInput->SetData(chain);
+
+ if (mgr->InitAnalysis()) {
+ mgr->PrintStatus();
+ chain->Process(mgr);
+ } else
+ rv = kFALSE ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessEsdFile(const char * esdFile) const
+{
+ // process the events in a single ESD file with an Analysis Task
+ // usage ProcessLocalEsdFile(esdFile)
+ // esdFile: is the root file (local or in alien) with the ESD Tree ( ex: AliESDs.root)
+
+ Bool_t rv = kTRUE ;
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",esdFile);
+
+ // Makes the ESD chain
+ printf("*** Getting the Chain ***\n");
+ TChain* analysisChain = new TChain(fESDTreeName) ;
+ analysisChain->AddFile(esdFile);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts) const
+{
+ // process the events in a single Tag file with an Analysis Task
+ // usage ProcessLocalEsdFile(tagFile)
+ // tagFile: is the root file (local or in alien) with the Tag Tree (ex: Run102.Event0_100.ESD.tag.root)
+
+ Bool_t rv = kTRUE ;
+
+ if ( !evtCuts && !runCuts ) {
+ AliError("No Tag cuts provided") ;
+ return kFALSE ;
+ }
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",tagFile);
+
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ rv = tagAna->AddTagsFile(tagFile);
+ if ( ! rv )
+ return rv ;
+
+ // Query the tag file and make the analysis chain
+ TChain * analysisChain = new TChain(fESDTreeName) ;
+ analysisChain = tagAna->QueryTags(runCuts, evtCuts);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, const char * runCuts, const char * evtCuts) const
+{
+ // process the events in a single Tag file with an Analysis Task
+ // usage ProcessLocalEsdFile(tagFile)
+ // tagFile: is the root file (local or in alien) with the Tag Tree (ex: Run102.Event0_100.ESD.tag.root)
+
+ Bool_t rv = kTRUE ;
+
+ if ( !evtCuts && !runCuts ) {
+ AliError("No Tag cuts provided") ;
+ return kFALSE ;
+ }
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",tagFile);
+
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ rv = tagAna->AddTagsFile(tagFile);
+ if ( ! rv )
+ return rv ;
+
+ // Query the tag file and make the analysis chain
+ TChain * analysisChain = new TChain(fESDTreeName) ;
+ analysisChain = tagAna->QueryTags(runCuts, evtCuts);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessEsdXmlCollection(const char * xmlFile) const
+{
+ // process the events in a xml ESD collection with an Analysis Task
+ // usage ProcessLocalEsdFile(xmlFile)
+ // xmlFile: is the local xml file with the ESD collection ( ex: esdCollection.xml)
+
+ Bool_t rv = kTRUE ;
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",xmlFile);
+
+ TAlienCollection * collection = TAlienCollection::Open(xmlFile) ;
+ if (! collection) {
+ AliError(Form("%s not found", xmlFile)) ;
+ return kFALSE ;
+ }
+
+ TGridResult* result = collection->GetGridResult("");
+ TList* analysisfilelist = result->GetFileInfoList();
+
+ // Makes the ESD chain
+ printf("*** Getting the Chain ***\n");
+ TChain* analysisChain = new TChain(fESDTreeName);
+ analysisChain->AddFileInfoList(analysisfilelist);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, AliRunTagCuts *runCuts, AliEventTagCuts * evtCuts) const
+{
+ // process the events in a xml ESD collection with an Analysis Task
+ // usage ProcessLocalEsdFile(xmlFile)
+ // xmlFile: is the local xml file with the tag collection ( ex: tagCollection.xml)
+
+ Bool_t rv = kTRUE ;
+
+ if ( !evtCuts && !runCuts ) {
+ AliError("No Tag cuts provided") ;
+ return kFALSE ;
+ }
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",xmlFile);
+
+ // check if file is local or alien
+ if ( gSystem->AccessPathName(xmlFile) )
+ TGrid::Connect("alien://");
+
+ TAlienCollection * collection = TAlienCollection::Open(xmlFile) ;
+ if (! collection) {
+ AliError(Form("%s not found", xmlFile)) ;
+ return kFALSE ;
+ }
+
+ TGridResult* result = collection->GetGridResult("");
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ tagAna->ChainGridTags(result);
+
+ // Query the tag file and make the analysis chain
+ TChain * analysisChain = new TChain(fESDTreeName) ;
+ analysisChain = tagAna->QueryTags(runCuts, evtCuts);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, const char * runCuts, const char * evtCuts) const
+{
+ // process the events in a xml ESD collection with an Analysis Task
+ // usage ProcessLocalEsdFile(xmlFile)
+ // xmlFile: is the local xml file with the tag collection ( ex: tagCollection.xml)
+
+ Bool_t rv = kTRUE ;
+
+ if ( !evtCuts && !runCuts ) {
+ AliError("No Tag cuts provided") ;
+ return kFALSE ;
+ }
+
+ printf("*** Process ***\n");
+ printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory());
+ printf("*** Coll = |%s| \n",xmlFile);
+
+ // check if file is local or alien
+ if ( gSystem->AccessPathName(xmlFile) )
+ TGrid::Connect("alien://");
+
+ TAlienCollection * collection = TAlienCollection::Open(xmlFile) ;
+ if (! collection) {
+ AliError(Form("%s not found", xmlFile)) ;
+ return kFALSE ;
+ }
+
+ TGridResult* result = collection->GetGridResult("");
+ AliTagAnalysis * tagAna = new AliTagAnalysis();
+ tagAna->ChainGridTags(result);
+
+ // Query the tag file and make the analysis chain
+ TChain * analysisChain = new TChain(fESDTreeName) ;
+ analysisChain = tagAna->QueryTags(runCuts, evtCuts);
+
+ // Process the events
+ rv = ProcessChain(analysisChain) ;
+
+ return rv ;
+}
+
+//______________________________________________________________________
+const Bool_t AliAnalysisGoodies::Register( const char * lfndir, const char * pfndir, const char * file)
+{
+ // register files already stored in a MSS into the AliEn catalog
+ // usage: Register(lfndir, pfndir, pfnFileName)
+ // lfndir : AliEn directory ( ex: /alice/data/2006/LHC06c/PHOS_TestBeam/ )
+ // pfndir : MSS directory ( ex: /castor/cern.ch/alice/testbeam/phos/2006 )
+ // file : text file with a list of the file names to be registered
+
+ Bool_t rv = kTRUE ;
+ fTimer.Start() ;
+
+ ifstream in;
+ in.open(file);
+ if ( in.bad() ) {
+ AliError(Form("Cannot open file %s\n", file)) ;
+ return kFALSE ;
+ }
+
+ TGrid::Connect("alien://");
+
+ char fileName[1024] ;
+
+ while (1) {
+ in >> fileName ;
+ if (!in.good())
+ break;
+ char lfn[1024] ;
+
+ sprintf(lfn, "%s/%s", lfndir, fileName) ;
+
+ char pfn[1024] ;
+
+ sprintf(pfn, "castor://Alice::CERN::Castor2/%s/%s", pfndir, fileName) ;
+
+ printf("Register %s as %s\n", pfn, lfn) ;
+
+ gGrid->Register(lfn, pfn) ;
+ }
+
+ fTimer.Stop();
+ fTimer.Print();
+
+ return rv;
+}
+
+//______________________________________________________________________
+void AliAnalysisGoodies::SetTasks(Int_t nb, AliAnalysisTask ** taskList, TClass ** inputType, TClass ** outputType)
+{
+ // define a task with its output and input type
+
+
+ fnumberOfTasks= nb;
+ fTaskList = taskList ;
+ fTaskInType = inputType ;
+ fTaskOuType = outputType ;
+}
--- /dev/null
+#ifndef ALIANALYSISGOODIES_H
+#define ALIANALYSISGOODIES_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// Various utilities usefull for analysis
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TStopwatch.h>
+#include <TString.h>
+
+class AliAnalysisTask ;
+class TChain ;
+class TClass ;
+class AliEventTagCuts ;
+class AliRunTagCuts ;
+
+class AliAnalysisGoodies : public TObject {
+
+public:
+ AliAnalysisGoodies() ;
+ ~AliAnalysisGoodies() {;}
+
+ virtual void Help() const;
+ const Bool_t Alien2Local(const TString collectionNameIn, const TString localDir) ;
+ const Bool_t Make(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const ;
+ const Bool_t Merge(const char * collection, const char * subFile = 0, const char * outFile = 0) ;
+ const Bool_t Register( const char * lfndir, const char * pfndir, const char * file) ;
+ const Bool_t Process(TChain * chain) ;
+ const Bool_t Process(const char * esdFile) ;
+ const Bool_t Process(const char * esdFile, AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts) ;
+ const Bool_t Process(const char * esdFile, const char * runCuts, const char * evtCuts) ;
+ void SetESDTreeName(const char * name) { fESDTreeName = name ; }
+ void SetTasks(Int_t nb, AliAnalysisTask ** taskList, TClass ** inputType, TClass ** outputType) ;
+ const Bool_t MakeEsdCollectionFromTagFile(AliRunTagCuts * runCuts, AliEventTagCuts * evCuts, const char * in, const char * out) const ;
+
+private:
+ const Bool_t MakeEsdCollectionFromTagFile(const char * runCuts, const char * evCuts, const char * in, const char * out) const ;
+ const Bool_t MakeEsdCollectionFromTagCollection(AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts, const char * in, const char * out) const ;
+ const Bool_t MakeEsdCollectionFromTagCollection(const char * runCuts, const char * evtCuts, const char * in, const char * out) const ;
+ const Bool_t ProcessChain(TChain * chain) const ;
+ const Bool_t ProcessEsdFile(const char * esdFile) const ;
+ const Bool_t ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts) const ;
+ const Bool_t ProcessTagFile(const char * tagFile, const char * runCuts, const char * evtCuts) const ;
+ const Bool_t ProcessEsdXmlCollection(const char * esdFile) const ;
+ const Bool_t ProcessTagXmlCollection(const char * esdFile, AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts) const ;
+ const Bool_t ProcessTagXmlCollection(const char * esdFile, const char * runCuts, const char * evtCuts) const ;
+
+ TStopwatch fTimer ; //! stopwatch
+ TString fESDTreeName ; //! name of the ESD TTree
+ UShort_t fnumberOfTasks ; //! number of tasks
+ AliAnalysisTask ** fTaskList ; //! list of tasks
+ TClass ** fTaskInType ; //! list of tasks input
+ TClass ** fTaskOuType ; //! list of tasks output
+
+ ClassDef(AliAnalysisGoodies, 0); // an analysis utilities class
+};
+#endif // ALIANALYSISGOODIES_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// A test analysis task to check the pt of tracks distribution in simulated data
+//
+//*-- Panos
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1.h>
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TSystem.h>
+
+#include "AliAnalysisTaskPt.h"
+#include "AliESD.h"
+#include "AliLog.h"
+
+//________________________________________________________________________
+AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name) :
+ AliAnalysisTask(name,""),
+ fESD(0),
+ fhPt(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class());
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPt::Init(Option_t *)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+
+ fhPt = new TH1F("fhPt","This is the Pt distribution",15,0.1,3.1);
+ fhPt->SetStats(kTRUE);
+ fhPt->GetXaxis()->SetTitle("P_{T} [GeV]");
+ fhPt->GetYaxis()->SetTitle("#frac{dN}{dP_{T}}");
+ fhPt->GetXaxis()->SetTitleColor(1);
+ fhPt->SetMarkerStyle(kFullCircle);
+
+ // create output container
+
+ fOutputContainer = new TObjArray(1) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhPt, 0) ;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPt::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ //************************ Pt tracks *************************************
+
+ for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
+ AliESDtrack * ESDTrack = fESD->GetTrack(iTracks);
+ Double_t momentum[3];
+ ESDTrack->GetPxPyPz(momentum);
+ Double_t Pt = sqrt(pow(momentum[0],2) + pow(momentum[1],2));
+ fhPt->Fill(Pt);
+ }//track loop
+
+ PostData(0, fOutputContainer);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPt::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ TCanvas *c1 = new TCanvas("c1","Pt",10,10,310,310);
+ c1->SetFillColor(10);
+ c1->SetHighLightColor(10);
+
+ c1->cd(1)->SetLeftMargin(0.15);
+ c1->cd(1)->SetBottomMargin(0.15);
+ c1->cd(1)->SetLogy();
+ fhPt->DrawCopy("E");
+
+ c1->Print("TracksPt.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIANALYSISTASKPT_H
+#define ALIANALYSISTASKPT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// A test analysis task to check the pt of tracks distribution in simulated data
+//
+//*-- Panos
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TH1 ;
+
+class AliAnalysisTaskPt : public AliAnalysisTask {
+
+public:
+ AliAnalysisTaskPt(const char *name);
+ virtual ~AliAnalysisTaskPt() {}
+
+ virtual void Init(Option_t * opt = "");
+ virtual void Exec(Option_t * opt = "");
+ virtual void Terminate(Option_t * opt = "");
+
+private:
+ TTree * fChain ; //! pointer to the analyzed TTree or TChain
+ AliESD * fESD; //! ESD object
+ TH1F * fhPt; //! Pt spectrum
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ ClassDef(AliAnalysisTaskPt, 0); // example of analysis
+};
+#endif // ALIANALYSISTASKPT_H
+
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the EMCAL photon data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1.h>
+#include <TH1F.h>
+#include <TH1I.h>
+#include <TNtuple.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TVector3.h>
+#include <TFile.h>
+
+#include "AliEMCALQATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliEMCALQATask::AliEMCALQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhEMCALPos(0),
+ fhEMCAL(0),
+ fhEMCALEnergy(0),
+ fhEMCALDigits(0),
+ fhEMCALRecParticles(0),
+ fhEMCALPhotons(0),
+ fhEMCALInvariantMass(0),
+ fhEMCALDigitsEvent(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliEMCALQATask::~AliEMCALQATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhEMCALPos ;
+ delete fhEMCAL ;
+ delete fhEMCALEnergy ;
+ delete fhEMCALDigits ;
+ delete fhEMCALRecParticles ;
+ delete fhEMCALPhotons ;
+ delete fhEMCALInvariantMass ;
+ delete fhEMCALDigitsEvent ;
+}
+
+//______________________________________________________________________________
+void AliEMCALQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+
+ fhEMCALPos = new TNtuple("EMCALPos" , "Position in EMCAL" , "x:y:z");
+ fhEMCAL = new TNtuple("EMCAL" , "EMCAL" , "event:digits:clusters:photons");
+ fhEMCALEnergy = new TH1D("EMCALEnergy" , "EMCALEnergy" , 1000, 0., 10. ) ;
+ fhEMCALDigits = new TH1I("EMCALDigitsCluster" , "EMCALDigits" , 20 , 0 , 20 ) ;
+ fhEMCALRecParticles = new TH1D("EMCALRecParticles" , "EMCALRecParticles", 20 , 0., 20. ) ;
+ fhEMCALPhotons = new TH1I("EMCALPhotons" , "EMCALPhotons" , 20 , 0 , 20 ) ;
+ fhEMCALInvariantMass = new TH1D("EMCALInvariantMass" , "EMCALInvariantMass", 400, 0., 400.) ;
+ fhEMCALDigitsEvent = new TH1I("EMCALDigitsEvent" , "EMCALDigitsEvent" , 30 , 0 , 30 ) ;
+
+ // create output container
+
+ fOutputContainer = new TObjArray(8) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhEMCALPos, 0) ;
+ fOutputContainer->AddAt(fhEMCAL, 1) ;
+ fOutputContainer->AddAt(fhEMCALEnergy, 2) ;
+ fOutputContainer->AddAt(fhEMCALDigits, 3) ;
+ fOutputContainer->AddAt(fhEMCALRecParticles, 4) ;
+ fOutputContainer->AddAt(fhEMCALPhotons, 5) ;
+ fOutputContainer->AddAt(fhEMCALInvariantMass, 6) ;
+ fOutputContainer->AddAt(fhEMCALDigitsEvent, 7) ;
+}
+
+//______________________________________________________________________________
+void AliEMCALQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ //************************ EMCAL *************************************
+ Int_t firstEmcalCluster = fESD->GetFirstEMCALCluster() ;
+ const Int_t mumberOfEmcalClusters = fESD->GetNumberOfEMCALClusters() ;
+
+ TVector3 ** emcalVector = new TVector3*[mumberOfEmcalClusters] ;
+ Float_t * emcalPhotonsEnergy = new Float_t[mumberOfEmcalClusters] ;
+ Int_t emcalCluster ;
+ Int_t numberOfEmcalClustersv1 = 0 ;
+ Int_t numberOfPhotonsInEmcal = 0 ;
+ Int_t numberOfDigitsInEmcal = 0 ;
+
+
+ // loop over all the EMCAL Cluster
+ for(emcalCluster = firstEmcalCluster ; emcalCluster < firstEmcalCluster + mumberOfEmcalClusters ; emcalCluster++) {
+ AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(emcalCluster) ;
+ if (caloCluster) {
+ Float_t pos[3] ;
+ fhEMCALPos->Fill(pos[0],pos[1],pos[2]) ;
+ if(caloCluster->GetClusterType() == AliESDCaloCluster::kClusterv1) {
+ caloCluster->GetGlobalPosition(pos) ;
+ fhEMCALEnergy->Fill(caloCluster->GetClusterEnergy()) ;
+ fhEMCALDigits->Fill(entry, caloCluster->GetNumberOfDigits()) ;
+ numberOfEmcalClustersv1++ ;
+ numberOfDigitsInEmcal += caloCluster->GetNumberOfDigits() ;
+ // Float_t * pid = clus->GetPid() ;
+ // if(pid[AliPID::kPhoton]>0.9){
+ emcalVector[numberOfPhotonsInEmcal] = new TVector3(pos[0],pos[1],pos[2]) ;
+ emcalPhotonsEnergy[numberOfPhotonsInEmcal] = caloCluster->GetClusterEnergy() ;
+ numberOfPhotonsInEmcal++ ;
+ }
+ }
+ } // EMCAL clusters loop
+
+ fhEMCALRecParticles->Fill(numberOfEmcalClustersv1);
+ fhEMCALPhotons->Fill(numberOfPhotonsInEmcal);
+ fhEMCALDigitsEvent->Fill(numberOfDigitsInEmcal);
+ fhEMCAL->Fill(entry, numberOfDigitsInEmcal, numberOfEmcalClustersv1, numberOfPhotonsInEmcal) ;
+
+ // invariant Mass
+ if (numberOfPhotonsInEmcal > 1 ) {
+ Int_t emcalPhoton1, emcalPhoton2 ;
+ for(emcalPhoton1 = 0 ; emcalPhoton1 < numberOfPhotonsInEmcal ; emcalPhoton1++) {
+ for(emcalPhoton2 = emcalPhoton1 + 1 ; emcalPhoton2 < numberOfPhotonsInEmcal ; emcalPhoton2++) {
+ Float_t tempMass = TMath::Sqrt( 2 * emcalPhotonsEnergy[emcalPhoton1] * emcalPhotonsEnergy[emcalPhoton2] *
+ ( 1 - TMath::Cos( emcalVector[emcalPhoton1]->Angle(*emcalVector[emcalPhoton2]))
+ )
+ );
+ fhEMCALInvariantMass->Fill(tempMass*1000.);
+ }
+ }
+ }
+
+ PostData(0, fOutputContainer);
+
+ delete [] emcalVector ;
+ delete [] emcalPhotonsEnergy ;
+}
+
+//______________________________________________________________________________
+void AliEMCALQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ printf("EMCALEnergy Mean : %5.3f , RMS : %5.3f \n", fhEMCALEnergy->GetMean(), fhEMCALEnergy->GetRMS() ) ;
+ printf("EMCALDigits Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigits->GetMean(), fhEMCALDigits->GetRMS() ) ;
+ printf("EMCALRecParticles Mean : %5.3f , RMS : %5.3f \n", fhEMCALRecParticles->GetMean(), fhEMCALRecParticles->GetRMS() ) ;
+ printf("EMCALPhotons Mean : %5.3f , RMS : %5.3f \n", fhEMCALPhotons->GetMean(), fhEMCALPhotons->GetRMS() ) ;
+ printf("EMCALInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhEMCALInvariantMass->GetMean(), fhEMCALInvariantMass->GetRMS() ) ;
+ printf("EMCALDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigitsEvent->GetMean(), fhEMCALDigitsEvent->GetRMS() ) ;
+
+ TCanvas * cEMCAL = new TCanvas("EMCAL", "EMCAL ESD Test", 400, 10, 600, 700);
+ cEMCAL->Divide(3, 2) ;
+
+ cEMCAL->cd(1) ;
+ gPad->SetLogy();
+ fhEMCALEnergy->SetAxisRange(0, 25.);
+ fhEMCALEnergy->SetXTitle("Energy (GeV)");
+ fhEMCALEnergy->Draw();
+
+ cEMCAL->cd(2) ;
+ gPad->SetLogy();
+ fhEMCALDigits->SetAxisRange(0, 25.);
+ fhEMCALDigits->SetXTitle("DigitsPerCluster");
+ fhEMCALDigits->Draw();
+
+ cEMCAL->cd(3) ;
+ gPad->SetLogy();
+ fhEMCALRecParticles->SetAxisRange(0, 25.);
+ fhEMCALRecParticles->SetXTitle("RecParticles");
+ fhEMCALRecParticles->Draw();
+
+ cEMCAL->cd(4) ;
+ gPad->SetLogy();
+ fhEMCALPhotons->SetAxisRange(0, 25.);
+ fhEMCALPhotons->SetXTitle("Photons");
+ fhEMCALPhotons->Draw();
+
+ cEMCAL->cd(5) ;
+ fhEMCALInvariantMass->SetXTitle("InvariantMass (MeV/c²)");
+ fhEMCALInvariantMass->Draw();
+
+ cEMCAL->cd(6) ;
+ gPad->SetLogy();
+ fhEMCALDigitsEvent->SetAxisRange(0, 40.);
+ fhEMCALDigitsEvent->SetXTitle("DigitsPerEvent");
+ fhEMCALDigitsEvent->Draw();
+
+ cEMCAL->Print("EMCAL.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIEMCALQATASK_H
+#define ALIEMCALQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the EMCAL photon data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TNtuple ;
+class TH1D ;
+class TH1I ;
+
+class AliEMCALQATask : public AliAnalysisTask {
+
+public:
+ AliEMCALQATask(const char *name) ;
+ virtual ~AliEMCALQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+ TNtuple * fhEMCALPos ;
+ TNtuple * fhEMCAL ;
+ TH1D * fhEMCALEnergy ;
+ TH1I * fhEMCALDigits ;
+ TH1D * fhEMCALRecParticles ;
+ TH1I * fhEMCALPhotons ;
+ TH1D * fhEMCALInvariantMass ;
+ TH1I * fhEMCALDigitsEvent ;
+
+ ClassDef(AliEMCALQATask, 0); // a EMCAL photon analysis task
+};
+#endif // ALIEMCALQATASK_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the FMD data in simulated data
+//
+//*-- Hans Hjersing Dalsgaard
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TH1D.h>
+#include <TF1.h>
+
+#include "AliFMDQATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliFMDQATask::AliFMDQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhFMD1i(0),
+ fhFMD2i(0),
+ fhFMD2o(0),
+ fhFMD3i(0),
+ fhFMD3o(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliFMDQATask::~AliFMDQATask()
+{
+ // dtor
+
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhFMD1i ;
+ delete fhFMD2i ;
+ delete fhFMD2o ;
+ delete fhFMD3i ;
+ delete fhFMD3o ;
+
+}
+
+//______________________________________________________________________________
+void AliFMDQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+ fhFMD1i = new TH1D("FMD1i", "FMD1i", 100, -0.5, 3);
+ fhFMD2i = new TH1D("FMD2i", "FMD2i", 100, -0.5, 3);
+ fhFMD2o = new TH1D("FMD2o", "FMD2o", 100, -0.5, 3);
+ fhFMD3i = new TH1D("FMD3i", "FMD3i", 100, -0.5, 3);
+ fhFMD3o = new TH1D("FMD3o", "FMD3o", 100, -0.5, 3);
+
+ // create output container
+
+ fOutputContainer = new TObjArray(5) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhFMD1i, 0) ;
+ fOutputContainer->AddAt(fhFMD2i, 1) ;
+ fOutputContainer->AddAt(fhFMD2o, 2) ;
+ fOutputContainer->AddAt(fhFMD3i, 3) ;
+ fOutputContainer->AddAt(fhFMD3o, 4) ;
+}
+
+//______________________________________________________________________________
+void AliFMDQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ FMD *************************************
+
+ AliESDFMD * fmd = fESD->GetFMDData() ;
+
+ Int_t nFMD1 = 0, nFMD2i = 0, nFMD2o = 0, nFMD3i = 0, nFMD3o = 0 ;
+
+ UShort_t detector = 1 ;
+ for(detector = 1 ; detector <= fmd->MaxDetectors() ; detector++) {
+ Char_t ring = 'O' ;
+ UShort_t sector ;
+ for(sector = 0 ;sector < fmd->MaxSectors() ; sector++) {
+ UShort_t strip ;
+ for(strip = 0 ; strip < fmd->MaxStrips(); strip++) {
+ if(fmd->Multiplicity(detector, ring, sector, strip) != AliESDFMD::kInvalidMult)
+ RingSelector(detector, ring, fmd->Multiplicity(detector, ring, sector, strip)) ;
+ if( (fmd->Multiplicity(detector, ring, sector, strip) == AliESDFMD::kInvalidMult) && detector == 2 )
+ nFMD2o++ ;
+ if( (fmd->Multiplicity(detector, ring, sector, strip)==AliESDFMD::kInvalidMult) && detector == 3 )
+ nFMD3o++ ;
+ }
+ }
+ ring='I';
+ for(sector = 0; sector < fmd->MaxSectors(); sector++) {
+ UShort_t strip ;
+ for(strip = 0 ; strip < fmd->MaxStrips() ; strip++) {
+ if(fmd->Multiplicity(detector, ring, sector, strip) != AliESDFMD::kInvalidMult)
+ RingSelector(detector, ring, fmd->Multiplicity(detector, ring, sector, strip));
+ if( (fmd->Multiplicity(detector, ring, sector, strip) == AliESDFMD::kInvalidMult) && detector == 1 )
+ nFMD1++;
+ if( (fmd->Multiplicity(detector, ring, sector, strip) == AliESDFMD::kInvalidMult) && detector == 2 )
+ nFMD2i++;
+ if( (fmd->Multiplicity(detector, ring, sector, strip) == AliESDFMD::kInvalidMult) && detector == 3 )
+ nFMD3i++;
+ }
+ }
+ }
+
+ if(nFMD1>100+10240)
+ AliWarning(Form("number of missing strips in FMD1i too high in event number %lld in file", entry, fChain->GetCurrentFile()->GetName())) ;
+ if(nFMD2i>100+10240)
+ AliWarning(Form("number of missing strips in FMD2i too high in event number %lld in file", entry, fChain->GetCurrentFile()->GetName())) ;
+ if(nFMD2o>100+10240)
+ AliWarning(Form("number of missing strips in FMD2o too high in event number %lld in file", entry, fChain->GetCurrentFile()->GetName())) ;
+ if(nFMD3i>100+10240)
+ AliWarning(Form("number of missing strips in FMD3i too high in event number %lld in file", entry, fChain->GetCurrentFile()->GetName())) ;
+ if(nFMD3o>100+10240)
+ AliWarning(Form("number of missing strips in FMD3o too high in event number %lld in file", entry, fChain->GetCurrentFile()->GetName())) ;
+
+ PostData(0, fOutputContainer);
+}
+
+//______________________________________________________________________________
+void AliFMDQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ TCanvas * cFMD1 = new TCanvas("cFMD1", "FMD ESD Test", 400, 10, 600, 700);
+ cFMD1->Divide(3, 2) ;
+
+ cFMD1->cd(1) ;;
+ fhFMD1i->Draw() ;
+
+ cFMD1->cd(2) ;;
+ fhFMD2i->Draw() ;
+
+ cFMD1->cd(3) ;;
+ fhFMD2o->Draw() ;
+
+ cFMD1->cd(4) ;;
+ fhFMD3i->Draw() ;
+
+ cFMD1->cd(5) ;;
+ fhFMD3o->Draw() ;
+
+ cFMD1->Print("FMD.eps") ;
+
+ Bool_t rv1i = TestHisto(fhFMD1i) ;
+ Bool_t rv2i = TestHisto(fhFMD2i) ;
+ Bool_t rv2o = TestHisto(fhFMD2o) ;
+ Bool_t rv3i = TestHisto(fhFMD2i) ;
+ Bool_t rv3o = TestHisto(fhFMD2o) ;
+
+ if ( !(rv1i * rv2i * rv2o * rv3i * rv3o) )
+ AliWarning("Possible problem in file !!! Check output!") ;
+
+
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
+
+//______________________________________________________________________________
+void AliFMDQATask::RingSelector(const UShort_t detector, const Char_t ring, const Float_t mult) const
+{
+ // fill the histograms for each ring in each detector layer
+
+ if(ring == 'I' && detector == 1)
+ fhFMD1i->Fill(mult) ;
+ if(ring == 'I' && detector == 2)
+ fhFMD2i->Fill(mult) ;
+ if(ring == 'O' && detector == 2)
+ fhFMD2o ->Fill(mult) ;
+ if(ring == 'I' && detector == 3)
+ fhFMD3i ->Fill(mult) ;
+ if(ring == 'O' && detector == 3)
+ fhFMD3o ->Fill(mult) ;
+}
+//______________________________________________________________________________
+Bool_t AliFMDQATask::TestHisto(TH1D * hTest) const
+{
+ // analyses the histogram with a Landau function
+
+ Float_t chiMax = 3, chiLow=0.5 ;
+ Float_t chiSq ;
+ Float_t mpv ;
+ Int_t ndf ;
+
+ FitAll(hTest, chiSq, ndf, mpv, chiMax, chiLow);
+
+ if( (chiSq > chiMax || chiSq < chiLow) || mpv < 0.6 || mpv > 1 ) {
+ hTest->Rebin(2) ;
+ FitAll(hTest, chiSq, ndf, mpv, chiMax, chiLow) ;
+ }
+
+ Bool_t ret = kFALSE ;
+ Char_t * test = "not OK";
+ Char_t * test2 = "not OK";
+
+ if(chiSq < chiMax && chiSq > chiLow)
+ test = "OK" ;
+ if(mpv > 0.6 && mpv < 1)
+ test2 = "OK" ;
+
+ if(test == "OK" && test2 == "OK")
+ ret = kTRUE;
+
+ if(test == "not OK" || test2 == "not OK") {
+ AliWarning("Bad fit results") ;
+ printf("Detector : %s\n", hTest->GetName()) ;
+ printf("Landau fit Chi Square / NDF = %f / %d which is %s\n", chiSq*ndf, ndf, test) ;
+ printf("Landau fit MPV is: %f which is %s\n", mpv, test2) ;
+ }
+ return ret;
+}
+//______________________________________________________________________________
+void AliFMDQATask::FitAll(TH1D* hTest, Float_t &chiSq, Int_t &ndf, Float_t &mpv, Float_t chiMax, Float_t chiLow ) const
+{
+ // fit a histogram with a Landau distribution and returns chi square
+
+ Float_t fitMax = hTest->GetXaxis()->GetXmax() ;
+
+ TH1D hTmp = *hTest ;
+ hTmp.SetAxisRange(0.4,fitMax) ;
+ Int_t maxBin = hTmp.GetMaximumBin();
+ Float_t max = hTmp.GetBinCenter(maxBin);
+
+ hTest->Fit("landau", "QOI", "", max-0.3, fitMax) ;
+ TF1* fitfunc = hTest->GetFunction("landau") ;
+ chiSq = fitfunc->GetChisquare() / fitfunc->GetNDF() ;
+ mpv = fitfunc->GetParameter(1) ;
+ ndf = fitfunc->GetNDF() ;
+
+ if( ( chiSq > chiMax || chiSq < chiLow ) || ( mpv < 0.6 || mpv > 1 ) ) {
+ hTest->Fit("landau", "QOI", "", max-0.2, fitMax) ;
+ fitfunc = hTest->GetFunction("landau") ;
+ chiSq = fitfunc->GetChisquare() / fitfunc->GetNDF() ;
+ mpv = fitfunc->GetParameter(1) ;
+ ndf = fitfunc->GetNDF() ;
+ }
+ if( ( chiSq >chiMax || chiSq < chiLow ) || ( mpv < 0.6 || mpv > 1 ) ) {
+ hTest->Fit("landau", "QOI", "", max-0.1, fitMax) ;
+ fitfunc = hTest->GetFunction("landau") ;
+ chiSq = fitfunc->GetChisquare() / fitfunc->GetNDF() ;
+ mpv = fitfunc->GetParameter(1) ;
+ ndf = fitfunc->GetNDF() ;
+ }
+ if( ( chiSq > chiMax || chiSq <chiLow ) || ( mpv < 0.6 || mpv > 1 ) ) {
+ hTest->Fit("landau", "QOI", "", max, fitMax) ;
+ fitfunc = hTest->GetFunction("landau") ;
+ chiSq = fitfunc->GetChisquare() / fitfunc->GetNDF() ;
+ mpv = fitfunc->GetParameter(1) ;
+ ndf = fitfunc->GetNDF();
+ }
+ if( ( chiSq > chiMax || chiSq < chiLow ) || ( mpv < 0.6 ||mpv > 1 ) ) {
+ hTest->Fit("landau", "QOI", "", max+0.1, fitMax) ;
+ fitfunc = hTest->GetFunction("landau") ;
+ chiSq = fitfunc->GetChisquare() / fitfunc->GetNDF() ;
+ mpv = fitfunc->GetParameter(1) ;
+ ndf = fitfunc->GetNDF() ;
+ }
+}
--- /dev/null
+#ifndef ALIFMDQATASK_H
+#define ALIFMDQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//_________________________________________________________________________
+// An analysis task to check the FMD data in simulated data
+//
+//*-- Hans Hjersing Dalsgaard
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TNtuple ;
+class TH1D ;
+
+class AliFMDQATask : public AliAnalysisTask {
+
+public:
+ AliFMDQATask(const char *name) ;
+ virtual ~AliFMDQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+
+ void RingSelector(const UShort_t detector, const Char_t ring, const Float_t mult) const ;
+ Bool_t TestHisto(TH1D * hTest) const ;
+ void FitAll(TH1D* hTest, Float_t &chiSq, Int_t &ndf, Float_t &mpv, Float_t chiMax, Float_t chiLow ) const ;
+
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+
+ TH1D * fhFMD1i ;//!
+ TH1D * fhFMD2i ;//!
+ TH1D * fhFMD2o ;//!
+ TH1D * fhFMD3i ;//!
+ TH1D * fhFMD3o ;//!
+
+ ClassDef(AliFMDQATask, 0); // a FMD photon analysis task
+};
+#endif // ALIFMDQATASK_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the HMPID data in simulated data
+//
+//*-- Annalisa Mastroserio
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TF1.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TVector3.h>
+#include <TFile.h>
+
+#include "AliHMPIDQATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+#include "AliPID.h"
+
+//______________________________________________________________________________
+AliHMPIDQATask::AliHMPIDQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhHMPIDCkovP(0),
+ fhHMPIDMipXY(0),
+ fhHMPIDDifXY(0),
+ fhHMPIDSigP(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+
+ Int_t i ;
+ for(i = 0 ; i < 5 ; i++)
+ fhHMPIDProb[i]=0;
+}
+
+//______________________________________________________________________________
+AliHMPIDQATask::~AliHMPIDQATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhHMPIDCkovP ;
+ delete fhHMPIDMipXY ;
+ delete fhHMPIDDifXY ;
+ delete fhHMPIDSigP ;
+ delete [] fhHMPIDProb ;
+}
+
+//______________________________________________________________________________
+void AliHMPIDQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+ fhHMPIDCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]", 150, 0, 7 ,100, -3, 1);
+ fhHMPIDSigP = new TH2F("SigP" ,"#sigma_{#theta_c}" , 150, 0, 7 ,100, 0, 1e20);
+ fhHMPIDMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252,0,126);
+ fhHMPIDDifXY = new TH2F("DifXY" ,"diff" , 260, -10, 10 ,252,-10,10);
+
+ fhHMPIDProb[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta" ,100,0,1);
+ fhHMPIDProb[0]->SetLineColor(kYellow);
+ fhHMPIDProb[1] = new TH1F("PidMu","pid of #mu" ,100,0,1);
+ fhHMPIDProb[1]->SetLineColor(kMagenta);
+ fhHMPIDProb[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1);
+ fhHMPIDProb[2]->SetLineColor(kRed);
+ fhHMPIDProb[3] = new TH1F("PidK" ,"pid of K" ,100,0,1);
+ fhHMPIDProb[3]->SetLineColor(kGreen);
+ fhHMPIDProb[4] = new TH1F("PidP" ,"pid of p" ,100,0,1);
+ fhHMPIDProb[4]->SetLineColor(kBlue);
+
+
+
+ // create output container
+
+ fOutputContainer = new TObjArray(9) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhHMPIDCkovP, 0) ;
+ fOutputContainer->AddAt(fhHMPIDSigP, 1) ;
+ fOutputContainer->AddAt(fhHMPIDMipXY, 2) ;
+ fOutputContainer->AddAt(fhHMPIDDifXY, 3) ;
+ fOutputContainer->AddAt(fhHMPIDProb[0], 4) ;
+ fOutputContainer->AddAt(fhHMPIDProb[1], 5) ;
+ fOutputContainer->AddAt(fhHMPIDProb[2], 6) ;
+ fOutputContainer->AddAt(fhHMPIDProb[3], 7) ;
+ fOutputContainer->AddAt(fhHMPIDProb[4], 8) ;
+}
+
+//______________________________________________________________________________
+void AliHMPIDQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ HMPID *************************************
+ Int_t iTrk ;
+ for(iTrk = 0 ; iTrk < fESD->GetNumberOfTracks() ; iTrk++){
+ AliESDtrack *pTrk = fESD->GetTrack(iTrk) ;
+
+ fhHMPIDCkovP->Fill( pTrk->GetP(), pTrk->GetHMPIDsignal() ) ;
+ fhHMPIDSigP ->Fill( pTrk->GetP(), TMath::Sqrt(pTrk->GetHMPIDchi2()) ) ;
+
+// Float_t xm,ym; Int_t q,np; pTrk->GetHMPIDmip(xm,ym,q,np); fMipXY->Fill(xm,ym); //mip info
+// Float_t xd,yd,th,ph; pTrk->GetHMPIDtrk(xd,yd,th,ph); fDifXY->Fill(xd,yd); //track info
+
+ Double_t pid[5] ;
+ pTrk->GetHMPIDpid(pid) ;
+ Int_t i ;
+ for(i = 0 ; i < 5 ; i++)
+ fhHMPIDProb[i]->Fill(pid[i]) ;
+ }//tracks loop
+
+ PostData(0, fOutputContainer);
+}
+
+//______________________________________________________________________________
+void AliHMPIDQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ Float_t n = 1.292 ; //mean freon ref idx
+ TF1 * hHMPIDpPi = new TF1("RiPiTheo", "acos(sqrt(x*x+[0]*[0])/(x*[1]))", 1.2, 7) ;
+ hHMPIDpPi->SetLineWidth(1) ;
+ hHMPIDpPi->SetParameter(1,n) ;
+
+ AliPID ppp ;
+ hHMPIDpPi->SetLineColor(kRed);
+ hHMPIDpPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion)); //mass
+
+ TF1 * hHMPIDK = static_cast<TF1*>(hHMPIDpPi->Clone()) ;
+ hHMPIDK ->SetLineColor(kGreen) ;
+ hHMPIDK ->SetParameter(0, AliPID::ParticleMass(AliPID::kKaon)) ;
+
+ TF1 * hHMPIDP=static_cast<TF1*>(hHMPIDpPi->Clone()) ;
+ hHMPIDP ->SetLineColor(kBlue) ;
+ hHMPIDP ->SetParameter(0,AliPID::ParticleMass(AliPID::kProton)) ;
+
+ TCanvas * cHMPID = new TCanvas("cHMPID","HMPID ESD Test") ;
+ cHMPID->SetFillColor(10) ;
+ cHMPID->SetHighLightColor(10) ;
+ cHMPID->Divide(3,2) ;
+
+ cHMPID->cd(1);
+ fhHMPIDCkovP->Draw() ;
+ hHMPIDpPi->Draw("same") ;
+ hHMPIDK->Draw("same") ;
+ hHMPIDP->Draw("same") ;
+
+ cHMPID->cd(2) ;
+ fhHMPIDMipXY->Draw() ;
+
+ cHMPID->cd(3) ;
+ fhHMPIDProb[0]->Draw() ;
+ fhHMPIDProb[1]->Draw("same") ;
+
+ cHMPID->cd(4) ;
+ fhHMPIDSigP ->Draw() ;
+
+ cHMPID->cd(5) ;
+ fhHMPIDDifXY->Draw() ;
+
+ cHMPID->cd(6) ;
+ fhHMPIDProb[2]->Draw() ;
+ fhHMPIDProb[3]->Draw("same") ;
+ fhHMPIDProb[4]->Draw("same") ;
+
+ cHMPID->Print("HMPID.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIHMPIDQATASK_H
+#define ALIHMPIDQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the HMPID data in simulated data
+//
+//*-- Annalisa Mastroserio
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TH1F ;
+class TH2F ;
+
+class AliHMPIDQATask : public AliAnalysisTask {
+
+public:
+ AliHMPIDQATask(const char *name) ;
+ virtual ~AliHMPIDQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+
+ TH2F * fhHMPIDCkovP ; //!
+ TH2F * fhHMPIDMipXY ; //!
+ TH2F * fhHMPIDDifXY ; //!
+ TH2F * fhHMPIDSigP ; //!
+ TH1F * fhHMPIDProb[5] ;//!
+
+ ClassDef(AliHMPIDQATask, 0); // a HMPID photon analysis task
+};
+#endif // ALIHMPIDQATASK_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+// An analysis task to check the MUON data in simulated data
+//
+//*-- Ivana Hrivnacova
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TFile.h>
+#include <TH1F.h>
+#include <TCanvas.h>
+
+#include "AliMUONQATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+#include "AliESDVertex.h"
+#include "AliESDMuonTrack.h"
+
+//______________________________________________________________________________
+AliMUONQATask::AliMUONQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fnTrackTrig(0),
+ ftracktot(0),
+ fnevents(0),
+ fSPLowpt(0),
+ fSPHighpt(0),
+ fSPAllpt(0),
+ fSMLowpt(0),
+ fSMHighpt(0),
+ fSMAllpt(0),
+ fSULowpt(0),
+ fSUHighpt(0),
+ fSUAllpt(0),
+ fUSLowpt(0),
+ fUSHighpt(0),
+ fUSAllpt(0),
+ fLSLowpt(0),
+ fLSHighpt(0),
+ fLSAllpt(0),
+ fhMUONVertex(0),
+ fhMUONMult(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliMUONQATask::~AliMUONQATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhMUONVertex ;
+ delete fhMUONMult ;
+}
+
+//______________________________________________________________________________
+void AliMUONQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+ fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.);
+ fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5);
+
+
+ // create output container
+
+ fOutputContainer = new TObjArray(2) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhMUONVertex, 0) ;
+ fOutputContainer->AddAt(fhMUONMult, 1) ;
+}
+
+//______________________________________________________________________________
+void AliMUONQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ fnevents++ ;
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ MUON *************************************
+
+ const AliESDVertex* vertex = dynamic_cast<const AliESDVertex*>(fESD->GetVertex()) ;
+
+ Double_t zVertex = 0. ;
+ if (vertex)
+ zVertex = vertex->GetZv() ;
+
+ Int_t nTracks = fESD->GetNumberOfMuonTracks() ;
+
+ ULong64_t trigWord = fESD->GetTriggerMask() ;
+
+ if (trigWord & 0x01)
+ fSPLowpt++;
+ if (trigWord & 0x02)
+ fSPHighpt++;
+ if (trigWord & 0x04)
+ fSPAllpt++;
+ if (trigWord & 0x08)
+ fSMLowpt++;
+ if (trigWord & 0x010)
+ fSMHighpt++;
+ if (trigWord & 0x020)
+ fSMAllpt++;
+ if (trigWord & 0x040)
+ fSULowpt++;
+ if (trigWord & 0x080)
+ fSUHighpt++;
+ if (trigWord & 0x100)
+ fSUAllpt++;
+ if (trigWord & 0x200)
+ fUSLowpt++;
+ if (trigWord & 0x400)
+ fUSHighpt++;
+ if (trigWord & 0x800)
+ fUSAllpt++;
+ if (trigWord & 0x1000)
+ fLSLowpt++;
+ if (trigWord & 0x2000)
+ fLSHighpt++;
+ if (trigWord & 0x4000)
+ fLSAllpt++;
+
+ Int_t tracktrig = 0 ;
+ Int_t iTrack1 ;
+
+ for (iTrack1 = 0 ; iTrack1 < nTracks ; iTrack1++) { //1st loop
+ AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1) ;
+ ftracktot++ ;
+ if(muonTrack->GetMatchTrigger()) {
+ fnTrackTrig++ ;
+ tracktrig++ ;
+ }
+ }
+
+ fhMUONVertex->Fill(zVertex) ;
+ fhMUONMult->Fill(Float_t(nTracks)) ;
+
+ PostData(0, fOutputContainer);
+}
+
+//______________________________________________________________________________
+void AliMUONQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ AliInfo(Form("Terminate %s:", GetName())) ;
+
+ Int_t eff_match = 100 * fnTrackTrig / ftracktot ;
+
+ printf("===================================================\n") ;
+ printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
+ printf(" \n") ;
+ printf(" Total number of processed events %d \n", fnevents) ;
+ printf("\n") ;
+ printf("\n") ;
+ printf("Table 4: \n") ;
+ printf(" Global Trigger output Low pt High pt All\n") ;
+ printf(" number of Single Plus :\t");
+ printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
+ printf("\n");
+ printf(" number of Single Minus :\t");
+ printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
+ printf("\n");
+ printf(" number of Single Undefined :\t");
+ printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
+ printf("\n");
+ printf(" number of UnlikeSign pair :\t");
+ printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
+ printf("\n");
+ printf(" number of LikeSign pair :\t");
+ printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
+ printf("\n");
+ printf("===================================================\n") ;
+ printf("\n") ;
+ printf("matching efficiency with the trigger for single tracks = %2d %% \n", eff_match);
+
+ TCanvas * cMUON = new TCanvas("cMUON", "MUON ESD Test", 400, 10, 600, 700) ;
+ cMUON->Divide(1,2) ;
+ cMUON->cd(1) ;
+ fhMUONVertex->Draw() ;
+ cMUON->cd(2) ;
+ fhMUONMult->Draw() ;
+ cMUON->Print("MUON.eps") ;
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIMUONQATASK_H
+#define ALIMUONQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the MUON data in simulated data
+//
+//*-- Ivana Hrivnacova
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TH1F ;
+
+class AliMUONQATask : public AliAnalysisTask {
+
+public:
+ AliMUONQATask(const char *name) ;
+ virtual ~AliMUONQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ Int_t fnTrackTrig ; //!
+ Int_t ftracktot ; //!
+ Int_t fnevents ; //!
+ Int_t fSPLowpt ; //!
+ Int_t fSPHighpt ; //!
+ Int_t fSPAllpt ; //!
+ Int_t fSMLowpt ; //!
+ Int_t fSMHighpt ; //!
+ Int_t fSMAllpt ; //!
+ Int_t fSULowpt ; //!
+ Int_t fSUHighpt ; //!
+ Int_t fSUAllpt ; //!
+ Int_t fUSLowpt ; //!
+ Int_t fUSHighpt ; //!
+ Int_t fUSAllpt ; //!
+ Int_t fLSLowpt ; //!
+ Int_t fLSHighpt ; //!
+ Int_t fLSAllpt ; //!
+
+ // Histograms
+ TH1F * fhMUONVertex ; //!
+ TH1F * fhMUONMult ; //!
+
+ ClassDef(AliMUONQATask, 0); // a MUON photon analysis task
+};
+#endif // ALIMUONQATASK_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the PHOS photon data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1.h>
+#include <TH1F.h>
+#include <TH1I.h>
+#include <TNtuple.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TVector3.h>
+#include <TFile.h>
+
+#include "AliPHOSQATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliPHOSQATask::AliPHOSQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhPHOS(0),
+ fhPHOSEnergy(0),
+ fhPHOSDigits(0),
+ fhPHOSRecParticles(0),
+ fhPHOSPhotons(0),
+ fhPHOSInvariantMass(0),
+ fhPHOSDigitsEvent(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliPHOSQATask::~AliPHOSQATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhPHOSPos ;
+ delete fhPHOS ;
+ delete fhPHOSEnergy ;
+ delete fhPHOSDigits ;
+ delete fhPHOSRecParticles ;
+ delete fhPHOSPhotons ;
+ delete fhPHOSInvariantMass ;
+ delete fhPHOSDigitsEvent ;
+}
+
+
+//______________________________________________________________________________
+void AliPHOSQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+
+ fhPHOSPos = new TNtuple("PHOSPos" , "Position in PHOS" , "x:y:z");
+ fhPHOS = new TNtuple("PHOS" , "PHOS" , "event:digits:clusters:photons");
+ fhPHOSEnergy = new TH1D("PHOSEnergy" , "PHOSEnergy" , 1000, 0., 10. ) ;
+ fhPHOSDigits = new TH1I("PHOSDigitsCluster" , "PHOSDigits" , 20 , 0 , 20 ) ;
+ fhPHOSRecParticles = new TH1D("PHOSRecParticles" , "PHOSRecParticles" , 20 , 0., 20. ) ;
+ fhPHOSPhotons = new TH1I("PHOSPhotons" , "PHOSPhotons" , 20 , 0 , 20 ) ;
+ fhPHOSInvariantMass = new TH1D("PHOSInvariantMass" , "PHOSInvariantMass" , 400, 0., 400.) ;
+ fhPHOSDigitsEvent = new TH1I("PHOSDigitsEvent" , "PHOSDigitsEvent" , 30 , 0 , 30 ) ;
+
+ // create output container
+
+ fOutputContainer = new TObjArray(8) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhPHOSPos, 0) ;
+ fOutputContainer->AddAt(fhPHOS, 1) ;
+ fOutputContainer->AddAt(fhPHOSEnergy, 2) ;
+ fOutputContainer->AddAt(fhPHOSDigits, 3) ;
+ fOutputContainer->AddAt(fhPHOSRecParticles, 4) ;
+ fOutputContainer->AddAt(fhPHOSPhotons, 5) ;
+ fOutputContainer->AddAt(fhPHOSInvariantMass, 6) ;
+ fOutputContainer->AddAt(fhPHOSDigitsEvent, 7) ;
+}
+
+//______________________________________________________________________________
+void AliPHOSQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ //************************ PHOS *************************************
+
+ Int_t firstPhosCluster = fESD->GetFirstPHOSCluster() ;
+ const Int_t numberOfPhosClusters = fESD->GetNumberOfPHOSClusters() ;
+
+ TVector3 ** phosVector = new TVector3*[numberOfPhosClusters] ;
+ Float_t * phosPhotonsEnergy = new Float_t[numberOfPhosClusters] ;
+ Int_t phosCluster ;
+ Int_t numberOfPhotonsInPhos = 0 ;
+ Int_t numberOfDigitsInPhos = 0 ;
+
+ // loop over the PHOS Cluster
+ for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + numberOfPhosClusters ; phosCluster++) {
+ AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ;
+ if (caloCluster) {
+ Float_t pos[3] ;
+ caloCluster->GetGlobalPosition( pos ) ;
+ fhPHOSEnergy->Fill( caloCluster->GetClusterEnergy() ) ;
+ fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ;
+ fhPHOSDigits->Fill(entry, caloCluster->GetNumberOfDigits() ) ;
+ numberOfDigitsInPhos += caloCluster->GetNumberOfDigits() ;
+ Float_t * pid = caloCluster->GetPid() ;
+ if(pid[AliPID::kPhoton] > 0.9) {
+ phosVector[numberOfPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ;
+ phosPhotonsEnergy[numberOfPhotonsInPhos]=caloCluster->GetClusterEnergy() ;
+ numberOfPhotonsInPhos++;
+ }
+ }
+ } //PHOS clusters
+
+ fhPHOSRecParticles->Fill(numberOfPhosClusters);
+ fhPHOSPhotons->Fill(numberOfPhotonsInPhos);
+ fhPHOSDigitsEvent->Fill(numberOfDigitsInPhos);
+ fhPHOS->Fill(entry, numberOfDigitsInPhos, numberOfPhosClusters, numberOfPhotonsInPhos) ;
+
+ // invariant Mass
+ if (numberOfPhotonsInPhos > 1 ) {
+ Int_t phosPhoton1, phosPhoton2 ;
+ for(phosPhoton1 = 0 ; phosPhoton1 < numberOfPhotonsInPhos ; phosPhoton1++) {
+ for(phosPhoton2 = phosPhoton1 + 1 ; phosPhoton2 < numberOfPhotonsInPhos ; phosPhoton2++) {
+ Float_t tempMass = TMath::Sqrt( 2 * phosPhotonsEnergy[phosPhoton1] * phosPhotonsEnergy[phosPhoton2] *
+ ( 1 - TMath::Cos(phosVector[phosPhoton1]->Angle(*phosVector[phosPhoton2])) )
+ );
+ fhPHOSInvariantMass->Fill(tempMass*1000.);
+ }
+ }
+ }
+
+ PostData(0, fOutputContainer);
+
+ delete [] phosVector ;
+ delete [] phosPhotonsEnergy ;
+
+}
+
+//______________________________________________________________________________
+void AliPHOSQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ printf("PHOSEnergy Mean : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(), fhPHOSEnergy->GetRMS() ) ;
+ printf("PHOSDigits Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(), fhPHOSDigits->GetRMS() ) ;
+ printf("PHOSRecParticles Mean : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(), fhPHOSRecParticles->GetRMS() ) ;
+ printf("PHOSPhotons Mean : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(), fhPHOSPhotons->GetRMS() ) ;
+ printf("PHOSInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(), fhPHOSInvariantMass->GetRMS() ) ;
+ printf("PHOSDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(), fhPHOSDigitsEvent->GetRMS() ) ;
+
+ TCanvas * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ;
+ cPHOS->Divide(3, 2);
+
+ cPHOS->cd(1) ;
+ gPad->SetLogy();
+ fhPHOSEnergy->SetAxisRange(0, 25.);
+ fhPHOSEnergy->SetLineColor(2);
+ fhPHOSEnergy->Draw();
+
+ cPHOS->cd(2) ;
+ fhPHOSDigits->SetAxisRange(0,25.);
+ fhPHOSDigits->SetLineColor(2);
+ fhPHOSDigits->Draw();
+
+ cPHOS->cd(3) ;
+ gPad->SetLogy();
+ fhPHOSRecParticles->SetAxisRange(0, 25.);
+ fhPHOSRecParticles->SetLineColor(2);
+ fhPHOSRecParticles->Draw();
+
+ cPHOS->cd(4) ;
+ gPad->SetLogy();
+ fhPHOSPhotons->SetAxisRange(0,25.);
+ fhPHOSPhotons->SetLineColor(2);
+ fhPHOSPhotons->Draw();
+
+ cPHOS->cd(5) ;
+ fhPHOSInvariantMass->SetLineColor(2);
+ fhPHOSInvariantMass->Draw();
+
+ cPHOS->cd(6) ;
+ gPad->SetLogy();
+ fhPHOSDigitsEvent->SetAxisRange(0,40.);
+ fhPHOSDigitsEvent->SetLineColor(2);
+ fhPHOSDigitsEvent->Draw();
+
+ cPHOS->Print("PHOS.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIPHOSQATASK_H
+#define ALIPHOSQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the PHOS photon data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TNtuple ;
+class TH1D ;
+class TH1I ;
+
+class AliPHOSQATask : public AliAnalysisTask {
+
+public:
+ AliPHOSQATask(const char *name) ;
+ virtual ~AliPHOSQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+ TNtuple * fhPHOSPos ;
+ TNtuple * fhPHOS ;
+ TH1D * fhPHOSEnergy ;
+ TH1I * fhPHOSDigits ;
+ TH1D * fhPHOSRecParticles ;
+ TH1I * fhPHOSPhotons ;
+ TH1D * fhPHOSInvariantMass ;
+ TH1I * fhPHOSDigitsEvent ;
+
+ ClassDef(AliPHOSQATask, 0); // a PHOS photon analysis task
+};
+#endif // ALIPHOSQATASK_H
--- /dev/null
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the PMD data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TCanvas.h>
+#include <TLine.h>
+#include <TStyle.h>
+#include <TFile.h>
+
+#include "AliPMDQATask.h"
+#include "AliPMDUtility.h"
+#include "AliESD.h"
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliPMDQATask::AliPMDQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhPMDP1(0),
+ fhPMDC2(0),
+ fhPMDP2(0),
+ fhPMDC3(0),
+ fhPMDP3(0),
+ fhPMDP4(0),
+ fhPMDC5(0),
+ fhPMDP5(0),
+ fhPMDCP0(0),
+ fhPMDCP1(0),
+ fhPMDCP2(0),
+ fhPMDCP3(0),
+ fhPMDCP4(0),
+ fhPMDSM1(0),
+ fhPMDSM2(0),
+ fhPMDSM3(0),
+ fhPMDSM4(0),
+ fhPMDSM5(0),
+ fhPMDSM6(0),
+ fhPMDSM7(0),
+ fhPMDSM8(0),
+ fhPMDSM9(0),
+ fhPMDSM10(0),
+ fhPMDSM11(0),
+ fhPMDSM12(0),
+ fhPMDSM13(0),
+ fhPMDSM14(0),
+ fhPMDSM15(0),
+ fhPMDSM16(0),
+ fhPMDSM17(0),
+ fhPMDSM18(0),
+ fhPMDSM19(0),
+ fhPMDSM20(0),
+ fhPMDSM21(0),
+ fhPMDSM22(0),
+ fhPMDSM23(0),
+ fhPMDSM24(0),
+ fhPMDSM (0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliPMDQATask::~AliPMDQATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhPMDP1 ;
+ delete fhPMDC2 ;
+ delete fhPMDP2 ;
+ delete fhPMDC3 ;
+ delete fhPMDP3 ;
+ delete fhPMDP4 ;
+ delete fhPMDC5 ;
+ delete fhPMDP5 ;
+ delete fhPMDCP0 ;
+ delete fhPMDCP1 ;
+ delete fhPMDCP2 ;
+ delete fhPMDCP3 ;
+ delete fhPMDCP4 ;
+ delete fhPMDSM1 ;
+ delete fhPMDSM2 ;
+ delete fhPMDSM3 ;
+ delete fhPMDSM4 ;
+ delete fhPMDSM5 ;
+ delete fhPMDSM6 ;
+ delete fhPMDSM7 ;
+ delete fhPMDSM8 ;
+ delete fhPMDSM9 ;
+ delete fhPMDSM10 ;
+ delete fhPMDSM11 ;
+ delete fhPMDSM12 ;
+ delete fhPMDSM13 ;
+ delete fhPMDSM14 ;
+ delete fhPMDSM15 ;
+ delete fhPMDSM16 ;
+ delete fhPMDSM17 ;
+ delete fhPMDSM18 ;
+ delete fhPMDSM19 ;
+ delete fhPMDSM20 ;
+ delete fhPMDSM21 ;
+ delete fhPMDSM22 ;
+ delete fhPMDSM23 ;
+ delete fhPMDSM24 ;
+ delete fhPMDSM ;
+
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+
+ fhPMDP1 = new TH2F("fhPMDP1","XY of Clusters",100,-100.,100.,100,-100.,100.);
+ fhPMDC2 = new TH1F("fhPMDC2","CPV PHI",200,-1,9);
+ fhPMDP2 = new TH1F("fhPMDP2","PRE PHI",200,-1,9);
+ fhPMDC3 = new TH1F("fhPMDC3","CPV Clus",30,0.,500.);
+ fhPMDP3 = new TH1F("fhPMDP3","PRE N-gammalike",20,0.,500.);
+ fhPMDP4 = new TH1F("fhPMDP4","PRE EDEP",30,0.,1000.);
+ fhPMDC5 = new TH1F("fhPMDC5","CPV n-cell",20,0.,100.);
+ fhPMDP5 = new TH1F("fhPMDP5","PMD n-cell",20,0.,100.);
+ fhPMDCP0 = new TH2F("fhPMDCP0","PRE CLUS Quad.1 vs 2",150,0.,300.,150,0.,300.);
+ fhPMDCP1 = new TH2F("fhPMDCP1","PRE CLUS Quad.3 vs 4",150,0.,300.,150,0.,300.);
+ fhPMDCP2 = new TH2F("fhPMDCP2","PRE EDEP Quad.3 vs 4",50,0.,300.,50,0.,300.);
+ fhPMDCP3 = new TH2F("fhPMDCP3","PRE EDEP vs Tot Clus ",10,0.,1000.,10,0.,300.);
+ fhPMDCP4 = new TH2F("fhPMDCP4","PRE Clus vs CPV Clus ",150,0.,200.,150,0.,200.);
+
+ fhPMDSM1 = new TH2F("fhPMDSM1","PRE Cluster XY",200,-100,100,200,-100,100);
+ fhPMDSM2 = new TH2F("fhPMDSM2","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM3 = new TH2F("fhPMDSM3","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM4 = new TH2F("fhPMDSM4","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM5 = new TH2F("fhPMDSM5","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM6 = new TH2F("fhPMDSM6","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM7 = new TH2F("fhPMDSM7","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM8 = new TH2F("fhPMDSM8","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM9 = new TH2F("fhPMDSM9","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM10 = new TH2F("fhPMDSM10","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM11 = new TH2F("fhPMDSM11","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM12 = new TH2F("fhPMDSM12","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM13 = new TH2F("fhPMDSM13","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM14 = new TH2F("fhPMDSM14","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM15 = new TH2F("fhPMDSM15","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM16 = new TH2F("fhPMDSM16","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM17 = new TH2F("fhPMDSM17","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM18 = new TH2F("fhPMDSM18","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM19 = new TH2F("fhPMDSM19","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM20 = new TH2F("fhPMDSM20","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM21 = new TH2F("fhPMDSM21","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM22 = new TH2F("fhPMDSM22","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM23 = new TH2F("fhPMDSM23","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM24 = new TH2F("fhPMDSM24","",999,-100.0,100.0,999,-100.0,100.0);
+ fhPMDSM = new TH1F("fhPMDSM","Plot of all 24 Super Modules",24,0,24);
+
+ // create output container
+
+ fOutputContainer = new TObjArray(38) ;
+ fOutputContainer->SetName("PMD") ;
+
+ fOutputContainer->AddAt(fhPMDP1, 0 );
+ fOutputContainer->AddAt(fhPMDC2, 1 );
+ fOutputContainer->AddAt(fhPMDP2, 2 );
+ fOutputContainer->AddAt(fhPMDC3, 3 );
+ fOutputContainer->AddAt(fhPMDP3, 4 );
+ fOutputContainer->AddAt(fhPMDP4, 5 );
+ fOutputContainer->AddAt(fhPMDC5, 6 );
+ fOutputContainer->AddAt(fhPMDP5, 7 );
+ fOutputContainer->AddAt(fhPMDCP0, 8 );
+ fOutputContainer->AddAt(fhPMDCP1, 9);
+ fOutputContainer->AddAt(fhPMDCP2, 10 );
+ fOutputContainer->AddAt(fhPMDCP3, 11 );
+ fOutputContainer->AddAt(fhPMDCP4, 12 );
+
+ fOutputContainer->AddAt(fhPMDSM1, 13 );
+ fOutputContainer->AddAt(fhPMDSM2, 14 );
+ fOutputContainer->AddAt(fhPMDSM3, 15 );
+ fOutputContainer->AddAt(fhPMDSM4, 16 );
+ fOutputContainer->AddAt(fhPMDSM5, 17 );
+ fOutputContainer->AddAt(fhPMDSM6, 18 );
+ fOutputContainer->AddAt(fhPMDSM7, 19 );
+ fOutputContainer->AddAt(fhPMDSM8, 20 );
+ fOutputContainer->AddAt(fhPMDSM9, 21 );
+ fOutputContainer->AddAt(fhPMDSM10, 22 );
+ fOutputContainer->AddAt(fhPMDSM11, 23 );
+ fOutputContainer->AddAt(fhPMDSM12, 24 );
+ fOutputContainer->AddAt(fhPMDSM13, 25 );
+ fOutputContainer->AddAt(fhPMDSM14, 26 );
+ fOutputContainer->AddAt(fhPMDSM15, 27 );
+ fOutputContainer->AddAt(fhPMDSM16, 28 );
+ fOutputContainer->AddAt(fhPMDSM17, 29 );
+ fOutputContainer->AddAt(fhPMDSM18, 30 );
+ fOutputContainer->AddAt(fhPMDSM19, 31 );
+ fOutputContainer->AddAt(fhPMDSM20, 32 );
+ fOutputContainer->AddAt(fhPMDSM21, 33 );
+ fOutputContainer->AddAt(fhPMDSM22, 34 );
+ fOutputContainer->AddAt(fhPMDSM23, 35 );
+ fOutputContainer->AddAt(fhPMDSM24, 36 );
+ fOutputContainer->AddAt(fhPMDSM, 37 );
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ PMD
+
+ AliPMDUtility *cc = new AliPMDUtility();
+
+ Int_t smn;
+ Int_t n=0;
+ Float_t totCPVClus ;
+ Float_t totPREClus ;
+ Float_t totPREEdep ;
+ Float_t totCPVCell ;
+ Float_t totPRECell ;
+ Float_t preCluQUAD[4] ;
+ Float_t cpvCluQUAD[4] ;
+ Float_t preADCQUAD[4] ;
+ Float_t cpvADCQUAD[4] ;
+ Float_t preCelQUAD[4] ;
+ Float_t cpvCelQUAD[4] ;
+
+ Int_t npmdCl = fESD->GetNumberOfPmdTracks();
+
+ // ****** The loop over PMD clusters
+
+ for (Int_t kk = 0; kk < 4 ; kk++) {
+ cpvCluQUAD[kk] = 0.0 ;
+ preCluQUAD[kk] = 0.0 ;
+ cpvCelQUAD[kk] = 0.0 ;
+ preCelQUAD[kk] = 0.0 ;
+ preADCQUAD[kk] = 0.0 ;
+ }
+
+ while (npmdCl--) {
+
+ AliESDPmdTrack * pmdtr = fESD->GetPmdTrack(npmdCl);
+ Int_t det = pmdtr->GetDetector();
+ Float_t clsX = pmdtr->GetClusterX();
+ Float_t clsY = pmdtr->GetClusterY();
+ Float_t clsZ = pmdtr->GetClusterZ();
+ Float_t ncell = pmdtr->GetClusterCells();
+ Float_t adc = pmdtr->GetClusterADC();
+
+ cc->SetXYZ(clsX,clsY,clsZ);
+ cc->CalculateEta();
+ cc->CalculatePhi();
+ Float_t eta = cc->GetEta();
+ Float_t phi = cc->GetPhi();
+
+ // Calculating S.Module Number from Cluster .
+
+ CalculateSMN(clsX, clsY, smn);
+ if( det == 1)
+ {
+ if(smn >= 0 && smn <= 5) {
+ ++cpvCluQUAD[0] ;
+ cpvADCQUAD[0] =+ adc ;
+ cpvCelQUAD[0] =+ ncell ;
+ }
+ if(smn >= 6 && smn <=11) {
+ ++cpvCluQUAD[1] ;
+ cpvADCQUAD[1] =+ adc ;
+ cpvCelQUAD[1] =+ ncell ;
+ }
+ if(smn >=12 && smn <=17) {
+ ++cpvCluQUAD[2] ;
+ cpvADCQUAD[2] =+ adc ;
+ cpvCelQUAD[2] =+ ncell ;
+ }
+ if(smn >=18 && smn <=23) {
+ ++cpvCluQUAD[3] ;
+ cpvADCQUAD[3] =+ adc ;
+ cpvCelQUAD[3] =+ ncell ;
+ }
+
+ if(eta >= 2.3 && eta <= 3.5)
+ {
+ fhPMDC2->Fill(phi);
+ }
+ }
+ if( det == 0)
+ {
+ if(smn >= 0 && smn <= 5) {
+ ++preCluQUAD[0] ;
+ preADCQUAD[0] =+ adc ;
+ preCelQUAD[0] =+ ncell ;
+ }
+ if(smn >= 6 && smn <=11) {
+ ++preCluQUAD[1] ;
+ preADCQUAD[1] =+ adc ;
+ preCelQUAD[1] =+ ncell ;
+ }
+ if(smn >=12 && smn <=17) {
+ ++preCluQUAD[2] ;
+ preADCQUAD[2] =+ adc ;
+ preCelQUAD[2] =+ ncell ;
+ }
+ if(smn >=18 && smn <=23) {
+ ++preCluQUAD[3] ;
+ preADCQUAD[3] =+ adc ;
+ preCelQUAD[3] =+ ncell ;
+ }
+ if ( n <= 100 ) {
+ fhPMDSM->Fill(smn);
+ if(smn == 0) fhPMDSM1->Fill(-clsX,clsY);
+ if(smn == 0) fhPMDSM1->Fill(-clsX,clsY);
+ if(smn == 1) fhPMDSM2->Fill(-clsX,clsY);
+ if(smn == 2) fhPMDSM3->Fill(-clsX,clsY);
+ if(smn == 3) fhPMDSM4->Fill(-clsX,clsY);
+ if(smn == 4) fhPMDSM5->Fill(-clsX,clsY);
+ if(smn == 5) fhPMDSM6->Fill(-clsX,clsY);
+ if(smn == 6) fhPMDSM7->Fill(-clsX,clsY);
+ if(smn == 7) fhPMDSM8->Fill(-clsX,clsY);
+ if(smn == 8) fhPMDSM9->Fill(-clsX,clsY);
+ if(smn == 9) fhPMDSM10->Fill(-clsX,clsY);
+ if(smn ==10) fhPMDSM11->Fill(-clsX,clsY);
+ if(smn ==11) fhPMDSM12->Fill(-clsX,clsY);
+ if(smn ==12) fhPMDSM13->Fill(-clsX,clsY);
+ if(smn ==13) fhPMDSM14->Fill(-clsX,clsY);
+ if(smn ==14) fhPMDSM15->Fill(-clsX,clsY);
+ if(smn ==15) fhPMDSM16->Fill(-clsX,clsY);
+ if(smn ==16) fhPMDSM17->Fill(-clsX,clsY);
+ if(smn ==17) fhPMDSM18->Fill(-clsX,clsY);
+ if(smn ==18) fhPMDSM19->Fill(-clsX,clsY);
+ if(smn ==19) fhPMDSM20->Fill(-clsX,clsY);
+ if(smn ==20) fhPMDSM21->Fill(-clsX,clsY);
+ if(smn ==21) fhPMDSM22->Fill(-clsX,clsY);
+ if(smn ==22) fhPMDSM23->Fill(-clsX,clsY);
+ if(smn ==23) fhPMDSM24->Fill(-clsX,clsY);
+ }
+ if(eta >= 2.3 && eta <= 3.5)
+ {
+ fhPMDP2->Fill(phi);
+ }
+ fhPMDP1->Fill(clsX,clsY);
+ }
+ }
+ for (Int_t k = 0 ; k < 4 ; k++) {
+ totCPVClus =+ cpvCluQUAD [k] ;
+ totPREClus =+ preCluQUAD [k] ;
+ totCPVCell =+ cpvCelQUAD [k] ;
+ totPRECell =+ preCelQUAD [k] ;
+ totPREEdep =+ preADCQUAD [k] ;
+ }
+ Float_t totCPVpreClus = totPREClus + totCPVClus ;
+
+ // if(eta >= 2.3 && eta <= 3.5) {
+ fhPMDC3->Fill(totCPVClus);
+ fhPMDP3->Fill(totPREClus);
+ fhPMDP4->Fill(totPREEdep);
+ fhPMDP5->Fill(totPRECell);
+ fhPMDCP0->Fill(preCluQUAD[0],preCluQUAD[1]);
+ fhPMDCP1->Fill(preCluQUAD[2],preCluQUAD[3]);
+ fhPMDCP2->Fill(preADCQUAD[2],preADCQUAD[3]);
+ fhPMDCP3->Fill(totPREEdep,totCPVpreClus);
+ fhPMDCP4->Fill(totPREClus,totCPVClus);
+ // }
+ totCPVClus = 0.0;
+ totPREClus = 0.0;
+ totCPVCell = 0.0;
+ totPRECell = 0.0;
+ totPREEdep = 0.0;
+
+ PostData(0, fOutputContainer);
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ gStyle->SetOptStat(110000);
+ gStyle->SetOptFit(1);
+
+ TCanvas *cPMD0 = new TCanvas("cPMD0","PMD ESD Test #1", 10,10, 600, 600);
+ cPMD0->Range(-100, -100,100 ,100 );
+ fhPMDSM1->SetMarkerColor(2);
+ fhPMDSM1->Draw();
+ fhPMDSM1->GetXaxis()->SetTitle("Cluster X");
+ fhPMDSM1->GetYaxis()->SetTitle("Cluster Y");
+ fhPMDSM2->SetMarkerColor(2);
+ fhPMDSM2->Draw("same");
+ fhPMDSM3->SetMarkerColor(2);
+ fhPMDSM3->Draw("same");
+ fhPMDSM4->SetMarkerColor(2);
+ fhPMDSM4->Draw("same");
+ fhPMDSM5->SetMarkerColor(2);
+ fhPMDSM5->Draw("same");
+ fhPMDSM6->SetMarkerColor(2);
+ fhPMDSM6->Draw("same");
+ fhPMDSM7->SetMarkerColor(4);
+ fhPMDSM7->Draw("same");
+ fhPMDSM8->SetMarkerColor(4);
+ fhPMDSM8->Draw("same");
+ fhPMDSM9->SetMarkerColor(4);
+ fhPMDSM9->Draw("same");
+ fhPMDSM10->SetMarkerColor(4);
+ fhPMDSM10->Draw("same");
+ fhPMDSM11->SetMarkerColor(4);
+ fhPMDSM11->Draw("same");
+ fhPMDSM12->SetMarkerColor(4);
+ fhPMDSM12->Draw("same");
+ fhPMDSM13->SetMarkerColor(6);
+ fhPMDSM13->Draw("same");
+ fhPMDSM14->SetMarkerColor(6);
+ fhPMDSM14->Draw("same");
+ fhPMDSM15->SetMarkerColor(6);
+ fhPMDSM15->Draw("same");
+ fhPMDSM16->SetMarkerColor(6);
+ fhPMDSM16->Draw("same");
+ fhPMDSM17->SetMarkerColor(6);
+ fhPMDSM17->Draw("same");
+ fhPMDSM18->SetMarkerColor(6);
+ fhPMDSM18->Draw("same");
+ fhPMDSM19->SetMarkerColor(8);
+ fhPMDSM19->Draw("same");
+ fhPMDSM20->SetMarkerColor(8);
+ fhPMDSM20->Draw("same");
+ fhPMDSM21->SetMarkerColor(8);
+ fhPMDSM21->Draw("same");
+ fhPMDSM22->SetMarkerColor(8);
+ fhPMDSM22->Draw("same");
+ fhPMDSM23->SetMarkerColor(8);
+ fhPMDSM23->Draw("same");
+ fhPMDSM24->SetMarkerColor(8);
+ fhPMDSM24->Draw("same");
+
+ DrawPMDBoundary();
+ DrawPMDBoundarySM1();
+ DrawPMDBoundarySM2();
+ DrawPMDBoundarySM3();
+ DrawPMDBoundarySM4();
+ cPMD0->Print("ClusterXY.eps");
+
+ TCanvas *cPMD1 = new TCanvas("cPMD1"," PMD ESD Test #2",10, 10, 600,600);
+ cPMD1->Divide(1,2);
+ cPMD1->cd(1);
+ cPMD1->SetFillColor(0);
+ fhPMDC2->SetLineColor(4);
+ fhPMDC2->Draw();
+ cPMD1->cd(2);
+ fhPMDP2->SetLineColor(2);
+ fhPMDP2->Draw();
+ cPMD1->Print("CPVPREphi.eps");
+
+ TCanvas *cPMD2 = new TCanvas("cPMD2","PMD ESD test #3",10, 10, 600, 600);
+ cPMD2->cd();
+ fhPMDSM->SetFillColor(2);
+ fhPMDSM->Draw();
+ cPMD2->Print("AllSMN.eps");
+
+ TCanvas *cPMD3 = new TCanvas("cPMD3", "PMD ESD test #4",10, 10, 600, 600);
+ cPMD3->Divide(2,2);
+ cPMD3->cd(1);
+ fhPMDCP0->SetMarkerColor(9);
+ fhPMDCP0->Draw();
+ cPMD3->cd(2);
+ fhPMDCP1->SetMarkerColor(6);
+ fhPMDCP1->Draw();
+ cPMD3->cd(3);
+ fhPMDP3->SetLineColor(2);
+ fhPMDP3->Draw();
+ cPMD3->cd(4);
+ fhPMDCP4->SetMarkerColor(3);
+ fhPMDCP4->Draw();
+ cPMD3->Print("CPVPREClus.eps");
+
+ TCanvas *cPMD4 = new TCanvas("cPMD4","PMD ESD test #5", 10, 10, 600, 600);
+ cPMD4->Divide(1,2);
+ cPMD4->cd(1);
+ fhPMDC3->SetLineColor(4);
+ fhPMDC3->Draw();
+ cPMD4->cd(2);
+ fhPMDP4->SetLineColor(2);
+ fhPMDP4->Draw();
+ cPMD4->Print("CPVPREAdc.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::CalculateSMN( Float_t clsX, Float_t clsY, Int_t & smn)
+{
+ Double_t xcon[96] = {75.133, 54.204, 53.254, 32.326, 31.376,10.447,
+ 75.133, 54.204, 53.254, 32.326, 31.376,10.447,
+ 75.133, 54.204, 53.254, 32.326, 31.376,10.447,
+ 75.133, 54.204, 53.254, 32.326, 31.376,10.447,
+ -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
+ -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
+ -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
+ -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
+ 9.167, -32.543, -33.493, -75.133,
+ 9.167, -32.543, -33.493, -75.133,
+ 9.167, -32.543, -33.493, -75.133,
+ 9.167, -32.543, -33.493, -75.133,
+ 9.167, -32.543, -33.493, -75.133,
+ 9.167, -32.543, -33.493, -75.133,
+ -9.167, 32.543, 33.493, 75.133,
+ -9.167, 32.543, 33.493, 75.133,
+ -9.167, 32.543, 33.493, 75.133,
+ -9.167, 32.543, 33.493, 75.133,
+ -9.167, 32.543, 33.493, 75.133,
+ -9.167, 32.543, 33.493, 75.133};
+
+ Double_t ycon[96] = {86.475, 86.475, 86.475, 86.475, 86.475, 86.475,
+ 38.225, 38.225, 38.225, 38.225, 38.225, 38.225,
+ 37.325, 37.325, 37.325, 37.325, 37.325, 37.325,
+ -10.925, -10.925, -10.925, -10.925, -10.925, -10.925,
+ -86.475, -86.475, -86.475, -86.475, -86.475, -86.475,
+ -38.225, -38.225, -38.225, -38.225, -38.225, -38.225,
+ -37.325, -37.325, -37.325, -37.325, -37.325, -37.325,
+ 10.925, 10.925, 10.925, 10.925, 10.925, 10.925,
+ 86.475, 86.475, 86.475, 86.475,
+ 62.225, 62.225, 62.225, 62.225,
+ 61.325, 61.325, 61.325, 61.325,
+ 37.075, 37.075, 37.075, 37.075,
+ 36.175, 36.175, 36.175, 36.175,
+ 11.925, 11.925, 11.925 , 11.925,
+ -86.475, -86.475, -86.475, -86.475,
+ -62.225, -62.225, -62.225, -62.225,
+ -61.325, -61.325, -61.325, -61.325,
+ -37.075, -37.075, -37.075, -37.075,
+ -36.175, -36.175, -36.175, -36.175,
+ -11.925, -11.925, -11.925 , -11.925 };
+
+ if((clsX <= xcon[0]) && (clsX >= xcon[1]) &&
+ (clsY <= ycon[0]) && (clsY >= ycon[6])) smn = 0 ;
+
+ else if((clsX <=xcon[2]) && (clsX >= xcon[3]) &&
+ (clsY <= ycon[1]) && (clsY >= ycon[7]))smn = 1 ;
+
+ else if((clsX <=xcon[4]) && (clsX >= xcon[5]) &&
+ (clsY <= ycon[3]) && (clsY >= ycon[8]))smn = 2 ;
+
+ else if((clsX <= xcon[0]) && (clsX >= xcon[1]) &&
+ (clsY <= ycon[12]) && (clsY >= ycon[18])) smn = 3 ;
+
+ else if((clsX <=xcon[2]) && (clsX >= xcon[3]) &&
+ (clsY <= ycon[12]) && (clsY >= ycon[18]))smn = 4 ;
+
+ else if((clsX <=xcon[4]) && (clsX >= xcon[5]) &&
+ (clsY <= ycon[12]) && (clsY >= ycon[18]))smn = 5 ;
+ //------------------------------------------------------------------
+ else if((clsX >= xcon[24]) && (clsX <= xcon[25]) &&
+ (clsY >= ycon[24]) && (clsY <= ycon[30])) smn = 6 ;
+
+ else if((clsX >=xcon[26]) && (clsX <= xcon[27]) &&
+ (clsY >= ycon[25]) && (clsY <= ycon[31]))smn = 7 ;
+
+ else if((clsX >=xcon[28]) && (clsX <= xcon[29]) &&
+ (clsY >= ycon[26]) && (clsY <= ycon[32]))smn = 8 ;
+
+ else if((clsX >= xcon[24]) && (clsX <= xcon[25]) &&
+ (clsY >= ycon[36]) && (clsY <= ycon[42])) smn = 9 ;
+
+ else if((clsX >=xcon[26]) && (clsX <= xcon[27]) &&
+ (clsY >= ycon[36]) && (clsY <= ycon[42]))smn = 10;
+
+ else if((clsX >=xcon[28]) && (clsX <= xcon[29]) &&
+ (clsY >= ycon[36]) && (clsY <= ycon[42]))smn = 11;
+ //------------------------------------------------------------------
+ else if((clsX <= xcon[48]) && (clsX >= xcon[49]) &&
+ (clsY <= ycon[48]) && (clsY >= ycon[52])) smn = 12 ;
+
+ else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
+ (clsY <= ycon[48]) && (clsY >= ycon[52]))smn = 13 ;
+
+ else if((clsX <=xcon[48]) && (clsX >= xcon[49]) &&
+ (clsY <= ycon[56]) && (clsY >= ycon[60]))smn = 14 ;
+
+ else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
+ (clsY <= ycon[56]) && (clsY >= ycon[60]))smn = 15 ;
+
+ else if((clsX <=xcon[48]) && (clsX >= xcon[49]) &&
+ (clsY <= ycon[64]) && (clsY >= ycon[68]))smn = 16 ;
+
+ else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
+ (clsY <= ycon[64]) && (clsY >= ycon[68]))smn = 17 ;
+ //--------------------------------------------------------------
+ else if((clsX >= xcon[72]) && (clsX <= xcon[73]) &&
+ (clsY >= ycon[72]) && (clsY <= ycon[76])) smn = 18 ;
+
+ else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
+ (clsY >= ycon[72]) && (clsY <= ycon[76]))smn = 19 ;
+
+ else if((clsX >=xcon[72]) && (clsX <= xcon[73]) &&
+ (clsY >= ycon[80]) && (clsY <= ycon[84]))smn = 20 ;
+
+ else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
+ (clsY >= ycon[80]) && (clsY <= ycon[84]))smn = 21;
+
+ else if((clsX >= xcon[72]) && (clsX <= xcon[73]) &&
+ (clsY >= ycon[88]) && (clsY <= ycon[92])) smn = 22 ;
+
+ else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
+ (clsY >= ycon[88]) && (clsY <= ycon[92]))smn = 23 ;
+ else smn = 111;
+ }
+
+//______________________________________________________________________________
+void AliPMDQATask::DrawPMDBoundary()
+{
+ // Draw PMD boundaries
+
+ gStyle->SetLineWidth(2);
+ gStyle->SetLineColor(2);
+ TLine * l;
+ l = new TLine(75.1333, 86.475, -75.1333, 86.475); l->Draw("same");
+ l = new TLine(-75.1333, 86.470,-75.1333, -86.475); l->Draw("same");
+ l = new TLine(-75.1333, -86.475,75.1333, -86.475); l->Draw("same");
+ l = new TLine(75.1333, -86.475,75.1333, 86.475); l->Draw("same");
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::DrawPMDBoundarySM1()
+{
+ // Draw boundaries of Super Module 1
+
+ gStyle->SetLineWidth(1);
+ gStyle->SetLineColor(4);
+ TLine * l;
+ l = new TLine(-75.1333, 86.475, -10.447, 86.475); l->Draw("same");
+ l = new TLine(-10.447, 86.475, -10.446, -10.925); l->Draw("same");
+ l = new TLine(-10.446, -10.925, -75.1333,-10.925); l->Draw("same");
+ l = new TLine(-75.1333,-10.925, -75.1333, 86.475); l->Draw("same");
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::DrawPMDBoundarySM2()
+{
+ // Draw boundaries of Super Module 2
+
+ gStyle->SetLineWidth(1);
+ gStyle->SetLineColor(4);
+ TLine * l;
+ l = new TLine(75.1333, -86.475, 10.446, -86.475); l->Draw("same");
+ l = new TLine(10.446, -86.475, 10.446, 10.925); l->Draw("same");
+ l = new TLine(10.446, 10.925, 75.1333, 10.925); l->Draw("same");
+ l = new TLine(75.1333, 10.925, 75.1333, -86.475); l->Draw("same");
+}
+
+
+//______________________________________________________________________________
+void AliPMDQATask::DrawPMDBoundarySM3()
+{
+ // Draw boundaries of Super Module 3
+
+ gStyle->SetLineWidth(1);
+ gStyle->SetLineColor(1);
+ TLine * l;
+ l = new TLine( -9.167, 86.475, 75.1333, 86.475); l->Draw("same");
+ l = new TLine(75.1333,86.475, 75.1333, 11.925); l->Draw("same");
+ l = new TLine(75.1333,11.925, -9.167, 11.925); l->Draw("same");
+ l = new TLine( -9.167, 11.925, -9.167, 86.475); l->Draw("same");
+}
+
+//______________________________________________________________________________
+void AliPMDQATask::DrawPMDBoundarySM4()
+{
+ // Draw boundaries of Super Module 4
+
+ gStyle->SetLineWidth(1);
+ gStyle->SetLineColor(1);
+ TLine * l;
+ l = new TLine(9.167, -86.475, -75.1333,-86.475); l->Draw("same");
+ l = new TLine(-75.1333,-86.475, -75.1333,-11.925); l->Draw("same");
+ l = new TLine(-75.1333,-11.925, 9.167, -11.925); l->Draw("same");
+ l = new TLine(9.167, -11.925, 9.167, -86.475); l->Draw("same");
+}
--- /dev/null
+#ifndef ALIPMDQATASK_H
+#define ALIPMDQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the PMD data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TH2F ;
+class TH1F ;
+
+class AliPMDQATask : public AliAnalysisTask {
+
+public:
+ AliPMDQATask(const char *name) ;
+ virtual ~AliPMDQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ void CalculateSMN( Float_t clsX, Float_t clsY, Int_t & smn) ;
+ void DrawPMDBoundary() ;
+ void DrawPMDBoundarySM1() ;
+ void DrawPMDBoundarySM2() ;
+ void DrawPMDBoundarySM3() ;
+ void DrawPMDBoundarySM4() ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+
+ // Histograms
+ TH2F * fhPMDP1 ; //!
+ TH1F * fhPMDC2 ; //!
+ TH1F * fhPMDP2 ; //!
+ TH1F * fhPMDC3 ; //!
+ TH1F * fhPMDP3 ; //!
+ TH1F * fhPMDP4 ; //!
+ TH1F * fhPMDC5 ; //!
+ TH1F * fhPMDP5 ; //!
+ TH2F * fhPMDCP0 ; //!
+ TH2F * fhPMDCP1 ; //!
+ TH2F * fhPMDCP2 ; //!
+ TH2F * fhPMDCP3 ; //!
+ TH2F * fhPMDCP4 ; //!
+
+ TH2F * fhPMDSM1 ; //!
+ TH2F * fhPMDSM2 ; //!
+ TH2F * fhPMDSM3 ; //!
+ TH2F * fhPMDSM4 ; //!
+ TH2F * fhPMDSM5 ; //!
+ TH2F * fhPMDSM6 ; //!
+ TH2F * fhPMDSM7 ; //!
+ TH2F * fhPMDSM8 ; //!
+ TH2F * fhPMDSM9 ; //!
+ TH2F * fhPMDSM10 ; //!
+ TH2F * fhPMDSM11 ; //!
+ TH2F * fhPMDSM12 ; //!
+ TH2F * fhPMDSM13 ; //!
+ TH2F * fhPMDSM14 ; //!
+ TH2F * fhPMDSM15 ; //!
+ TH2F * fhPMDSM16 ; //!
+ TH2F * fhPMDSM17 ; //!
+ TH2F * fhPMDSM18 ; //!
+ TH2F * fhPMDSM19 ; //!
+ TH2F * fhPMDSM20 ; //!
+ TH2F * fhPMDSM21 ; //!
+ TH2F * fhPMDSM22 ; //!
+ TH2F * fhPMDSM23 ; //!
+ TH2F * fhPMDSM24 ; //!
+ TH1F * fhPMDSM ; //!
+
+ ClassDef(AliPMDQATask, 0); //! // a PMD analysis task
+};
+#endif // ALIPMDQATASK_H
--- /dev/null
+/***************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//-----------------------------------------------------//
+// //
+// //
+// Date : August 05 2003 //
+// //
+// Utility code for ALICE-PMD //
+// //
+//-----------------------------------------------------//
+
+#include "Riostream.h"
+#include "AliPMDUtility.h"
+#include "TMath.h"
+#include <stdio.h>
+#include <math.h>
+
+
+ClassImp(AliPMDUtility)
+
+AliPMDUtility::AliPMDUtility():
+ fPx(0.),
+ fPy(0.),
+ fPz(0.),
+ fTheta(0.),
+ fEta(0.),
+ fPhi(0.)
+{
+ // Default constructor
+}
+
+AliPMDUtility::AliPMDUtility(Float_t px, Float_t py, Float_t pz):
+ fPx(px),
+ fPy(py),
+ fPz(pz),
+ fTheta(0.),
+ fEta(0.),
+ fPhi(0.)
+{
+ // Constructor
+}
+AliPMDUtility::AliPMDUtility(const AliPMDUtility &pmdutil):
+ fPx(pmdutil.fPx),
+ fPy(pmdutil.fPy),
+ fPz(pmdutil.fPz),
+ fTheta(pmdutil.fTheta),
+ fEta(pmdutil.fEta),
+ fPhi(pmdutil.fPhi)
+{
+ // copy constructor
+}
+AliPMDUtility & AliPMDUtility::operator=(const AliPMDUtility &pmdutil)
+{
+ // assignment operator
+ if(this != &pmdutil)
+ {
+ fPx = pmdutil.fPx;
+ fPy = pmdutil.fPy;
+ fPz = pmdutil.fPz;
+ fTheta = pmdutil.fTheta;
+ fEta = pmdutil.fEta;
+ fPhi = pmdutil.fPhi;
+ }
+ return *this;
+}
+AliPMDUtility::~AliPMDUtility()
+{
+ // Default destructor
+}
+
+void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
+{
+ // This routine finds the cell eta,phi for the new PMD rectangular
+ // geometry in ALICE
+ // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
+ // modified by B. K. Nandi for change of coordinate sys
+ //
+ // SMA ---> Supermodule Type A ( SM - 0)
+ // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
+ // SMB ---> Supermodule Type B ( SM - 2)
+ // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
+ //
+ // ism : Serial module number from 0 to 23 for each plane
+
+
+ // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
+
+ double xcorner[24] =
+ {
+ 74.8833, 53.0045, 31.1255, //Type-A
+ 74.8833, 53.0045, 31.1255, //Type-A
+ -74.8833, -53.0044, -31.1255, //Type-AR
+ -74.8833, -53.0044, -31.1255, //Type-AR
+ 8.9165, -33.7471, //Type-B
+ 8.9165, -33.7471, //Type-B
+ 8.9165, -33.7471, //Type-B
+ -8.9165, 33.7471, //Type-BR
+ -8.9165, 33.7471, //Type-BR
+ -8.9165, 33.7471, //Type-BR
+ };
+
+
+ double ycorner[24] =
+ {
+ 86.225, 86.225, 86.225, //Type-A
+ 37.075, 37.075, 37.075, //Type-A
+ -86.225, -86.225, -86.225, //Type-AR
+ -37.075, -37.075, -37.075, //Type-AR
+ 86.225, 86.225, //Type-B
+ 61.075, 61.075, //Type-B
+ 35.925, 35.925, //Type-B
+ -86.225, -86.225, //Type-BR
+ -61.075, -61.075, //Type-BR
+ -35.925, -35.925 //Type-BR
+ };
+
+
+ const Float_t kSqroot3 = 1.73205; // sqrt(3.);
+ const Float_t kCellRadius = 0.25;
+
+ //
+ //Every even row of cells is shifted and placed
+ //in geant so this condition
+ //
+ Float_t cellRadius = 0.25;
+ Float_t shift = 0.0;
+ if(xpad%2 == 0)
+ {
+ shift = -cellRadius/2.0;
+ }
+ else
+ {
+ shift = 0.0;
+ }
+
+
+ if(ism < 6)
+ {
+ ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >=6 && ism < 12)
+ {
+ ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >= 12 && ism < 18)
+ {
+ ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >= 18 && ism < 24)
+ {
+ ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
+ }
+
+}
+
+void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
+{
+ // If the xpad and ypad inputs are float, then 0.5 is added to it
+ // to find the layer which is shifted.
+ // This routine finds the cell eta,phi for the new PMD rectangular
+ // geometry in ALICE
+ // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
+ // modified by B. K. Nnadi for change of coordinate sys
+ //
+ // SMA ---> Supermodule Type A ( SM - 0)
+ // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
+ // SMB ---> Supermodule Type B ( SM - 2)
+ // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
+ //
+ // ism : Serial Module number from 0 to 23 for each plane
+
+ // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
+
+ double xcorner[24] =
+ {
+ 74.8833, 53.0045, 31.1255, //Type-A
+ 74.8833, 53.0045, 31.1255, //Type-A
+ -74.8833, -53.0044, -31.1255, //Type-AR
+ -74.8833, -53.0044, -31.1255, //Type-AR
+ 8.9165, -33.7471, //Type-B
+ 8.9165, -33.7471, //Type-B
+ 8.9165, -33.7471, //Type-B
+ -8.9165, 33.7471, //Type-BR
+ -8.9165, 33.7471, //Type-BR
+ -8.9165, 33.7471, //Type-BR
+ };
+
+
+
+ double ycorner[24] =
+ {
+ 86.225, 86.225, 86.225, //Type-A
+ 37.075, 37.075, 37.075, //Type-A
+ -86.225, -86.225, -86.225, //Type-AR
+ -37.075, -37.075, -37.075, //Type-AR
+ 86.225, 86.225, //Type-B
+ 61.075, 61.075, //Type-B
+ 35.925, 35.925, //Type-B
+ -86.225, -86.225, //Type-BR
+ -61.075, -61.075, //Type-BR
+ -35.925, -35.925 //Type-BR
+ };
+
+
+ const Float_t kSqroot3 = 1.73205; // sqrt(3.);
+ const Float_t kCellRadius = 0.25;
+
+ //
+ //Every even row of cells is shifted and placed
+ //in geant so this condition
+ //
+ Float_t cellRadius = 0.25;
+ Float_t shift = 0.0;
+ Int_t iirow = (Int_t) (xpad+0.5);
+ if(iirow%2 == 0)
+ {
+ shift = -cellRadius/2.0;
+ }
+ else
+ {
+ shift = 0.0;
+ }
+
+ if(ism < 6)
+ {
+ ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >=6 && ism < 12)
+ {
+ ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >= 12 && ism < 18)
+ {
+ ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
+ }
+ else if(ism >= 18 && ism < 24)
+ {
+ ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
+ xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
+ }
+
+}
+void AliPMDUtility::ApplyVertexCorrection(Float_t vertex[], Float_t xpos,
+ Float_t ypos, Float_t zpos)
+{
+ // Not implemented
+ fPx = xpos - vertex[0];
+ fPy = ypos - vertex[1];
+ fPz = zpos - vertex[2];
+}
+void AliPMDUtility::ApplyAlignment()
+{
+ // Not implemented
+}
+
+void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
+{
+ fPx = px;
+ fPy = py;
+ fPz = pz;
+}
+
+void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
+{
+ fPx = xpos;
+ fPy = ypos;
+ fPz = zpos;
+}
+void AliPMDUtility::CalculateEta()
+{
+ Float_t rpxpy, theta, eta;
+
+ rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
+ theta = TMath::ATan2(rpxpy,fPz);
+ eta = -TMath::Log(TMath::Tan(0.5*theta));
+ fTheta = theta;
+ fEta = eta;
+}
+void AliPMDUtility::CalculatePhi()
+{
+ Float_t pybypx, phi = 0., phi1;
+
+ if(fPx==0)
+ {
+ if(fPy>0) phi = 90.;
+ if(fPy<0) phi = 270.;
+ }
+ if(fPx != 0)
+ {
+ pybypx = fPy/fPx;
+ if(pybypx < 0) pybypx = - pybypx;
+ phi1 = TMath::ATan(pybypx)*180./3.14159;
+
+ if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
+ if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
+ if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
+ if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
+
+ }
+ phi = phi*3.14159/180.;
+
+ fPhi = phi;
+
+}
+void AliPMDUtility::CalculateEtaPhi()
+{
+ Float_t rpxpy, theta, eta;
+ Float_t pybypx, phi = 0., phi1;
+
+ rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
+ theta = TMath::ATan2(rpxpy,fPz);
+ eta = -TMath::Log(TMath::Tan(0.5*theta));
+
+ if(fPx == 0)
+ {
+ if(fPy>0) phi = 90.;
+ if(fPy<0) phi = 270.;
+ }
+ if(fPx != 0)
+ {
+ pybypx = fPy/fPx;
+ if(pybypx < 0) pybypx = - pybypx;
+ phi1 = TMath::ATan(pybypx)*180./3.14159;
+ if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
+ if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
+ if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
+ if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
+
+ }
+ phi = phi*3.14159/180.;
+
+ fTheta = theta;
+ fEta = eta;
+ fPhi = phi;
+}
+void AliPMDUtility::CalculateXY(Float_t eta, Float_t phi, Float_t zpos)
+{
+ // Not implemented
+
+ // eta = -TMath::Log(TMath::Tan(0.5*theta));
+
+ Float_t xpos = 0., ypos = 0.;
+
+ // Float_t theta = 2.0*TMath::ATan(TMath::Log(-eta));
+
+ fEta = eta;
+ fPhi = phi;
+ fPx = xpos;
+ fPy = ypos;
+ fPz = zpos;
+}
+Float_t AliPMDUtility::GetTheta() const
+{
+ return fTheta;
+}
+Float_t AliPMDUtility::GetEta() const
+{
+ return fEta;
+}
+Float_t AliPMDUtility::GetPhi() const
+{
+ return fPhi;
+}
+Float_t AliPMDUtility::GetX() const
+{
+ return fPx;
+}
+Float_t AliPMDUtility::GetY() const
+{
+ return fPy;
+}
+Float_t AliPMDUtility::GetZ() const
+{
+ return fPz;
+}
+
--- /dev/null
+#ifndef ALIPMDUTILITY_H
+#define ALIPMDUTILITY_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//-----------------------------------------------------//
+// //
+// //
+// Date : August 05 2003 //
+// //
+// Utility class for PMD //
+// //
+//-----------------------------------------------------//
+// Author - B.K. Nandi
+//
+#include "Rtypes.h"
+class AliPMDUtility
+{
+ public:
+ AliPMDUtility();
+ AliPMDUtility(Float_t px, Float_t py, Float_t pz);
+ AliPMDUtility(const AliPMDUtility &pmdutil); // copy constructor
+ AliPMDUtility &operator=(const AliPMDUtility &pmdutil); // assignment op
+ virtual ~AliPMDUtility();
+
+
+ void RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad,
+ Float_t & xpos, Float_t & ypos);
+ void RectGeomCellPos(Int_t ism, Float_t xpad, Float_t ypad,
+ Float_t & xpos, Float_t & ypos);
+ void ApplyVertexCorrection(Float_t vertex[],
+ Float_t xpos, Float_t ypos, Float_t zpos);
+ void ApplyAlignment();
+ void SetPxPyPz(Float_t px, Float_t py, Float_t pz);
+ void SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos);
+ void CalculateEta();
+ void CalculatePhi();
+ void CalculateEtaPhi();
+ void CalculateXY(Float_t eta, Float_t phi, Float_t zpos);
+ Float_t GetTheta() const;
+ Float_t GetEta() const;
+ Float_t GetPhi() const;
+ Float_t GetX() const;
+ Float_t GetY() const;
+ Float_t GetZ() const;
+
+ protected:
+ Float_t fPx; // Momentum along x
+ Float_t fPy; // Momentum along y
+ Float_t fPz; // Momentum along z
+ Float_t fTheta; // Polar angle in radian
+ Float_t fEta; // Pseudo-rapidity
+ Float_t fPhi; // Azimuthal angle in radian
+
+ ClassDef(AliPMDUtility,4) // Utility class for the detector set:PMD
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//______________________________________________________________________________
+// An analysis task to check the T0 data in simulated data
+//
+//*-- Alla Maevskaya
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TH1F.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TFile.h>
+
+#include "AliT0QATask.h"
+#include "AliESD.h"
+#include "AliLog.h"
+#include "AliESDVertex.h"
+
+//______________________________________________________________________________
+AliT0QATask::AliT0QATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhT01(0),
+ fhT02(0),
+ fhT03(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+AliT0QATask::~AliT0QATask()
+{
+ // dtor
+ fOutputContainer->Clear() ;
+ delete fOutputContainer ;
+
+ delete fhT01 ;
+ delete fhT02 ;
+ delete fhT03 ;
+}
+
+//______________________________________________________________________________
+void AliT0QATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+
+ fhT01 = new TH1F("hRealVertex", "Primary vertex", 100, -20, 20);
+ fhT02 = new TH1F("hT0start", "T0 start time", 100, 12400, 12600);
+ fhT03 = new TH1F("hT0vertex", "T0vertex", 100, -20, 20);
+
+
+ // create output container
+
+ fOutputContainer = new TObjArray(3) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhT01, 0) ;
+ fOutputContainer->AddAt(fhT02, 1) ;
+ fOutputContainer->AddAt(fhT03, 2) ;
+}
+
+//______________________________________________________________________________
+void AliT0QATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ T0 *************************************
+
+ const AliESDVertex * vertex = fESD->GetPrimaryVertex() ;
+ Double_t posZ = vertex->GetZv() ;
+ fhT01->Fill( posZ ) ;
+
+ fhT02->Fill( fESD->GetT0() ) ;
+
+ fhT03->Fill( fESD->GetT0zVertex() / 2. ) ;
+
+ PostData(0, fOutputContainer);
+
+}
+
+//______________________________________________________________________________
+void AliT0QATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ Float_t mean = fhT02->GetMean();
+
+ printf ("mean time T0 ps %f\n", mean) ;
+
+ if ( mean > 12600 || mean < 12400 )
+ AliWarning (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------");
+
+ TCanvas * cTO1 = new TCanvas("cT01", "T0 ESD Test", 400, 10, 600, 700) ;
+ cTO1->Divide(2, 2) ;
+
+ cTO1->cd(1) ;
+ fhT01->Draw() ;
+
+ cTO1->cd(2) ;
+ fhT02->Draw() ;
+
+ cTO1->cd(3) ;
+ fhT03->Draw() ;
+
+
+ cTO1->Print("T0.eps");
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIT0QATASK_H
+#define ALIT0QATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the T0 data in simulated data
+//
+//*-- Alla Maevskaya
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TNtuple ;
+class TH1D ;
+class TH1I ;
+
+class AliT0QATask : public AliAnalysisTask {
+
+public:
+ AliT0QATask(const char *name) ;
+ virtual ~AliT0QATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+ TH1F * fhT01;
+ TH1F * fhT02;
+ TH1F * fhT03;
+
+ ClassDef(AliT0QATask, 0); // a T0 photon analysis task
+};
+#endif // ALIT0QATASK_H
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//_________________________________________________________________________
+// An analysis task to check the TOF data in simulated data
+//
+//*-- Silvia Arcelli
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TCanvas.h>
+#include <TFile.h>
+
+#include "AliTOFQATask.h"
+#include "AliESD.h"
+#inclued "AliESDtrack.h"
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliTOFQATask::AliTOFQATask(const char *name) :
+ AliAnalysisTask(name,""),
+ fChain(0),
+ fESD(0),
+ fhTOF(0),
+ fhTOFEnergy(0),
+ fhTOFDigits(0),
+ fhTOFRecParticles(0),
+ fhTOFPhotons(0),
+ fhTOFInvariantMass(0),
+ fhTOFDigitsEvent(0)
+{
+ // Constructor.
+ // Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(0, TObjArray::Class()) ;
+}
+
+//______________________________________________________________________________
+void AliTOFQATask::Init(const Option_t*)
+{
+ // Initialisation of branch container and histograms
+
+ AliInfo(Form("*** Initialization of %s", GetName())) ;
+
+ // Get input data
+ fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+ if (!fChain) {
+ AliError(Form("Input 0 for %s not found\n", GetName()));
+ return ;
+ }
+
+ if (!fESD) {
+ // One should first check if the branch address was taken by some other task
+ char ** address = (char **)GetBranchAddress(0, "ESD") ;
+ if (address)
+ fESD = (AliESD *)(*address) ;
+ if (!fESD)
+ fChain->SetBranchAddress("ESD", &fESD) ;
+ }
+ // The output objects will be written to
+ TDirectory * cdir = gDirectory ;
+ // Open a file for output #0
+ char outputName[1024] ;
+ sprintf(outputName, "%s.root", GetName() ) ;
+ OpenFile(0, outputName , "RECREATE") ;
+ if (cdir)
+ cdir->cd() ;
+
+ // create histograms
+ fhTOFSector = new TH1F("hSector", " TOF TrackRefs, sector # ", 18, 0., 18.) ;
+ fhTOFSectorM = new TH1F("hSectorM", " TOF Matched, sector # ", 18, 0., 18.) ;
+ fhTOFSectorMF = new TH1F("hSectorMF", " TOF Matched G, sector # ", 18, 0., 18.) ;
+ fhTOFSectorMG = new TH1F("hSectorMG", " TOF Matched F , sector # ", 18, 0., 18.) ;
+ fhTOFprimP = new TH1F("hprimP", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPpi = new TH1F("hprimPpi", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPka = new TH1F("hprimPka", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPpr = new TH1F("hprimPpr", " TPC mom tracks", 20, 0., 4.) ;
+
+
+ // Reaching TOF,prim
+ fhTOFprimPTOF = new TH1F("hprimPTOF", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpi = new TH1F("hprimPTOFpi", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFka = new TH1F("hprimPTOFka", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpr = new TH1F("hprimPTOFpr", " TPC mom tracks", 20, 0., 4.) ;
+
+
+ // Well matched,prim
+ fhTOFprimPTOF3 = new TH1F("hprimPTOF3", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpi3 = new TH1F("hprimPTOFpi3", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFka3 = new TH1F("hprimPTOFka3", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpr3 = new TH1F("hprimPTOFpr3", " TPC mom tracks", 20, 0., 4.) ;
+
+ // bad matched,prim
+ fhTOFprimPTOF4 = new TH1F("hprimPTOF4", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpi4 = new TH1F("hprimPTOFpi4", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFka4 = new TH1F("hprimPTOFka4", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpr4 = new TH1F("hprimPTOFpr4", " TPC mom tracks", 20, 0., 4.) ;
+
+ // matched,prim
+ fhTOFprimPTOF34 = new TH1F("hprimPTOF34", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpi34 = new TH1F("hprimPTOFpi34", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFka34 = new TH1F("hprimPTOFka34", " TPC mom tracks", 20, 0., 4.) ;
+ fhTOFprimPTOFpr34 = new TH1F("hprimPTOFpr34", " TPC mom tracks", 20,0 ., 4.) ;
+
+ // create output container
+
+ fOutputContainer = new TObjArray(24) ;
+ fOutputContainer->SetName(GetName()) ;
+
+ fOutputContainer->AddAt(fhTOFSector, 0) ;
+ fOutputContainer->AddAt(fhTOFSectorM, 1) ;
+ fOutputContainer->AddAt(fhTOFSectorMF, 2) ;
+ fOutputContainer->AddAt(fhTOFSectorMG, 3) ;
+ fOutputContainer->AddAt(fhTOFprimP, 4) ;
+ fOutputContainer->AddAt(fhTOFprimPpi, 5) ;
+ fOutputContainer->AddAt(fhTOFprimPka, 6) ;
+ fOutputContainer->AddAt(fhTOFprimPpr, 7) ;
+ fOutputContainer->AddAt(fhTOFprimPTOF, 8) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpi, 9) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFka, 10) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpr, 11) ;
+ fOutputContainer->AddAt(fhTOFprimPTOF3, 12) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpi3, 13) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFka3, 14) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpr3, 15) ;
+ fOutputContainer->AddAt(fhTOFprimPTOF4, 16) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpi4, 17) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFka4, 18) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpr4, 19) ;
+ fOutputContainer->AddAt(fhTOFprimPTOF34, 20) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpi34, 21) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFka34, 22) ;
+ fOutputContainer->AddAt(fhTOFprimPTOFpr34, 23) ;
+
+}
+
+//______________________________________________________________________________
+void AliTOFQATask::Exec(Option_t *)
+{
+ // Processing of one event
+
+ Long64_t entry = fChain->GetReadEntry() ;
+
+ if (!fESD) {
+ AliError("fESD is not connected to the input!") ;
+ return ;
+ }
+
+ if ( !((entry-1)%100) )
+ AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
+
+ // ************************ TOF *************************************
+ const Int_t knCalinSec = 8736 ;
+
+ Int_t ntrk = fESD->GetNumberOfTracks() ;
+ while ( ntrk-- ) {
+ AliESDtrack * t = fESD->GetTrack(ntrk) ;
+ if ( (t->GetStatus() & AliESDtrack::kTIME)==0 )
+ continue;
+ Int_t label = TMath::Abs(t->GetLabel()) ;
+ Double_t p = t->GetP() ;
+ UInt_t assignedTOFcluster = t->GetTOFcluster() ; //index of the assigned TOF cluster, >0 ?
+ Int_t detid = t->GetTOFCalChannel() ; //index of the assigned TOF cluster, >0 ?
+
+ Int_t sector = detid / knCalinSec ;
+
+ if(assignedTOFcluster){ //matched
+ hSectorM->Fill(sector);
+ }
+ }
+
+ PostData(0, fOutputContainer);
+
+
+}
+
+//______________________________________________________________________________
+void AliTOFQATask::Terminate(Option_t *)
+{
+ // Processing when the event loop is ended
+
+ // some plots
+
+ char line[1024] ;
+ sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
+ gROOT->ProcessLine(line);
+ sprintf(line, ".!rm -fR *.eps");
+ gROOT->ProcessLine(line);
+
+ AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+}
--- /dev/null
+#ifndef ALIPHOSQATASK_H
+#define ALIPHOSQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+//______________________________________________________________________________
+// An analysis task to check the PHOS photon data in simulated data
+//
+//*-- Yves Schutz
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+#include "AliAnalysisTask.h"
+
+class AliESD ;
+class TNtuple ;
+class TH1D ;
+class TH1I ;
+
+class AliPHOSQATask : public AliAnalysisTask {
+
+public:
+ AliPHOSQATask(const char *name) ;
+ virtual ~AliPHOSQATask() ;
+
+ virtual void Exec(Option_t * opt = "") ;
+ virtual void Init(Option_t * opt = "") ;
+ virtual void Terminate(Option_t * opt = "") ;
+
+private:
+ TTree * fChain ; //!pointer to the analyzed TTree or TChain
+ AliESD * fESD ; //! Declaration of leave types
+
+ TObjArray * fOutputContainer ; //! output data container
+
+ // Histograms
+ TNtuple * fhPHOSPos ;
+ TNtuple * fhPHOS ;
+ TH1D * fhPHOSEnergy ;
+ TH1I * fhPHOSDigits ;
+ TH1D * fhPHOSRecParticles ;
+ TH1I * fhPHOSPhotons ;
+ TH1D * fhPHOSInvariantMass ;
+ TH1I * fhPHOSDigitsEvent ;
+
+ ClassDef(AliPHOSQATask, 0); // a PHOS photon analysis task
+};
+#endif // ALIPHOSQATASK_H
--- /dev/null
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliAnalysisGoodies+;
+#pragma link C++ class AliPHOSQATask+;
+
+#pragma link C++ class AliEMCALQATask+;
+
+#pragma link C++ class AliPMDQATask+;
+#pragma link C++ class AliPMDUtility+;
+
+#pragma link C++ class AliAnalysisTaskPt+;
+
+#pragma link C++ class AliHMPIDQATask+;
+
+#pragma link C++ class AliT0QATask+;
+
+#pragma link C++ class AliMUONQATask+;
+
+#pragma link C++ class AliFMDQATask+;
+
+#endif
--- /dev/null
+
+include $(ROOTSYS)/test/Makefile.arch
+
+default-target: libAnalysisCheck.so
+
+ALICEINC = -I.
+
+### define include dir for local case and par case
+ifneq ($(ANALYSIS_NEW_INCLUDE),)
+ ALICEINC += -I../$(ESD_INCLUDE) -I../$(ANALYSIS_NEW_INCLUDE)
+else
+ ifneq ($(ALICE_ROOT),)
+ ALICEINC += -I$(ALICE_ROOT)/include
+ endif
+endif
+
+# for building of AnalysisCheck.par
+ifneq ($(AnalysisCheck_INCLUDE),)
+ ALICEINC += -I../$(AnalysisCheck_INCLUDE)
+endif
+
+CXXFLAGS += $(ALICEINC) -g
+
+PACKAGE = AnalysisCheck
+include lib$(PACKAGE).pkg
+
+DHDR_AnalysisCheck := $(DHDR)
+HDRS_AnalysisCheck := $(HDRS)
+SRCS_AnalysisCheck := $(SRCS) G__$(PACKAGE).cxx
+OBJS_AnalysisCheck := $(SRCS_AnalysisCheck:.cxx=.o)
+
+PARFILE = $(PACKAGE).par
+
+
+lib$(PACKAGE).so: $(OBJS_AnalysisCheck)
+ @echo "Linking" $@ ...
+ @/bin/rm -f $@
+ifeq ($(PLATFORM),macosx)
+ @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
+else
+ @$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
+endif
+ @chmod a+x $@
+ @echo "done"
+
+%.o: %.cxx %.h
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+clean:
+ @rm -f $(OBJS_AnalysisCheck) *.so G__$(PACKAGE).* $(PARFILE)
+
+G__$(PACKAGE).cxx G__$(PACKAGE).h: $(HDRS) $(DHDR)
+ @echo "Generating dictionary ..."
+ rootcint -f $@ -c $(ALICEINC) $^
+
+### CREATE PAR FILE
+
+$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_AnalysisCheck) $(SRCS_AnalysisCheck) $(DHDR_AnalysisCheck) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
+ @echo "Creating archive" $@ ...
+ @tar cfzh $@ $(PACKAGE)
+ @rm -rf $(PACKAGE)
+ @echo "done"
+
+$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
+ @echo Copying $< to $@ with transformations
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
+ @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
+
+$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
+ @echo Copying $< to $@
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
+ @cp -a $^ $@
+
+$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
+ @echo Copying $< to $@
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
+ @cp -a -r $^ $@
+
+$(PACKAGE)/%: %
+ @echo Copying $< to $@
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
+ @cp -a $< $@
+
+test-%.par: %.par
+ @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
+ @mkdir -p par-tmp
+ @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
+ @rm -rf par-tmp
+ @echo "INFO: Testing succeeded (already cleaned up)"
--- /dev/null
+Bool_t gIsAnalysisLoaded = kFALSE ;
+
+//______________________________________________________________________
+Bool_t LoadLib( const char* pararchivename)
+{
+ // Loads the AliRoot required libraries from a tar file
+
+ Bool_t rv = kTRUE ;
+
+ char cdir[1024] ;
+ sprintf(cdir, "%s", gSystem->WorkingDirectory() ) ;
+
+ // Setup par File
+ if (pararchivename) {
+ char processline[1024];
+ sprintf(processline,".! tar xvzf %s.par",pararchivename);
+ gROOT->ProcessLine(processline);
+ gSystem->ChangeDirectory(pararchivename);
+
+ // check for BUILD.sh and execute
+ if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
+ printf("*** Building PAR archive %s ***\n", pararchivename);
+
+ if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
+ AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) );
+
+ return kFALSE ;
+ }
+ }
+
+ // check for SETUP.C and execute
+ if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
+ printf("*** Setup PAR archive %s ***\n", pararchivename);
+ gROOT->Macro("PROOF-INF/SETUP.C");
+ }
+ }
+
+ if ( strstr(pararchivename, "ESD") ) {
+ gSystem->Load("libVMC.so");
+ gSystem->Load("libESD.so");
+ gSystem->Load("libRAliEn.so") ;
+ gSystem->Load("libProof.so") ;
+ }
+
+ printf("*** %s library loaded *** %s **\n", pararchivename);
+
+ gSystem->ChangeDirectory(cdir);
+
+ gIsAnalysisLoaded = kTRUE ;
+ return rv ; ;
+}
+
+//______________________________________________________________________
+void ana()
+{
+ if (! gIsAnalysisLoaded ) {
+ LoadLib("ESD") ;
+ LoadLib("ANALYSIS_NEW") ;
+ printf("Include path = %s\n", gSystem->GetIncludePath()) ;
+ LoadLib("AnalysisCheck") ;
+ }
+
+ // create the analysis goodies object
+ AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
+
+ // definition of analysis tasks
+
+ const Int_t knumberOfTasks = 8 ;
+ AliAnalysisTask * taskList[knumberOfTasks] ;
+ TClass * taskInputList[knumberOfTasks] ;
+ TClass * taskOutputList[knumberOfTasks] ;
+
+ taskList[0] = new AliPHOSQATask("PHOS") ;
+ taskInputList[0] = TChain::Class() ;
+ taskOutputList[0] = TObjArray::Class() ;
+
+ taskList[1] = new AliEMCALQATask("EMCal") ;
+ taskInputList[1] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[1] = TObjArray::Class() ;
+
+ taskList[2] = new AliPMDQATask("PMD") ;
+ taskInputList[2] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[2] = TObjArray::Class() ;
+
+ taskList[3] = new AliAnalysisTaskPt("Pt") ;
+ taskInputList[3] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[3] = TObjArray::Class() ;
+
+ taskList[4] = new AliHMPIDQATask("HMPID") ;
+ taskInputList[4] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[4] = TObjArray::Class() ;
+
+ taskList[5] = new AliT0QATask("T0") ;
+ taskInputList[5] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[5] = TObjArray::Class() ;
+
+ taskList[6] = new AliMUONQATask("MUON") ;
+ taskInputList[6] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[6] = TObjArray::Class() ;
+
+ taskList[7] = new AliFMDQATask("FMD") ;
+ taskInputList[7] = taskInputList[0] ; // only one top input container allowed
+ taskOutputList[7] = TObjArray::Class() ;
+
+ ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ;
+
+ // get the data to analyze
+
+ // definition of Tag cuts
+ const char * runCuts = 0x0 ;
+ const char * evtCuts = "fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ;
+
+
+ TString input = gSystem->Getenv("ANA_INPUT") ;
+ if ( input != "") {
+ char argument[1024] ;
+ if ( input.Contains("tag?") ) {
+ //create the ESD collection from the tag collection
+ input.ReplaceAll("tag?", "") ;
+ const char * collESD = "esdCollection.xml" ;
+ ag->MakeEsdCollectionFromTagCollection(runCuts, evtCuts, input.Data(), collESD) ;
+ sprintf(argument, "esd?%s", collESD) ;
+ } else if ( input.Contains("esd?") )
+ argument = input.Data() ;
+ ag->Process(argument) ;
+
+ } else {
+
+ TChain* analysisChain = new TChain("esdTree") ;
+ // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ;
+ // analysisChain->AddFile(input);
+ input = "AliESDs.root" ;
+ analysisChain->AddFile(input);
+ ag->Process(analysisChain) ;
+ }
+}
+
+//______________________________________________________________________
+void Merge(const char * xml, const char * sub, const char * out)
+{
+ if (! gIsAnalysisLoaded )
+ LoadLib("ESD") ;
+
+ AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
+ ag->Merge(xml, sub, out) ;
+}
+
+//______________________________________________________________________
+void test(const char * fcollection1)
+{
+ AliXMLCollection collection1(fcollection1);
+ TChain* analysisChain = new TChain("esdTree");
+
+ collection1.Reset();
+ while (collection1.Next()) {
+ cout<<"Adding "<<collection1.GetTURL()<<endl;
+ analysisChain->Add(collection1.GetTURL());
+ }
+
+ return ;
+}
void SETUP()
{
- // Load some ROOT libraries
- gSystem->Load("libEG");
- gSystem->Load("libGeom");
// Load the ESD library
- gSystem->Load("libESD");
+ gSystem->Load("libAnalysisCheck");
- // Set the Inlucde paths
- gSystem->SetIncludePath("-I$ROOTSYS/include -IESD");
- gROOT->ProcessLine(".include ESD");
+ // Set the Include paths
+ gSystem->SetIncludePath("-I$ROOTSYS/include -IAnalysisCheck");
+ gROOT->ProcessLine(".include AnalysisCheck");
// Set our location, so that other packages can find us
- gSystem->Setenv("ESD_INCLUDE", "ESD");
+ gSystem->Setenv("AnalysisCheck_INCLUDE", "AnalysisCheck");
}