// Latest changes by Christian Holm Christensen
//
#include "AliFMDInput.h" // ALIFMDHIT_H
-#include "AliLog.h" // ALILOG_H
+#include "AliFMDDebug.h" // ALIFMDDEBUG_H ALILOG_H
#include "AliLoader.h" // ALILOADER_H
#include "AliRunLoader.h" // ALIRUNLOADER_H
#include "AliRun.h" // ALIRUN_H
#include <TGeoManager.h> // ROOT_TGeoManager
#include <TSystemDirectory.h> // ROOT_TSystemDirectory
#include <Riostream.h> // ROOT_Riostream
-
+#include <TFile.h> // ROOT_TFile
+#include <TStreamerInfo.h>
//____________________________________________________________________
ClassImp(AliFMDInput)
#if 0
fTreeD(0),
fTreeS(0),
fTreeR(0),
+ fTreeA(0),
fChainE(0),
fArrayE(0),
fArrayH(0),
fArrayS(0),
fArrayR(0),
fArrayA(0),
+ fGeoManager(0),
fTreeMask(0),
fIsInit(kFALSE)
{
fTreeD(0),
fTreeS(0),
fTreeR(0),
+ fTreeA(0),
fChainE(0),
fArrayE(0),
fArrayH(0),
fArrayS(0),
fArrayR(0),
fArrayA(0),
+ fGeoManager(0),
fTreeMask(0),
fIsInit(kFALSE)
{
AliAlignObjAngles* a = static_cast<AliAlignObjAngles*>(array->At(i));
if (!a->ApplyToGeometry()) {
AliWarning(Form("Failed to apply alignment to %s",
- a->GetVolPath()));
+ a->GetSymName()));
}
}
}
AliInfo(Form("Now in event %d/%d", event, NEvents()));
// Possibly load global kinematics information
- if (TESTBIT(fTreeMask, kKinematics)) {
+ if (TESTBIT(fTreeMask, kKinematics) || TESTBIT(fTreeMask, kTracks)) {
AliInfo("Getting kinematics");
if (fLoader->LoadKinematics()) return kFALSE;
fStack = fLoader->Stack();
}
// Possibly load FMD Hit information
- if (TESTBIT(fTreeMask, kHits)) {
+ if (TESTBIT(fTreeMask, kHits) || TESTBIT(fTreeMask, kTracks)) {
AliInfo("Getting FMD hits");
if (fFMDLoader->LoadHits()) return kFALSE;
fTreeH = fFMDLoader->TreeH();
AliInfo("Getting FMD digits");
if (fFMDLoader->LoadDigits()) return kFALSE;
fTreeD = fFMDLoader->TreeD();
- if (!fArrayD) fArrayD = fFMD->Digits();
+ if (fTreeD) {
+ if (!fArrayD) fArrayD = fFMD->Digits();
+ }
+ else {
+ fArrayD = 0;
+ AliWarning(Form("Failed to load FMD Digits"));
+ }
}
// Possibly load FMD Sdigit information
if (TESTBIT(fTreeMask, kSDigits)) {
if (read <= 0) return kFALSE;
fESD = fMainESD->GetFMDData();
if (!fESD) return kFALSE;
+ TFile* f = fChainE->GetFile();
+ if (f) {
+ TObject* o = f->GetStreamerInfoList()->FindObject("AliFMDMap");
+ if (o) {
+ TStreamerInfo* info = static_cast<TStreamerInfo*>(o);
+ std::cout << "AliFMDMap class version read is "
+ << info->GetClassVersion() << std::endl;
+ }
+ }
+ // fESD->CheckNeedUShort(fChainE->GetFile());
}
// Possibly load FMD Digit information
if (TESTBIT(fTreeMask, kRaw)) {
//
if (TESTBIT(fTreeMask, kHits))
if (!ProcessHits()) return kFALSE;
+ if (TESTBIT(fTreeMask, kTracks))
+ if (!ProcessTracks()) return kFALSE;
if (TESTBIT(fTreeMask, kDigits))
if (!ProcessDigits()) return kFALSE;
if (TESTBIT(fTreeMask, kSDigits))
if (TESTBIT(fTreeMask, kRecPoints))
if (!ProcessRecPoints()) return kFALSE;
if (TESTBIT(fTreeMask, kESD))
- if (!ProcessESD(fESD)) return kFALSE;
+ if (!ProcessESDs()) return kFALSE;
return kTRUE;
}
return kTRUE;
}
+//____________________________________________________________________
+Bool_t
+AliFMDInput::ProcessTracks()
+{
+ // Read the hit tree, and pass each hit to the member function
+ // ProcessHit.
+ if (!fStack) {
+ AliError("No track tree defined");
+ return kFALSE;
+ }
+ if (!fTreeH) {
+ AliError("No hit tree defined");
+ return kFALSE;
+ }
+ Int_t nTracks = fTreeH->GetEntries();
+ for (Int_t i = 0; i < nTracks; i++) {
+ TParticle* track = fStack->Particle(i);
+ if (!track) continue;
+ Int_t hitRead = fTreeH->GetEntry(i);
+ if (hitRead <= 0) continue;
+ if (!fArrayH) {
+ AliError("No hit array defined");
+ return kFALSE;
+ }
+ Int_t nHit = fArrayH->GetEntries();
+ if (nHit <= 0) continue;
+
+ for (Int_t j = 0; j < nHit; j++) {
+ AliFMDHit* hit = static_cast<AliFMDHit*>(fArrayH->At(j));
+ if (!hit) continue;
+ if (!ProcessTrack(i, track, hit)) return kFALSE;
+ }
+ // if (!ProcessTrack(i, track, fArrayH)) return kFALSE;
+ }
+ return kTRUE;
+}
+
//____________________________________________________________________
Bool_t
AliFMDInput::ProcessDigits()
return kTRUE;
}
+//____________________________________________________________________
+Bool_t
+AliFMDInput::ProcessESDs()
+{
+ // Process event summary data
+ if (!fESD) return kFALSE;
+ for (UShort_t det = 1; det <= 3; det++) {
+ Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' };
+ for (Char_t* rng = rings; *rng != '\0'; rng++) {
+ UShort_t nsec = (*rng == 'I' ? 20 : 40);
+ UShort_t nstr = (*rng == 'I' ? 512 : 256);
+ for (UShort_t sec = 0; sec < nsec; sec++) {
+ for (UShort_t str = 0; str < nstr; str++) {
+ Float_t eta = fESD->Eta(det,*rng,sec,str);
+ Float_t mult = fESD->Multiplicity(det,*rng,sec,str);
+ if (!fESD->IsAngleCorrected())
+ mult *= TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta))));
+ if (!ProcessESD(det, *rng, sec, str, eta, mult)) continue;
+ }
+ }
+ }
+ }
+ return kTRUE;
+}
+
//____________________________________________________________________
Bool_t
AliFMDInput::End()
return fIsInit;
}
// Possibly unload global kinematics information
- if (TESTBIT(fTreeMask, kKinematics)) {
+ if (TESTBIT(fTreeMask, kKinematics) || TESTBIT(fTreeMask, kTracks)) {
fLoader->UnloadKinematics();
// fTreeK = 0;
fStack = 0;
}
// Possibly unload FMD Hit information
- if (TESTBIT(fTreeMask, kHits)) {
+ if (TESTBIT(fTreeMask, kHits) || TESTBIT(fTreeMask, kTracks)) {
fFMDLoader->UnloadHits();
fTreeH = 0;
}