* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+
+/* $Id$ */
//------------------------------------------------------------------------
// Jet reader base class
// manages the reading of input for jet algorithms
// Authors: jgcn@mda.cinvestav.mx
-// magali.estienne@IReS.in2p3.fr
+// magali.estienne@subatech.in2p3.fr
+// alexandre.shabetai@cern.ch
//
// **February 2011
// implemented standard geometry (AliEMCALGeometry) (was AliJetDummyGeo implented separately in ESDReader and AODReader
// ** August 2011
// OADB path changed from '../OADB/PWG4/JetReconstruction/' to '../OADB/EMCAL/'
// marco.bregant@subatech.in2p3.fr
-//-------------------------------------------------------------------------
+// ** 2011
+// - AliJetESD/AODReader classes removed from JETAN. Reader now ESD/AOD independent. It uses VEvent in the AliJetFill* classes.
+// - EMCal utilities added for bad cells id, calibration, etc.
+//------------------------------------------------------------------------
// root
-#include <TSystem.h>
-#include <TString.h>
-#include <TClonesArray.h>
-#include <TRefArray.h>
-#include "TTask.h"
-#include <TGeoManager.h>
+#include <TFile.h>
+
//AliRoot
-#include "AliLog.h"
+#include "AliVEvent.h"
+#include "AliAODEvent.h"
+#include "AliESDEvent.h"
#include "AliJetReader.h"
#include "AliJetReaderHeader.h"
-#include "AliESDEvent.h"
-#include "AliHeader.h"
-#include "AliEMCALGeometry.h"
-#include "AliEMCALEMCGeometry.h"
-#include "AliJetESDFillUnitArrayTracks.h"
-#include "AliJetESDFillUnitArrayEMCalDigits.h"
-#include "AliJetUnitArray.h"
-#include "AliJetHadronCorrectionv1.h"
-#include "AliOADBContainer.h"
+#include "AliAnalysisManager.h"
+#include "AliJetFillCalTrkTrack.h"
+#include "AliJetFillCalTrkTrackMC.h"
+#include "AliJetCalTrk.h"
using std::cout;
using std::endl;
ClassImp(AliJetReader)
////////////////////////////////////////////////////////////////////////
-AliEMCALGeometry *AliJetReader::fGeom=0;
+
AliJetReader::AliJetReader():
- // Constructor
- fJetanOADBpath(""),
- fChain(0),
- fTree(0),
- fMomentumArray(new TClonesArray("TLorentzVector",4000)),
- fArrayMC(0),
- fFillUnitArray(new TTask("fillUnitArray","Fill unit array jet finder")),
- fESD(0),
+ fCalTrkEvent(0x0),
+ fFillEvent(0x0),
fReaderHeader(0),
- fAliHeader(0),
- fSignalFlag(0),
- fCutFlag(0),
- fUnitArray(new TClonesArray("AliJetUnitArray",60000)),
- fArrayInitialised(0),
- fFillUAFromTracks(new AliJetESDFillUnitArrayTracks()),
- fFillUAFromEMCalDigits(new AliJetESDFillUnitArrayEMCalDigits()),
- fNumCandidate(0),
- fNumCandidateCut(0),
- fHadronCorrector(0),
- fHCorrection(0),
- fECorrection(0),
- fEFlag(kFALSE),
- fDebug(0)
+ fFillEventwTrks(0x0),
+ fDebug(0),
+ fVEvent(0x0),
+ fMCEvent(0x0),
+ fOpt(0)
{
// Default constructor
- fSignalFlag = TArrayI();
- fCutFlag = TArrayI();
}
-////////////////////////////////////////////////////////////////////////
-
+//-----------------------------------------------------------------------
AliJetReader::~AliJetReader()
{
// Destructor
- if (fMomentumArray) {
- fMomentumArray->Delete();
- delete fMomentumArray;
+ if (fCalTrkEvent) {
+ fCalTrkEvent->Delete();
+ delete fCalTrkEvent;
}
-
- if (fUnitArray) {
- fUnitArray->Delete();
- delete fUnitArray;
- }
-
- if (fFillUnitArray) {
- delete fFillUnitArray;
- }
- if (fArrayMC) {
- fArrayMC->Delete();
- delete fArrayMC;
+
+ if (fFillEventwTrks) {
+ delete fFillEventwTrks;
}
-
+
}
-////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
+void AliJetReader::InitTasks()
+{
+ // Initialization
+ fOpt = GetReaderHeader()->GetDetector();
+
+ TString datatype = fReaderHeader->GetDataType();
+ datatype.ToUpper();
+ Bool_t kIsKine = kFALSE;
+ if((!datatype.Contains("AOD") && datatype.Contains("MC")) ||
+ (!datatype.Contains("AOD") && datatype.Contains("MC2")) ){
+ kIsKine = kTRUE;
+ }
+ Bool_t kIsHighMult = GetReaderHeader()->GetIsHighMult();
+ fCalTrkEvent = new AliJetCalTrkEvent(fOpt,kIsKine,kIsHighMult);
+
+ // Initialize jet analysis
+ CreateTasks();
+
+}
-void AliJetReader::ClearArray()
+//-----------------------------------------------------------------------
+Bool_t AliJetReader::ProcessEvent()
{
- if (fMomentumArray) fMomentumArray->Clear();
- if (fFillUnitArray) fFillUnitArray->Clear();
+ // Process one event
+ // Charged only or charged+neutral jets
+
+ Bool_t ok = ExecTasks();
+
+ if(!ok) {return kFALSE;}
+
+ return kTRUE;
+
}
-Bool_t AliJetReader::SetEMCALGeometry()
+//-----------------------------------------------------------------------
+void AliJetReader::SetInputEvent(const TObject* esd, const TObject* aod, const AliMCEvent* mc)
{
- //
- // Set the EMCal Geometry
- //
-
- fDebug = fReaderHeader->GetDebug();
-
- if(fGeom != 0){
- Info(" SetEMCALGeometry:","was already done.. it's called just once !!");
- return kTRUE;
- }
-
- if(fDebug>9) cout<<"JetReader: Setting EMCALGeometry"<<endl;
+ // set input event pointers
+ if( fReaderHeader->GetDataType().Contains("AOD") && aod) {fVEvent = (AliAODEvent*) aod;}
+ else if( fReaderHeader->GetDataType().Contains("ESD") && esd) {fVEvent = (AliESDEvent*) esd;}
+ else if ( fReaderHeader->GetDataType().Contains("MC") || fReaderHeader->GetDataType().Contains("MC2")) { fMCEvent = (AliMCEvent*) mc;}
+ else {printf("No input event ! ");}
-//path to the OADB file
+}
+//-----------------------------------------------------------------------
+Bool_t AliJetReader::CreateTasks()
+{
+ // For reader task initialization
- TString myPath= fReaderHeader ->GetMyOADBfile();
- TString OADBfile;
+ fDebug = fReaderHeader->GetDebug();
- Bool_t customFile=kFALSE;
+ fFillEvent = new AliJetFillCalTrkEvent();
+ if (fOpt>0) {
+ // Tracks
+ if(fOpt%2==!0 && fOpt!=0){
+ fFillEventwTrks = new AliJetFillCalTrkTrack();
+ fFillEventwTrks->SetReaderHeader(fReaderHeader);
+ }
+ }
+ else { // MC/Kine cases
+ fFillEventwTrks = new AliJetFillCalTrkTrackMC();
+ fFillEventwTrks->SetReaderHeader(fReaderHeader);
+ }
+
+ if(fDebug>1) cout << "Tasks instantiated at that stage ! " << endl;
+
+ return kTRUE;
-if(myPath.Length()) {
- Info(" SetEMCALGeometry","custom version of OADB file: %s",myPath.Data());
- customFile=kTRUE;
- OADBfile=myPath;
- } else OADBfile.Form("%s/EMCAL/EMCALlocal2master.root",(const char*) fJetanOADBpath);
-
- AliOADBContainer EMCALgeoCont;
- Info(" SetEMCALGeometry"," I'm going to read the matrices from %s",OADBfile.Data());
- TObjArray *EmcalMatrArray;
- if(fDebug>19) cout<<"array definito"<<endl;
-
- EMCALgeoCont.InitFromFile((char*) OADBfile.Data(),"AliEMCALgeo");
- EMCALgeoCont.GetDefaultList()->Print();
-
- const char* geoType= fReaderHeader -> GetEMCALgeo2bLoad();
- if(fDebug>19) cout<<"geometry: "<<geoType<<endl;
-
- const char* loc2master = ((AliJetESDReaderHeader*) fReaderHeader)->GetEMCALmatrices2bLoad();
- if(fDebug>19) cout<<"matrices: "<<loc2master<<endl;
-
-
- if(fDebug>9) cout<<"geometry type is: "<<geoType<<endl;
- if(fDebug>9) cout<<"survey matrices are: "<<loc2master<<endl;
-
- // some crosschecks to avoid not existing cases
- if(!(!strcmp(geoType, "EMCAL_COMPLETE") || !strcmp(geoType, "EMCAL_COMPLETEV1") || !strcmp(geoType, "EMCAL_FIRSTYEARV1")) )
- Warning(" SetEMCALGeometry","%s is not a known good geometry! either your are using an old one or everything will crash right now!",geoType);
-
- if(! (!strcmp(loc2master, "survey10") || !strcmp(loc2master, "survey11") || !strcmp(loc2master, "ideal") || !strcmp(loc2master, "test")) ) {
- Warning(" SetEMCALGeometry"," %s is not one of the allowed cases (listed few lines above) !!----!!!", loc2master);
- loc2master="survey11";
- Warning(" SetEMCALGeometry"," to avoid crashes, your decision has been overrulled!, matrices '%s' will be used instead",loc2master);
- if(fDebug>9) cout<<"survey matrices are (new, after overrulling): "<<loc2master<<endl;
- }
-
-
- // some warning for not so orthodox combination
- if(!strcmp(geoType, "EMCAL_COMPLETE"))
- Warning(" SetEMCALGeometry:", "!!----!! this geometry contains wrong tilt angles for stripmodules.. are you really sure? please consider using EMCAL_COMPLETEV1 !! ---!! ");
- if( !strcmp(loc2master, "survey11") && strcmp(geoType, "EMCAL_COMPLETEV1") )
- Warning(" SetEMCALGeometry:", "!!----!! survey11 matrices should be used with EMCAL_COMPLETEV1 geometry !!---!!");
- if( !strcmp(loc2master, "survey10") && strcmp(geoType, "EMCAL_FIRSTYEARV1") )
- Warning(" SetEMCALGeometry", "!!----!! survey10 matrices should be used ONLY with EMCAL_FIRSTYEARV1 geometry!!");
- if(!strcmp(loc2master,"ideal"))
- Warning(" SetEMCALGeometry","!!----!! ideal matrices are without any survey (misalignment correction)... is it really what you want?");
- if(!strcmp(loc2master,"test") && !customFile)
- Warning(" SetEMCALGeometry","!!----!! 'test' matrices will be used. but it seems you didn't provide a custom version of OADB file, the default 'test' is as 'ideal', no survey (misalignment correction) !!----!!");
- if(!strcmp(loc2master,"test") && customFile)
- Info(" SetEMCALGeometry"," !!----!! 'test' matrices read from the custom file you provided !!----!!");
-
- EmcalMatrArray=(TObjArray*)EMCALgeoCont.GetObject(100,(char*) loc2master);
-
-
- // Define EMCAL geometry
-
- if(fDebug>10) cout<<"which EMCALgeometry is going to be uploaded?"<<geoType<<endl;
- fGeom = AliEMCALGeometry::GetInstance(geoType);
-
-
- for (Int_t mod=0;mod<(fGeom->GetEMCGeometry())->GetNumberOfSuperModules();mod+=1)
- {
- fGeom->SetMisalMatrix(((TGeoHMatrix*) EmcalMatrArray->At(mod)),mod);
- if(fDebug>9) cout<<"and the matrix is: SM "<<mod<<" (to print the matrix, fDebug>11!) "<<endl;
- if(fDebug>11) {
- cout<<"print the matrix, (will it work?)"<<endl;
- ((TGeoHMatrix*) EmcalMatrArray->At(mod))->Print();
- cout<<"if you read that, it did!"<<endl;
- }
}
+
+//-----------------------------------------------------------------------
+Bool_t AliJetReader::ExecTasks()
+{
+ // Main function
+ // Fill the reader part
- Info("\n SetEMCALGeometry:"," EMCal Geometry set ! \n");
-
+ fDebug = fReaderHeader->GetDebug();
+
+ if(!fVEvent && !fMCEvent) {
+ return kFALSE;
+ }
+
+ // TPC only or Digits+TPC or Clusters+TPC
+ if(fOpt%2==!0 || fOpt==0){
+ fFillEventwTrks->SetVEvent(fVEvent);
+ fFillEventwTrks->SetMCEvent(fMCEvent);
+ fFillEventwTrks->SetCalTrkEvent(fCalTrkEvent);
+ fFillEventwTrks->Exec("tpc");
+ }
+
return kTRUE;
+
}
+
+//-----------------------------------------------------------------------
+void AliJetReader::WriteRHeaderToFile() const
+{
+ // write reader header
+ AliJetReaderHeader *rh = GetReaderHeader();
+ rh->Write();
+
+}
+
+//-----------------------------------------------------------------------
+void AliJetReader::WriteReaderHeader()
+{
+ // Write the Headers
+ TFile* f = new TFile("jets_local.root", "recreate");
+ WriteRHeaderToFile();
+ f->Close();
+
+}
+