+ fNoiseFactor = savedNoiseFactor;
+ fAngleCorrect = savedAngleCorrect;
+}
+
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::MarkDeadChannels(AliESDFMD* esd) const
+{
+ // Loop over all entries of the ESD and mark
+ // those that are dead as such
+ // - otherwise put in the zero signal.
+ AliFMDParameters* param = AliFMDParameters::Instance();
+
+ for (UShort_t d = 1; d <= 3; d++) {
+ UShort_t nR = (d == 1 ? 1 : 2);
+
+ for (UShort_t q = 0; q < nR; q++) {
+ Char_t r = (q == 0 ? 'I' : 'O');
+ UShort_t nS = (q == 0 ? 20 : 40);
+ UShort_t nT = (q == 0 ? 512 : 256);
+
+ for (UShort_t s = 0; s < nS; s++) {
+ for (UShort_t t = 0; t < nT; t++) {
+ // A strip can be marked `bad' for two reasons:
+ //
+ // - The raw reader fails to read the value
+ // - The strip is marked in OCDB as bad (IsDead)
+ //
+ // Hence, a dead strip will always be marked kInvalid here,
+ // while a non-dead bad-read strip will be filled with 0.
+ if (fBad(d, r, s, t)) {
+ AliDebugF(5, "Marking FMD%d%c[%2d,%3d] as bad", d, r, s, t);
+ esd->SetMultiplicity(d, r, s, t, AliESDFMD::kInvalidMult);
+ }
+ if (param->IsDead(d, r, s, t)) {
+ AliDebugF(5, "Marking FMD%d%c[%2d,%3d] as dead", d, r, s, t);
+ esd->SetMultiplicity(d, r, s, t, AliESDFMD::kInvalidMult);
+ // esd->SetEta(d, r, s, t, AliESDFMD::kInvalidEta);
+ }
+ else if (esd->Multiplicity(d, r, s, t) == AliESDFMD::kInvalidMult) {
+ AliDebugF(20, "Setting null signal in FMD%d%c[%2d,%3d]",
+ d, r, s, t);
+ esd->SetMultiplicity(d, r, s, t, 0);
+ }
+ else {
+ AliDebugF(10, "Setting FMD%d%c[%2d,%3d]=%f",d,r,s,t,
+ esd->Multiplicity(d, r, s, t));
+ }
+ }
+ }
+ }
+ }
+}
+
+//____________________________________________________________________
+Bool_t
+AliFMDReconstructor::PreReconstruct() const
+{
+ AliFMDDebug(1, ("Before reoconstructing"));
+ if (fZombie) {
+ AliWarning("I'm a zombie - cannot do anything");
+ return false;
+ }
+
+ // Get our vertex
+ GetVertex(fESD);
+
+ // Reset bad flags
+ fBad.Reset(false);
+
+ // Reset the output ESD
+ if (fESDObj) {
+ fESDObj->Clear();
+
+ // Pre-set eta values
+ for (UShort_t d=1; d<=3; d++) {
+ UShort_t nQ = (d == 1 ? 1 : 2);
+ for (UShort_t q=0; q<nQ; q++) {
+ UShort_t nStr = (q == 0 ? 512 : 256);
+ Char_t r = (q == 0 ? 'I' : 'O');
+
+ for (UShort_t t = 0; t < nStr; t++) {
+ Float_t eta, phi;
+ // Always use sector 0
+ PhysicalCoordinates(d, r, 0, t, eta, phi);
+ fESDObj->SetEta(d, r, 0, t, eta);
+ }
+ }
+ }
+ }
+
+
+ return true;
+}
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::Reconstruct(AliFMDRawReader& rawReader) const
+{
+ // Reconstruct directly from raw data (no intermediate output on
+ // digit tree or rec point tree).
+ //
+ // Parameters:
+ // rawReader FMD Raw event reader
+ AliFMDDebug(1, ("Reconstructing from FMD raw reader"));
+ if (!PreReconstruct()) return;
+
+ UShort_t det, sec, str, fac;
+ Short_t adc, oldDet = -1;
+ Bool_t zs;
+ Char_t rng;
+
+ UseRecoParam(kTRUE);
+ while (rawReader.NextSignal(det, rng, sec, str, adc, zs, fac)) {
+ if (det != oldDet) {
+ fZS[det-1] = zs;
+ fZSFactor[det-1] = fac;
+ oldDet = det;
+ }
+ ProcessSignal(det, rng, sec, str, adc);
+ }
+ UseRecoParam(kFALSE);
+
+}
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::Reconstruct(AliRawReader* reader, TTree*) const
+{
+ // Reconstruct directly from raw data (no intermediate output on
+ // digit tree or rec point tree).
+ //
+ // Parameters:
+ // reader Raw event reader
+ // ctree Not used - 'cluster tree' to store rec-points in.
+ AliFMDDebug(1, ("Reconstructing from raw reader"));
+ if (fZombie) {
+ AliWarning("I'm a zombie - cannot do anything");