From 88cb7938ca21d4a80991d4e7aa564008c29340f7 Mon Sep 17 00:00:00 2001 From: hristov Date: Sun, 13 Jul 2003 09:26:14 +0000 Subject: [PATCH] Transition to NewIO --- CONTAINERS/AliArrayBranch.cxx | 8 +- CONTAINERS/AliArrayI.cxx | 14 +- CONTAINERS/AliArrayS.cxx | 14 +- CONTAINERS/AliArrayVT.cxx | 5 +- CONTAINERS/AliClassInfo.cxx | 9 +- CONTAINERS/AliClassInfo.h | 9 +- CONTAINERS/AliDataType.cxx | 9 +- CONTAINERS/AliDataType.h | 2 +- CONTAINERS/AliDigits.cxx | 42 +- CONTAINERS/AliH2F.cxx | 22 +- CONTAINERS/AliH2F.h | 2 +- CONTAINERS/AliMemArray.cxx | 12 +- CONTAINERS/AliMemArray.h | 4 +- CONTAINERS/AliObjectArray.cxx | 8 +- CONTAINERS/AliSegmentArray.cxx | 136 +- CONTAINERS/AliSegmentArray.h | 12 +- CONTAINERS/AliSegmentID.cxx | 11 +- CONTAINERS/TArrayOfArray.cxx | 9 +- CONTAINERS/libCONTAINERS.pkg | 1 - CRT/AliCRT.cxx | 39 +- CRT/AliCRTConstants.cxx | 6 + CRT/AliCRThit.cxx | 6 + CRT/AliCRTv0.cxx | 55 +- CRT/AliCRTv1.cxx | 22 +- CRT/AliGenCRT.cxx | 21 +- EMCAL/AliEMCAL.cxx | 71 +- EMCAL/AliEMCAL.h | 2 + EMCAL/AliEMCALClusterizer.cxx | 16 +- EMCAL/AliEMCALClusterizer.h | 11 +- EMCAL/AliEMCALClusterizerv1.cxx | 395 ++- EMCAL/AliEMCALClusterizerv1.h | 75 +- EMCAL/AliEMCALDigit.cxx | 17 +- EMCAL/AliEMCALDigit.h | 23 +- EMCAL/AliEMCALDigitizer.cxx | 565 ++-- EMCAL/AliEMCALDigitizer.h | 43 +- EMCAL/AliEMCALFast.cxx | 6 + EMCAL/AliEMCALGeometry.cxx | 46 +- EMCAL/AliEMCALGeometry.h | 10 +- EMCAL/AliEMCALGetter.cxx | 3175 ++++------------------ EMCAL/AliEMCALGetter.h | 384 ++- EMCAL/AliEMCALHadronCorrectionv0.cxx | 6 + EMCAL/AliEMCALJet.cxx | 6 + EMCAL/AliEMCALJetFinder.cxx | 101 +- EMCAL/AliEMCALLink.cxx | 6 +- EMCAL/AliEMCALLink.h | 16 +- EMCAL/AliEMCALLoader.cxx | 1021 +++++++ EMCAL/AliEMCALLoader.h | 365 +++ EMCAL/AliEMCALPID.cxx | 13 +- EMCAL/AliEMCALPID.h | 15 +- EMCAL/AliEMCALPIDv1.cxx | 263 +- EMCAL/AliEMCALPIDv1.h | 27 +- EMCAL/AliEMCALParton.cxx | 6 + EMCAL/AliEMCALRecParticle.cxx | 45 +- EMCAL/AliEMCALRecPoint.cxx | 22 +- EMCAL/AliEMCALRecPoint.h | 12 +- EMCAL/AliEMCALSDigitizer.cxx | 245 +- EMCAL/AliEMCALSDigitizer.h | 38 +- EMCAL/AliEMCALTowerRecPoint.cxx | 47 +- EMCAL/AliEMCALTrackSegment.cxx | 34 +- EMCAL/AliEMCALTrackSegment.h | 10 +- EMCAL/AliEMCALTrackSegmentMaker.cxx | 12 +- EMCAL/AliEMCALTrackSegmentMaker.h | 11 +- EMCAL/AliEMCALTrackSegmentMakerv1.cxx | 263 +- EMCAL/AliEMCALTrackSegmentMakerv1.h | 5 +- EMCAL/EMCALLinkDef.h | 2 +- EMCAL/libEMCAL.pkg | 4 +- EVGEN/AliDecayer.h | 1 + EVGEN/AliDimuCombinator.cxx | 33 +- EVGEN/AliGenBeamGas.cxx | 13 +- EVGEN/AliGenBox.cxx | 32 +- EVGEN/AliGenCocktail.cxx | 51 +- EVGEN/AliGenCocktailAfterBurner.cxx | 15 +- EVGEN/AliGenCocktailAfterBurner.h | 3 + EVGEN/AliGenDoubleScan.cxx | 37 +- EVGEN/AliGenExtFile.cxx | 26 +- EVGEN/AliGenFLUKAsource.cxx | 42 +- EVGEN/AliGenFixed.cxx | 6 + EVGEN/AliGenGSIlib.cxx | 35 +- EVGEN/AliGenHIJINGpara.cxx | 76 +- EVGEN/AliGenHIJINGparaBa.cxx | 6 + EVGEN/AliGenHalo.cxx | 6 + EVGEN/AliGenHaloProtvino.cxx | 47 +- EVGEN/AliGenMC.cxx | 59 +- EVGEN/AliGenMUONlib.cxx | 80 +- EVGEN/AliGenPHOSlib.cxx | 37 +- EVGEN/AliGenPMDlib.cxx | 24 +- EVGEN/AliGenParam.cxx | 118 +- EVGEN/AliGenReader.cxx | 13 +- EVGEN/AliGenReader.h | 4 +- EVGEN/AliGenReaderCwn.cxx | 19 +- EVGEN/AliGenReaderEcalHijing.cxx | 14 +- EVGEN/AliGenReaderEcalJets.cxx | 14 +- EVGEN/AliGenReaderTreeK.cxx | 169 +- EVGEN/AliGenReaderTreeK.h | 31 +- EVGEN/AliGenSTRANGElib.cxx | 13 +- EVGEN/AliGenScan.cxx | 36 +- EVGEN/AliGenSlowNucleons.cxx | 14 +- EVGEN/AliGenThetaSlice.cxx | 6 + EVGEN/AliPartonicEnergyLoss.cxx | 6 + EVGEN/AliSlowNucleonModel.cxx | 6 + EVGEN/AliSlowNucleonModelExp.cxx | 6 + EVGEN/AliStructFuncType.cxx | 6 + FASTSIM/AliFastDetector.cxx | 6 + FASTSIM/AliFastEvent.cxx | 6 + FASTSIM/AliFastGlauber.cxx | 25 +- FASTSIM/AliFastMuonTrackingAcc.cxx | 6 + FASTSIM/AliFastMuonTrackingEff.cxx | 6 + FASTSIM/AliFastMuonTrackingRes.cxx | 6 + FASTSIM/AliFastMuonTriggerEff.cxx | 6 + FASTSIM/AliFastParticle.cxx | 6 + FASTSIM/AliFastResponse.cxx | 6 + FASTSIM/AliMUONFastTracking.cxx | 6 + FASTSIM/AliMUONFastTrackingEntry.cxx | 6 + FMD/AliFMD.cxx | 123 +- FMD/AliFMD.h | 25 +- FMD/AliFMDDigitizer.cxx | 198 +- FMD/AliFMDDigitizer.h | 5 +- FMD/AliFMDMerger.cxx | 113 +- FMD/AliFMDMerger.h | 16 +- FMD/AliFMDReconstruction.cxx | 151 +- FMD/AliFMDReconstruction.h | 8 +- FMD/AliFMDSDigitizer.cxx | 221 +- FMD/AliFMDSDigitizer.h | 7 +- FMD/AliFMDv0.cxx | 20 +- FMD/AliFMDv1.cxx | 34 +- FMD/FMDDigit.C | 7 +- FMD/FMDReconstructor.C | 21 +- HBTAN/AliHBTCorrelFctn.cxx | 15 +- HBTAN/AliHBTCorrelFctn.h | 12 +- HBTAN/AliHBTEvent.cxx | 11 +- HBTAN/AliHBTEvent.h | 10 +- HBTAN/AliHBTLLWeightFctn.cxx | 5 +- HBTAN/AliHBTLLWeightFctn.h | 3 +- HBTAN/AliHBTLLWeights.cxx | 804 ++++-- HBTAN/AliHBTLLWeights.h | 178 +- HBTAN/AliHBTMonDistributionFctns.cxx | 140 +- HBTAN/AliHBTMonDistributionFctns.h | 96 +- HBTAN/AliHBTPairCut.cxx | 37 +- HBTAN/AliHBTPairCut.h | 3 - HBTAN/AliHBTPositionRandomizer.cxx | 176 ++ HBTAN/AliHBTPositionRandomizer.h | 91 + HBTAN/AliHBTReader.cxx | 7 +- HBTAN/AliHBTReader.h | 5 +- HBTAN/AliHBTReaderITSv1.cxx | 2 +- HBTAN/AliHBTReaderITSv2.cxx | 231 +- HBTAN/AliHBTReaderITSv2.h | 23 +- HBTAN/AliHBTReaderKineTree.cxx | 95 +- HBTAN/AliHBTReaderKineTree.h | 11 +- HBTAN/AliHBTReaderPPprod.cxx | 16 +- HBTAN/AliHBTReaderTPC.cxx | 337 +-- HBTAN/AliHBTReaderTPC.h | 31 +- HBTAN/HBTAnalysisLinkDef.h | 10 + HBTAN/libHBTAN.pkg | 5 +- HBTAN/ltran12.F | 25 +- HBTP/common_event_summary.inc | 2 +- HBTP/hbt_event_processor.f | 31 +- ITS/AliITS.cxx | 1324 ++++----- ITS/AliITS.h | 23 +- ITS/AliITSBaseGeometry.cxx | 19 +- ITS/AliITSBaseGeometry.h | 102 - ITS/AliITSClusterFinder.cxx | 1 + ITS/AliITSClusterFinder.h | 6 +- ITS/AliITSClusterFinderSDD.cxx | 29 +- ITS/AliITSClusterFinderSPDdubna.cxx | 29 +- ITS/AliITSComparisonV2.C | 145 +- ITS/AliITSDetType.cxx | 31 +- ITS/AliITSDigitizer.cxx | 194 +- ITS/AliITSDigits2RecPoints.C | 151 +- ITS/AliITSDumpVertices.C | 12 +- ITS/AliITSFDigitizer.cxx | 59 +- ITS/AliITSFindClustersV2.C | 234 +- ITS/AliITSFindClustersV2.cxx | 11 +- ITS/AliITSFindPrimaryVertex.C | 136 +- ITS/AliITSFindTracksV2.C | 108 +- ITS/AliITSGeoPlot.C | 106 +- ITS/AliITSGeometrySDDCone.cxx | 7 + ITS/AliITSGeometrySSDCone.cxx | 6 + ITS/AliITSHits2FastRecPoints.C | 117 +- ITS/AliITSHits2SDigits.C | 190 +- ITS/AliITSLoader.cxx | 81 + ITS/AliITSLoader.h | 71 + ITS/AliITSRawCluster.cxx | 17 +- ITS/AliITSRecPoint.cxx | 13 +- ITS/AliITSSDigits2Digits.C | 41 +- ITS/AliITSTrackerV1.cxx | 55 +- ITS/AliITSVertexer.cxx | 49 +- ITS/AliITSVertexer.h | 8 +- ITS/AliITSVertexerIons.cxx | 695 +++-- ITS/AliITSVertexerIons.h | 2 +- ITS/AliITSVertexerPPZ.cxx | 38 +- ITS/AliITSVertexerPPZ.h | 2 +- ITS/AliITSVertexerTracks.cxx | 12 +- ITS/AliITSVertexerTracks.h | 6 +- ITS/AliITSVertexerZTest.C | 46 +- ITS/AliITSclusterSSD.cxx | 16 +- ITS/AliITSclustererV2.cxx | 2 + ITS/AliITSdigit.cxx | 1 + ITS/AliITSdigit.h | 2 + ITS/AliITSetfSDD.cxx | 13 +- ITS/AliITSetfSDD.h | 9 +- ITS/AliITSgeom.cxx | 96 +- ITS/AliITSgeomMatrix.cxx | 73 +- ITS/AliITSgeomSDD.cxx | 169 +- ITS/AliITSgeomSPD.cxx | 236 +- ITS/AliITSgeomSSD.cxx | 201 +- ITS/AliITShit.cxx | 70 +- ITS/AliITShitDigitizer.cxx | 15 +- ITS/AliITSmodule.cxx | 117 +- ITS/AliITSneuralTracker.h | 1 + ITS/AliITSpList.cxx | 17 +- ITS/AliITSpList.h | 3 +- ITS/AliITSpackageSSD.cxx | 22 +- ITS/AliITSreconstruction.cxx | 297 +- ITS/AliITSreconstruction.h | 15 +- ITS/AliITSresponseSDD.cxx | 11 +- ITS/AliITSresponseSDD.h | 1 + ITS/AliITSsDigitize.cxx | 65 +- ITS/AliITSsDigitize.h | 8 +- ITS/AliITSsegmentationSSD.cxx | 22 +- ITS/AliITSsimulation.h | 1 + ITS/AliITSsimulationFastPoints.cxx | 33 +- ITS/AliITSsimulationSDD.cxx | 150 +- ITS/AliITSsimulationSDD.h | 1 + ITS/AliITSsimulationSPD.cxx | 44 +- ITS/AliITSsimulationSPDdubna.cxx | 6 + ITS/AliITSsimulationSSD.cxx | 1 + ITS/AliITSsimulationSSD.h | 1 + ITS/AliITStestV2.C | 60 +- ITS/AliITStrackerV2.cxx | 407 +-- ITS/AliITStrackerV2.h | 24 +- ITS/AliITSv1.cxx | 71 +- ITS/AliITSv11.cxx | 7 + ITS/AliITSv5.cxx | 110 +- ITS/AliITSv5asymm.cxx | 135 +- ITS/AliITSv5symm.cxx | 119 +- ITS/AliITSvPPRasymm.cxx | 247 +- ITS/AliITSvPPRasymmFMD.cxx | 89 +- ITS/AliITSvPPRcoarseasymm.cxx | 129 +- ITS/AliITSvPPRcoarsesymm.cxx | 126 +- ITS/AliITSvPPRsymm.cxx | 246 +- ITS/AliITSvSPD02.cxx | 20 +- ITS/AliITSvtest.cxx | 100 +- ITS/ConfigSPD02.C | 16 +- ITS/ITSLinkDef.h | 5 +- ITS/libITS.pkg | 4 +- MICROCERN/abend.F | 6 + MICROCERN/cfill.F | 6 + MICROCERN/cltou.F | 6 + MICROCERN/fchput.c | 6 + MICROCERN/fchtak.c | 6 + MICROCERN/fint.F | 6 + MICROCERN/gamma.F | 6 + MICROCERN/gamma64.F | 6 + MICROCERN/gauss.F | 6 + MICROCERN/gauss64.F | 6 + MICROCERN/gausscod.inc | 6 + MICROCERN/gen/def128.inc | 6 + MICROCERN/gen/def64.inc | 6 + MICROCERN/gen/defc64.inc | 6 + MICROCERN/gen/imp128.inc | 6 + MICROCERN/gen/imp64.inc | 6 + MICROCERN/gen/impc64.inc | 6 + MICROCERN/geteni.c | 6 + MICROCERN/getenvf.F | 6 + MICROCERN/kerngen/cf_clos.h | 6 + MICROCERN/kerngen/cf_open.h | 6 + MICROCERN/kerngen/cf_reaw.h | 6 + MICROCERN/kerngen/cf_seek.h | 6 + MICROCERN/kerngen/cf_xaft.h | 6 + MICROCERN/kerngen/fortchar.h | 6 + MICROCERN/kerngen/q_andor.inc | 6 + MICROCERN/kerngen/q_cbyt.inc | 6 + MICROCERN/kerngen/q_isabit.inc | 6 + MICROCERN/kerngen/q_jbit.inc | 6 + MICROCERN/kerngen/q_jbytet.inc | 6 + MICROCERN/kerngen/q_sbit.inc | 6 + MICROCERN/kerngen/q_sbyt.inc | 6 + MICROCERN/kerngen/q_shift.inc | 6 + MICROCERN/kerngen/qf_f2c.h | 6 + MICROCERN/kerngen/qnatch.inc | 6 + MICROCERN/kerngen/qnatchdata.inc | 6 + MICROCERN/kerngen/wordsizc.h | 6 + MICROCERN/kerngen/wordsize.inc | 6 + MICROCERN/kerset.F | 6 + MICROCERN/mtlprt.F | 6 + MICROCERN/mtlset.F | 6 + MICROCERN/sortzv.F | 6 + MICROCERN/sungs/abend.F | 6 + MICROCERN/ufill.F | 6 + MUON/AliMUON.cxx | 368 ++- MUON/AliMUON.h | 20 +- MUON/AliMUONChamber.cxx | 62 +- MUON/AliMUONChamberTrigger.cxx | 49 +- MUON/AliMUONClusterFinderAZ.cxx | 13 +- MUON/AliMUONClusterFinderVS.cxx | 122 +- MUON/AliMUONClusterInput.cxx | 50 +- MUON/AliMUONConstants.cxx | 31 +- MUON/AliMUONDigit.cxx | 19 +- MUON/AliMUONDigitizer.cxx | 266 +- MUON/AliMUONDigitizerv1.cxx | 92 +- MUON/AliMUONDisplay.cxx | 122 +- MUON/AliMUONEventReconstructor.cxx | 227 +- MUON/AliMUONFactory.cxx | 19 +- MUON/AliMUONHit.cxx | 12 +- MUON/AliMUONHitForRec.cxx | 31 +- MUON/AliMUONHitMapA1.cxx | 39 +- MUON/AliMUONMerger.cxx | 54 +- MUON/AliMUONPadHit.cxx | 10 +- MUON/AliMUONPoints.cxx | 30 +- MUON/AliMUONRawCluster.cxx | 13 +- MUON/AliMUONRecoDisplay.cxx | 85 +- MUON/AliMUONRecoEvent.cxx | 41 +- MUON/AliMUONReconstHit.cxx | 4 +- MUON/AliMUONResponse.cxx | 7 +- MUON/AliMUONResponseTrigger.cxx | 20 +- MUON/AliMUONResponseV0.cxx | 29 +- MUON/AliMUONSegment.cxx | 60 +- MUON/AliMUONSegmentationSlat.cxx | 60 +- MUON/AliMUONSegmentationSlat.h | 1 - MUON/AliMUONSegmentationSlatModule.cxx | 39 +- MUON/AliMUONSegmentationSlatModuleN.cxx | 29 +- MUON/AliMUONSegmentationSlatN.cxx | 16 +- MUON/AliMUONSegmentationTrigger.cxx | 50 +- MUON/AliMUONSegmentationTriggerX.cxx | 74 +- MUON/AliMUONSegmentationTriggerY.cxx | 58 +- MUON/AliMUONSegmentationV0.cxx | 42 +- MUON/AliMUONSegmentationV01.cxx | 78 +- MUON/AliMUONSegmentationV02.cxx | 34 +- MUON/AliMUONSegmentationV04.cxx | 29 +- MUON/AliMUONSegmentationV05.cxx | 26 +- MUON/AliMUONSegmentationV1.cxx | 37 +- MUON/AliMUONSt1Decoder.cxx | 8 +- MUON/AliMUONSt1ElectronicElement.cxx | 8 +- MUON/AliMUONSt1IniReader.cxx | 8 +- MUON/AliMUONSt1ResponseParameter.cxx | 4 +- MUON/AliMUONSt1ResponseRule.cxx | 8 +- MUON/AliMUONSt1Segmentation.cxx | 8 +- MUON/AliMUONSt1SpecialMotif.cxx | 4 +- MUON/AliMUONTrack.cxx | 83 +- MUON/AliMUONTrackHit.cxx | 40 +- MUON/AliMUONTrackParam.cxx | 71 +- MUON/AliMUONTransientDigit.cxx | 4 +- MUON/AliMUONTriggerCircuit.cxx | 34 +- MUON/AliMUONTriggerConstants.cxx | 7 +- MUON/AliMUONTriggerDecision.cxx | 90 +- MUON/AliMUONTriggerLut.cxx | 23 +- MUON/AliMUONproto.cxx | 20 +- MUON/AliMUONv0.cxx | 96 +- MUON/AliMUONv1.cxx | 18 +- MUON/AliMUONv1.h | 1 + MUON/AliMUONv2.cxx | 4 +- MUON/AliMUONv3.cxx | 12 +- MUON/Config_MUON_test.C | 142 + MUON/MUONCheck.C | 382 +++ MUON/MUONLinkDef.h | 1 + MUON/MUONrawclusters.C | 71 +- MUON/MUONrecoNtuple.C | 70 +- MUON/MUONtrigger.C | 62 +- MUON/README | 90 + MUON/libMUON.pkg | 2 +- PHOS/AliPHOS.cxx | 51 +- PHOS/AliPHOS.h | 10 +- PHOS/AliPHOSAnalyze.cxx | 767 +++--- PHOS/AliPHOSAnalyze.h | 8 +- PHOS/AliPHOSCPVDigit.h | 6 +- PHOS/AliPHOSCPVGeometry.cxx | 6 + PHOS/AliPHOSCalibrator.cxx | 9 +- PHOS/AliPHOSCalibrator.h | 3 +- PHOS/AliPHOSClusterizer.cxx | 12 +- PHOS/AliPHOSClusterizer.h | 27 +- PHOS/AliPHOSClusterizerv1.cxx | 632 ++--- PHOS/AliPHOSClusterizerv1.h | 48 +- PHOS/AliPHOSClusterizerv2.cxx | 40 +- PHOS/AliPHOSClusterizerv2.h | 8 +- PHOS/AliPHOSCpvRecPoint.cxx | 15 +- PHOS/AliPHOSCpvRecPoint.h | 8 +- PHOS/AliPHOSDebug.cxx | 10 +- PHOS/AliPHOSDebug.h | 4 +- PHOS/AliPHOSDigit.cxx | 89 +- PHOS/AliPHOSDigit.h | 29 +- PHOS/AliPHOSDigitizer.cxx | 583 ++-- PHOS/AliPHOSDigitizer.h | 33 +- PHOS/AliPHOSEMCAGeometry.h | 204 +- PHOS/AliPHOSEmcRecPoint.cxx | 47 +- PHOS/AliPHOSEvalRecPoint.cxx | 364 ++- PHOS/AliPHOSEvalRecPoint.h | 25 +- PHOS/AliPHOSFastGlobalReconstruction.cxx | 4 +- PHOS/AliPHOSGeometry.cxx | 63 +- PHOS/AliPHOSGeometry.h | 20 +- PHOS/AliPHOSGetter.cxx | 3028 ++++----------------- PHOS/AliPHOSGetter.h | 340 ++- PHOS/AliPHOSHit.cxx | 26 +- PHOS/AliPHOSHit.h | 1 + PHOS/AliPHOSIhepAnalyze.cxx | 196 +- PHOS/AliPHOSIhepAnalyze.h | 15 +- PHOS/AliPHOSImpact.cxx | 3 - PHOS/AliPHOSJetFinder.cxx | 2 +- PHOS/AliPHOSLink.h | 6 +- PHOS/AliPHOSLoader.cxx | 946 +++++++ PHOS/AliPHOSLoader.h | 334 +++ PHOS/AliPHOSPID.cxx | 29 +- PHOS/AliPHOSPID.h | 34 +- PHOS/AliPHOSPIDv0.cxx | 255 +- PHOS/AliPHOSPIDv0.h | 11 +- PHOS/AliPHOSPIDv1.cxx | 748 +++-- PHOS/AliPHOSPIDv1.h | 12 +- PHOS/AliPHOSPpsdRecPoint.cxx | 6 +- PHOS/AliPHOSPpsdRecPoint.h | 2 +- PHOS/AliPHOSQAAlarm.h | 2 +- PHOS/AliPHOSQAChecker.cxx | 16 +- PHOS/AliPHOSQAChecker.h | 7 +- PHOS/AliPHOSQAFloatCheckable.cxx | 12 +- PHOS/AliPHOSQAFloatCheckable.h | 6 +- PHOS/AliPHOSQAIntCheckable.cxx | 13 +- PHOS/AliPHOSQAIntCheckable.h | 7 +- PHOS/AliPHOSQAMeanChecker.cxx | 4 + PHOS/AliPHOSQAMeanChecker.h | 4 + PHOS/AliPHOSQAObjectCheckable.cxx | 15 +- PHOS/AliPHOSQAObjectCheckable.h | 6 +- PHOS/AliPHOSQAVirtualCheckable.cxx | 26 +- PHOS/AliPHOSQAVirtualCheckable.h | 7 +- PHOS/AliPHOSRaw2Digits.cxx | 150 +- PHOS/AliPHOSRaw2Digits.h | 4 +- PHOS/AliPHOSRecCpvManager.cxx | 4 +- PHOS/AliPHOSRecParticle.cxx | 49 +- PHOS/AliPHOSRecParticle.h | 2 +- PHOS/AliPHOSRecPoint.cxx | 128 +- PHOS/AliPHOSRecPoint.h | 26 +- PHOS/AliPHOSReconstructioner.cxx | 452 +-- PHOS/AliPHOSReconstructioner.h | 6 +- PHOS/AliPHOSSDigitizer.cxx | 212 +- PHOS/AliPHOSSDigitizer.h | 27 +- PHOS/AliPHOSSupportGeometry.h | 19 +- PHOS/AliPHOSTick.cxx | 13 +- PHOS/AliPHOSTick.h | 2 +- PHOS/AliPHOSTrackSegment.cxx | 1 - PHOS/AliPHOSTrackSegment.h | 5 +- PHOS/AliPHOSTrackSegmentMaker.cxx | 22 +- PHOS/AliPHOSTrackSegmentMaker.h | 36 +- PHOS/AliPHOSTrackSegmentMakerv1.cxx | 257 +- PHOS/AliPHOSTrackSegmentMakerv1.h | 18 +- PHOS/AliPHOSv0.cxx | 26 +- PHOS/AliPHOSv1.cxx | 28 +- PHOS/AliPHOSv3.cxx | 1 + PHOS/AliPHOSv4.cxx | 5 +- PHOS/AliPHOSv4.h | 6 +- PHOS/AliPHOSvFast.cxx | 71 +- PHOS/AliPHOSvFast.h | 17 +- PHOS/AliPHOSvImpacts.cxx | 17 +- PHOS/AliPHOSvImpacts.h | 2 +- PHOS/AnaPhotons_v1.C | 305 --- PHOS/ConfigTestSuite.C | 413 +++ PHOS/ConvertPHOSToNewIO.C | 1168 ++++++++ PHOS/PHOSLinkDef.h | 14 +- PHOS/TestSuite.csh | 140 + PHOS/grunTestSuite.C | 18 + PHOS/libPHOS.pkg | 28 +- PHOS/test.C | 4 +- PHOS/testconfig.C | 42 +- PHOS/testsim.C | 7 +- PHOS/testsimglobal.C | 33 +- PMD/AliPMD.cxx | 90 +- PMD/AliPMD.h | 6 +- PMD/AliPMDv0.cxx | 29 +- PMD/AliPMDv1.cxx | 32 +- PYTHIA6/AliDecayerPythia.cxx | 71 +- PYTHIA6/AliGenPythiaEventHeader.cxx | 10 +- PYTHIA6/AliGenPythiaJets.cxx | 15 +- PYTHIA6/AliPythia.cxx | 2 - PYTHIA6/AliPythiaRndm.cxx | 10 +- PYTHIA6/pythia6203.f | 130 +- RALICE/AliCalorimeter.cxx | 7 + RALICE/AliEvent.cxx | 3 +- RALICE/AliEvent.h | 2 +- RICH/AliRICH.cxx | 468 ++-- RICH/AliRICH.h | 18 +- RICH/AliRICHChamber.h | 3 +- RICH/AliRICHClusterFinder.cxx | 6 + RICH/AliRICHDetect.cxx | 60 +- RICH/AliRICHDetectV1.cxx | 17 +- RICH/AliRICHDigitizer.cxx | 90 +- RICH/AliRICHDisplay.cxx | 71 +- RICH/AliRICHEllipse.cxx | 16 +- RICH/AliRICHMerger.cxx | 30 +- RICH/AliRICHPatRec.cxx | 12 +- RICH/AliRICHPoints.cxx | 8 +- RICH/AliRICHRecHit3D.cxx | 16 +- RICH/AliRICHRecHit3D.h | 1 + RICH/AliRICHResponseV0.cxx | 45 +- RICH/AliRICHv0.cxx | 95 +- RICH/AliRICHv1.cxx | 103 +- RICH/AliRICHv2.cxx | 86 +- RICH/AliRICHv3.cxx | 26 +- START/AliSTART.cxx | 261 +- START/AliSTART.h | 8 +- START/AliSTARTDigitizer.cxx | 35 +- START/AliSTARTdigit.cxx | 21 +- START/AliSTARTv0.cxx | 55 +- START/AliSTARTv1.cxx | 18 +- START/AliSTARTv2.cxx | 22 +- START/AliSTARTvertex.cxx | 65 +- START/readDigits.C | 2 +- START/readVertex.C | 2 +- STEER/AliConfig.cxx | 859 ++++-- STEER/AliConfig.h | 121 +- STEER/AliDataLoader.cxx | 1157 ++++++++ STEER/AliDataLoader.h | 256 ++ STEER/AliDebugVolume.cxx | 1 - STEER/AliDetector.cxx | 298 +- STEER/AliDetector.h | 25 +- STEER/AliDigitizer.cxx | 2 - STEER/AliDigitizer.h | 9 +- STEER/AliDisplay.cxx | 225 +- STEER/AliESD.h | 3 + STEER/AliHits2SDigits.C | 187 +- STEER/AliLoader.cxx | 865 ++++++ STEER/AliLoader.h | 314 +++ STEER/AliMCQA.cxx | 15 +- STEER/AliMagF.h | 23 - STEER/AliMagFCM.cxx | 1 + STEER/AliMagFMaps.cxx | 5 +- STEER/AliMagFMaps.h | 7 - STEER/AliModule.cxx | 130 +- STEER/AliModule.h | 49 +- STEER/AliRndm.cxx | 7 +- STEER/AliRndm.h | 2 +- STEER/AliRun.cxx | 1300 +++------ STEER/AliRun.h | 94 +- STEER/AliRunDigitizer.cxx | 667 +++-- STEER/AliRunDigitizer.h | 67 +- STEER/AliRunLoader.cxx | 1488 ++++++++++ STEER/AliRunLoader.h | 222 ++ STEER/AliSDigits2Digits.C | 61 +- STEER/AliStack.cxx | 279 +- STEER/AliStack.h | 36 +- STEER/AliStream.cxx | 237 +- STEER/AliStream.h | 50 +- STEER/AliTrackMapper.cxx | 126 +- STEER/AliTrackMapper.h | 9 +- STEER/AliTracker.cxx | 4 +- STEER/AliTracker.h | 5 +- STEER/STEERLinkDef.h | 7 + STEER/libSTEER.pkg | 5 +- STRUCT/ABSOConst.h | 2 + STRUCT/ABSOSHILConst.h | 2 + STRUCT/AliABSOv0.cxx | 4 +- STRUCT/AliALIFE.cxx | 1 + STRUCT/AliBODY.cxx | 6 +- STRUCT/AliDIPOv1.cxx | 4 +- STRUCT/AliDIPOv2.cxx | 6 +- STRUCT/AliFRAMEv1.cxx | 3 +- STRUCT/AliFRAMEv2.cxx | 21 +- STRUCT/AliHALL.cxx | 27 +- STRUCT/AliMAG.cxx | 4 +- STRUCT/AliPIPEv0.cxx | 12 +- STRUCT/AliPIPEv1.cxx | 4 +- STRUCT/AliPIPEv3.cxx | 4 +- STRUCT/AliSHILv0.cxx | 6 +- THbtp/AliGenHBTprocessor.cxx | 336 ++- THbtp/AliGenHBTprocessor.h | 23 +- THbtp/THBTprocessor.cxx | 5 + THbtp/THBTprocessor.h | 6 +- TMEVSIM/AliGenMevSim.cxx | 3 +- TMEVSIM/AliMevSimConfig.cxx | 6 + TMEVSIM/AliMevSimParticle.cxx | 6 + TMEVSIM/TMevSim.cxx | 13 +- TMEVSIM/libTMEVSIM.pkg | 8 +- TOF/AliTOF.cxx | 263 +- TOF/AliTOF.h | 5 +- TOF/AliTOFDigitizer.cxx | 63 +- TOF/AliTOFDigitizer.h | 1 - TOF/AliTOFHitMap.cxx | 22 +- TOF/AliTOFMerger.cxx | 107 +- TOF/AliTOFMerger.h | 5 + TOF/AliTOFReconstructioner.cxx | 104 +- TOF/AliTOFReconstructionerV2.cxx | 86 +- TOF/AliTOFSDigit.cxx | 5 +- TOF/AliTOFSDigitizer.cxx | 86 +- TOF/AliTOFSDigitizer.h | 10 +- TOF/AliTOFT0.cxx | 42 +- TOF/AliTOFdigit.cxx | 34 +- TOF/AliTOFv0.cxx | 82 +- TOF/AliTOFv1.cxx | 97 +- TOF/AliTOFv2.cxx | 95 +- TOF/AliTOFv2FHoles.cxx | 21 +- TOF/AliTOFv3.cxx | 91 +- TOF/AliTOFv4.cxx | 91 +- TOF/AliTOFv4T0.cxx | 19 +- TPC/AliBarrelReconstruction.C | 585 ++-- TPC/AliClusters.cxx | 24 +- TPC/AliClustersArray.cxx | 30 +- TPC/AliComplexCluster.cxx | 11 +- TPC/AliDetectorParam.cxx | 8 +- TPC/AliDigitsArray.cxx | 14 +- TPC/AliSimDigits.cxx | 46 +- TPC/AliTPC.cxx | 855 +++--- TPC/AliTPC.h | 16 +- TPC/AliTPCBuffer.cxx | 1 + TPC/AliTPCCluster.cxx | 179 -- TPC/AliTPCCluster.h | 60 - TPC/AliTPCClusterFinder.cxx | 25 +- TPC/AliTPCClustersArray.cxx | 18 +- TPC/AliTPCClustersRow.cxx | 4 +- TPC/AliTPCComparison.C | 162 +- TPC/AliTPCComparison2.C | 9 +- TPC/AliTPCDigitizer.cxx | 356 ++- TPC/AliTPCDigitsArray.cxx | 11 +- TPC/AliTPCDisplayDigits3Dnew.C | 121 +- TPC/AliTPCFindClusters.C | 100 +- TPC/AliTPCFindTracks.C | 89 +- TPC/AliTPCHits2Digits.C | 42 +- TPC/AliTPCHits2SDigits.C | 66 +- TPC/AliTPCLoader.cxx | 27 + TPC/AliTPCLoader.h | 37 + TPC/AliTPCPRF2D.cxx | 41 +- TPC/AliTPCParam.cxx | 73 +- TPC/AliTPCParamCR.cxx | 26 +- TPC/AliTPCParamSR.cxx | 45 +- TPC/AliTPCPid.cxx | 7 +- TPC/AliTPCRF1D.cxx | 32 +- TPC/AliTPCSDigits2Digits.C | 48 +- TPC/AliTPCTrackHits.cxx | 18 +- TPC/AliTPCTrackHitsV2.cxx | 18 +- TPC/AliTPCcluster.cxx | 10 +- TPC/AliTPCclusterer.cxx | 91 +- TPC/AliTPCclusterer.h | 3 +- TPC/AliTPCclustererMI.cxx | 286 +- TPC/AliTPCclustererMI.h | 4 +- TPC/AliTPCkineGrid.cxx | 11 +- TPC/AliTPCtest.C | 27 +- TPC/AliTPCtrack.cxx | 6 + TPC/AliTPCtrackPid.cxx | 4 +- TPC/AliTPCtracker.cxx | 1327 +++------ TPC/AliTPCtracker.h | 88 +- TPC/AliTPCtrackerMI.cxx | 13 +- TPC/AliTPCtrackerParam.cxx | 59 +- TPC/AliTPCtrackerParam.h | 5 +- TPC/AliTPCv0.cxx | 105 +- TPC/AliTPCv1.cxx | 114 +- TPC/AliTPCv2.cxx | 143 +- TPC/AliTPCv3.cxx | 117 +- TPC/TPCLinkDef.h | 4 + TPC/TestTPCTrackHits.cxx | 7 +- TPC/alles.h | 5 + TPC/libTPC.pkg | 17 +- TPC/template.cxx | 8 +- TPHIC/AliGenTPHIC.cxx | 6 + TRD/AliTRD.cxx | 292 +- TRD/AliTRD.h | 5 +- TRD/AliTRDanaDigits.C | 32 +- TRD/AliTRDarrayF.cxx | 16 +- TRD/AliTRDarrayI.cxx | 41 +- TRD/AliTRDcluster.cxx | 48 +- TRD/AliTRDclusterizer.cxx | 242 +- TRD/AliTRDclusterizer.h | 26 +- TRD/AliTRDclusterizerV0.cxx | 72 +- TRD/AliTRDclusterizerV1.cxx | 84 +- TRD/AliTRDclusterizerV1.h | 2 +- TRD/AliTRDdataArray.cxx | 34 +- TRD/AliTRDdataArrayF.cxx | 46 +- TRD/AliTRDdataArrayI.cxx | 52 +- TRD/AliTRDdigit.cxx | 28 +- TRD/AliTRDdigitizer.cxx | 355 +-- TRD/AliTRDdigitizer.h | 8 +- TRD/AliTRDdigitsManager.cxx | 199 +- TRD/AliTRDdigitsManager.h | 11 +- TRD/AliTRDgeometry.cxx | 112 +- TRD/AliTRDgeometryDetail.cxx | 27 +- TRD/AliTRDgeometryFull.cxx | 52 +- TRD/AliTRDgeometryHole.cxx | 43 +- TRD/AliTRDhit.cxx | 22 +- TRD/AliTRDhits2sdigits.C | 5 +- TRD/AliTRDmatrix.cxx | 58 +- TRD/AliTRDmcTrack.cxx | 12 +- TRD/AliTRDmcTrack.h | 8 + TRD/AliTRDparameter.cxx | 40 +- TRD/AliTRDpid.cxx | 22 +- TRD/AliTRDpid.h | 1 - TRD/AliTRDpixel.cxx | 25 +- TRD/AliTRDpoints.cxx | 25 +- TRD/AliTRDrawData.cxx | 13 +- TRD/AliTRDrecPoint.cxx | 46 +- TRD/AliTRDsdigits2digits.C | 12 +- TRD/AliTRDsegmentArray.cxx | 37 +- TRD/AliTRDsegmentArrayBase.cxx | 55 +- TRD/AliTRDsegmentArrayBase.h | 2 +- TRD/AliTRDsegmentID.cxx | 22 +- TRD/AliTRDsim.cxx | 34 +- TRD/AliTRDsimple.cxx | 7 +- TRD/AliTRDsimpleGen.cxx | 7 +- TRD/AliTRDsimpleGen.h | 2 +- TRD/AliTRDsimpleMC.cxx | 37 +- TRD/AliTRDsimpleMC.h | 5 +- TRD/AliTRDtimeBin.cxx | 28 +- TRD/AliTRDtrack.cxx | 6 + TRD/AliTRDtracker.cxx | 264 +- TRD/AliTRDtracker.h | 93 +- TRD/AliTRDtrackingSector.cxx | 39 +- TRD/AliTRDv0.cxx | 62 +- TRD/AliTRDv1.cxx | 135 +- TRD/AliTRDv2.cxx | 13 +- TRD/libTRD.pkg | 2 +- VZERO/AliVZERO.cxx | 8 +- VZERO/AliVZEROhit.cxx | 2 + VZERO/AliVZEROhit.h | 1 + VZERO/AliVZEROv0.cxx | 63 +- VZERO/AliVZEROv2.cxx | 61 +- ZDC/AliGenZDC.cxx | 41 +- ZDC/AliZDC.cxx | 196 +- ZDC/AliZDC.h | 6 +- ZDC/AliZDCMerger.h | 2 +- ZDC/AliZDCv1.cxx | 113 +- ZDC/AliZDCv2.cxx | 55 +- build/Makefile.Darwin | 4 +- build/Makefile.icc | 2 +- build/header.tpl | 4 +- build/makeg2cso.sh | 10 + build/module.dep | 1 - build/module.tpl | 30 +- macros/Config.C | 69 +- macros/ConfigCharmPPR.C | 5 +- macros/ConfigHBT.C | 29 +- macros/Config_gener.C | 15 +- macros/Config_pp.C | 17 +- macros/ConvertToNewIO.C | 767 ++++++ macros/DrawALICE.C | 1 + macros/DrawSTART.C | 9 +- macros/TestNewIO.C | 81 + macros/ViewABSO.C | 7 +- macros/ViewFMD.C | 3 +- macros/ViewFRAME.C | 6 +- macros/ViewHALL.C | 2 + macros/ViewITS.C | 24 +- macros/ViewMUON.C | 167 +- macros/ViewPHOS.C | 76 +- macros/ViewPIPE.C | 62 +- macros/ViewPMD.C | 52 +- macros/ViewRICH.C | 1 + macros/ViewSHIL.C | 76 +- macros/ViewSTART.C | 23 +- macros/ViewTOF.C | 36 +- macros/ViewTPC.C | 76 +- macros/ViewTRD.C | 52 +- macros/analHits.C | 32 +- macros/display.C | 35 +- macros/loadlibs.C | 3 +- macros/plotField.C | 2 +- share/alibtool | 6 + 748 files changed, 28547 insertions(+), 32939 deletions(-) create mode 100644 EMCAL/AliEMCALLoader.cxx create mode 100644 EMCAL/AliEMCALLoader.h create mode 100644 HBTAN/AliHBTPositionRandomizer.cxx create mode 100644 HBTAN/AliHBTPositionRandomizer.h create mode 100644 ITS/AliITSLoader.cxx create mode 100644 ITS/AliITSLoader.h create mode 100644 MUON/Config_MUON_test.C create mode 100644 MUON/MUONCheck.C create mode 100644 MUON/README create mode 100644 PHOS/AliPHOSLoader.cxx create mode 100644 PHOS/AliPHOSLoader.h create mode 100644 PHOS/ConfigTestSuite.C create mode 100644 PHOS/ConvertPHOSToNewIO.C create mode 100755 PHOS/TestSuite.csh create mode 100644 PHOS/grunTestSuite.C create mode 100644 STEER/AliDataLoader.cxx create mode 100644 STEER/AliDataLoader.h create mode 100644 STEER/AliLoader.cxx create mode 100644 STEER/AliLoader.h create mode 100644 STEER/AliRunLoader.cxx create mode 100644 STEER/AliRunLoader.h delete mode 100644 TPC/AliTPCCluster.cxx delete mode 100644 TPC/AliTPCCluster.h create mode 100644 TPC/AliTPCLoader.cxx create mode 100644 TPC/AliTPCLoader.h create mode 100755 build/makeg2cso.sh create mode 100644 macros/ConvertToNewIO.C create mode 100644 macros/TestNewIO.C diff --git a/CONTAINERS/AliArrayBranch.cxx b/CONTAINERS/AliArrayBranch.cxx index a4461f0847e..d97bfd9d694 100644 --- a/CONTAINERS/AliArrayBranch.cxx +++ b/CONTAINERS/AliArrayBranch.cxx @@ -13,12 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2000/11/01 16:01:22 kowal2 -Classes for handling the new hits structures +/* $Id$ */ -*/ #include "TROOT.h" #include "AliArrayBranch.h" #include "TFile.h" @@ -58,7 +54,7 @@ ClassImp(AliTree) -Int_t AliArraySubBranch::GetEntryExport(Int_t entry, Int_t getall, AliObjectArray *list, Int_t nentries) + Int_t AliArraySubBranch::GetEntryExport(Int_t entry, Int_t /*getall*/, AliObjectArray *list, Int_t nentries) { //*-*-*-*-*-*Read all leaves of entry and return total number of bytes*-*-* //*-* export buffers to real objects in the AliObjectArray list. diff --git a/CONTAINERS/AliArrayI.cxx b/CONTAINERS/AliArrayI.cxx index ae37f08c4b8..9907839f9da 100644 --- a/CONTAINERS/AliArrayI.cxx +++ b/CONTAINERS/AliArrayI.cxx @@ -13,19 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2000/11/01 15:57:13 kowal2 -Moved from the TPC directory - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:32:37 kowal2 - -"ROOT"-based class with some extra functionality - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Added additional functionality to original TArrayI // diff --git a/CONTAINERS/AliArrayS.cxx b/CONTAINERS/AliArrayS.cxx index 64e1e12ba62..2aea65be52a 100644 --- a/CONTAINERS/AliArrayS.cxx +++ b/CONTAINERS/AliArrayS.cxx @@ -13,19 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2000/11/01 15:57:13 kowal2 -Moved from the TPC directory - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:32:37 kowal2 - -"ROOT"-based class with some extra functionality - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Added additional functionality to original TArrayS // diff --git a/CONTAINERS/AliArrayVT.cxx b/CONTAINERS/AliArrayVT.cxx index 6948cebeea9..9f0ba32dc6a 100644 --- a/CONTAINERS/AliArrayVT.cxx +++ b/CONTAINERS/AliArrayVT.cxx @@ -13,9 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ + /////////////////////////////////////////////////////////////////////////////// // // // AliArrayVT // diff --git a/CONTAINERS/AliClassInfo.cxx b/CONTAINERS/AliClassInfo.cxx index 37ed435cbcc..f555b9bec94 100644 --- a/CONTAINERS/AliClassInfo.cxx +++ b/CONTAINERS/AliClassInfo.cxx @@ -13,15 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2000/11/10 15:54:51 kowal2 -Corrections by P.Hristov to deal with the CINT problems. +/* $Id$ */ -Revision 1.1 2000/11/01 16:01:22 kowal2 -Classes for handling the new hits structures - -*/ /////////////////////////////////////////////////////////////////////////////// // // // AliClassInfo // diff --git a/CONTAINERS/AliClassInfo.h b/CONTAINERS/AliClassInfo.h index c07b091a5cc..0ac558e8ffa 100644 --- a/CONTAINERS/AliClassInfo.h +++ b/CONTAINERS/AliClassInfo.h @@ -25,13 +25,14 @@ class AliClassInfo : public TNamed { public: AliClassInfo(){;} virtual ~AliClassInfo(){;} - virtual void CTORBuffer(void * pointer, UInt_t size=1){;} + virtual void CTORBuffer(void * /*pointer*/, UInt_t /*size=1*/){;} // {return (*ctorbuffer)(p,size);} - virtual void DTORBuffer(void * pointer, UInt_t size=1){;} + virtual void DTORBuffer(void * /*pointer*/, UInt_t /*size=1*/){;} //{return (*dtorbuffer)(p,size);} - virtual void StreamBuffer(TBuffer& b, const void *object, UInt_t size){;} + virtual void StreamBuffer(TBuffer& /*b*/, + const void */*object*/, UInt_t /*size*/){;} //{return (*streamb)(b,object,size);} - virtual void ObjectDump(void *p){;} + virtual void ObjectDump(void */*p*/){;} virtual const char * GetClassName(){ return 0;} virtual TClass * GetClass(){return 0;} virtual TDataType * GetDataType(){return 0;} diff --git a/CONTAINERS/AliDataType.cxx b/CONTAINERS/AliDataType.cxx index b5f21a5f057..ea5cc81e2ae 100644 --- a/CONTAINERS/AliDataType.cxx +++ b/CONTAINERS/AliDataType.cxx @@ -13,15 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2002/02/04 14:47:22 hristov -Corrections needed bu Root v3-02-07 +/* $Id$ */ -Revision 1.1 2000/11/01 16:01:22 kowal2 -Classes for handling the new hits structures - -*/ /////////////////////////////////////////////////////////////////////////////// // // // AliDataType // diff --git a/CONTAINERS/AliDataType.h b/CONTAINERS/AliDataType.h index 04c0e08e67a..7b3e25fd901 100644 --- a/CONTAINERS/AliDataType.h +++ b/CONTAINERS/AliDataType.h @@ -26,7 +26,7 @@ public: void ObjectDump(void *p); TDataType * GetDataType(){return fDataType;} protected: - AliDataType(const AliDataType & type){;} + AliDataType(const AliDataType & type): AliClassInfo(type) {;} AliDataType &operator = (const AliDataType & type){return *this;} //assignment operator TDataType * fDataType; //root type information ClassDef(AliDataType,0) diff --git a/CONTAINERS/AliDigits.cxx b/CONTAINERS/AliDigits.cxx index 6d0b56b367b..c1fcfa0c249 100644 --- a/CONTAINERS/AliDigits.cxx +++ b/CONTAINERS/AliDigits.cxx @@ -13,44 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - -$Log$ -Revision 1.4 2002/01/21 17:04:12 kowal2 -check the range of digits array - -Revision 1.3 2001/11/24 16:08:09 kowal2 -Fatsre algorithms - -Revision 1.2 2000/12/20 09:36:46 kowal2 -Improvements in algorithms to make the code faster - -Revision 1.1 2000/11/01 15:57:13 kowal2 -Moved from the TPC directory - -Revision 1.4 2000/10/05 16:01:49 kowal2 -Corrected for memory leaks. - -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.3 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.2.4.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.2.4.1 2000/06/14 16:45:13 kowal2 -Improved algorithms. Compiler warnings removed. - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:37:42 kowal2 - -Digits handling in a new data structure - -*/ +/* $Id$ */ /*MI change -- for Rule checker -- added copy constructor and assignmet operator @@ -96,7 +59,8 @@ AliDigits::AliDigits() Invalidate(); } -AliDigits::AliDigits(const AliDigits& digits) +AliDigits::AliDigits(const AliDigits& digits): + AliSegmentID(digits) { // //copy constructor diff --git a/CONTAINERS/AliH2F.cxx b/CONTAINERS/AliH2F.cxx index 28fa9537e80..6e66634c5e7 100644 --- a/CONTAINERS/AliH2F.cxx +++ b/CONTAINERS/AliH2F.cxx @@ -24,7 +24,6 @@ #include "AliH2F.h" #include "TClonesArray.h" -#include "AliTPC.h" #include "TRandom.h" @@ -53,26 +52,33 @@ AliH2F::~AliH2F() // } -AliH2F::AliH2F(const AliH2F &his) +AliH2F::AliH2F(const AliH2F &his) : + TH2F(his) { // } -AliH2F & AliH2F::operator = (const AliH2F & his) +AliH2F & AliH2F::operator = (const AliH2F & /*his*/) { // return *this; } +/* TClonesArray * AliH2F::FindPeaks(Float_t threshold, Float_t noise) { - - // - // not implemented - // - return 0; + //find peaks and write it in form of AliTPCcluster to array + + //firstly we need to create object for cluster finding + //and fill it with contents of histogram + AliTPCClusterFinder cfinder; + cfinder.SetThreshold(threshold); + cfinder.SetNoise(noise); + cfinder.GetHisto(this); + return cfinder.FindPeaks3(); } +*/ void AliH2F::ClearSpectrum() { diff --git a/CONTAINERS/AliH2F.h b/CONTAINERS/AliH2F.h index 9316da06ae3..7f015bcd261 100644 --- a/CONTAINERS/AliH2F.h +++ b/CONTAINERS/AliH2F.h @@ -23,7 +23,7 @@ public: public: AliH2F(const AliH2F &his); AliH2F & operator = (const AliH2F &his); - TClonesArray * FindPeaks(Float_t threshold, Float_t noise); +// TClonesArray * FindPeaks(Float_t threshold, Float_t noise); //find peaks and write it in form of AliTPCcluster to array void ClearSpectrum(); void AddGauss(Float_t x,Float_t y,Float_t sx, Float_t sy, Float_t max); diff --git a/CONTAINERS/AliMemArray.cxx b/CONTAINERS/AliMemArray.cxx index c17f9029ba6..a126497f49c 100644 --- a/CONTAINERS/AliMemArray.cxx +++ b/CONTAINERS/AliMemArray.cxx @@ -13,15 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2001/01/10 09:33:56 kowal2 -Clear method modified to fix the problem with reading Tree. +/* $Id$ */ -Revision 1.1 2000/11/01 16:01:26 kowal2 -Classes for handling the new hits structures - -*/ /////////////////////////////////////////////////////////////////////////////// // // // AliMemArray // @@ -92,7 +85,8 @@ AliMemArray::AliMemArray(Int_t objectSize, Int_t buffersize) fBufferSize =buffersize; } -AliMemArray::AliMemArray(const AliMemArray & arr) +AliMemArray::AliMemArray(const AliMemArray & arr): + TObject(arr) { // //copy constructor diff --git a/CONTAINERS/AliMemArray.h b/CONTAINERS/AliMemArray.h index 628ef16ad1d..161fd352a87 100644 --- a/CONTAINERS/AliMemArray.h +++ b/CONTAINERS/AliMemArray.h @@ -58,8 +58,8 @@ protected : void Reserve2D(UInt_t n); // protected: - virtual void CTORBuffer(void *buffer, UInt_t size){;} //array placement constructor - virtual void DTORBuffer(void *buffer, UInt_t size){;} //array placement destructor + virtual void CTORBuffer(void */*buffer*/, UInt_t /*size*/){;} //array placement constructor + virtual void DTORBuffer(void */*buffer*/, UInt_t /*size*/){;} //array placement destructor virtual void CopyBuffer(void *src, void *dest, UInt_t size); //array placement copy constructor UInt_t fSize; //total number of valid objects UInt_t fCapacity; //capacity of array diff --git a/CONTAINERS/AliObjectArray.cxx b/CONTAINERS/AliObjectArray.cxx index 8632d992540..84197e3045e 100644 --- a/CONTAINERS/AliObjectArray.cxx +++ b/CONTAINERS/AliObjectArray.cxx @@ -13,9 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ + /////////////////////////////////////////////////////////////////////////////// // // // AliObjectArray // @@ -62,7 +61,8 @@ AliObjectArray::AliObjectArray(const char * classname, Int_t buffersize):AliMemA SetClass(classname); } -AliObjectArray::AliObjectArray(const AliObjectArray &arr) +AliObjectArray::AliObjectArray(const AliObjectArray &arr): + AliMemArray(arr) { // // diff --git a/CONTAINERS/AliSegmentArray.cxx b/CONTAINERS/AliSegmentArray.cxx index 0b1d3c82ceb..24e0d1da0f1 100644 --- a/CONTAINERS/AliSegmentArray.cxx +++ b/CONTAINERS/AliSegmentArray.cxx @@ -13,52 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/14 14:55:34 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.7.6.1 2002/06/10 15:00:53 hristov -Merged with v3-08-02 - -Revision 1.8 2002/04/04 16:38:52 kowal2 -Digits and Sdigits go to separate files - -Revision 1.7 2001/10/21 18:22:54 hristov -BranchOld replaced by Branch. It works correctly with Root 2.02.xx - -Revision 1.6 2001/08/30 09:25:24 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. A temporary replacement of Branch with BranchOld is introduced - -Revision 1.5 2001/07/27 13:03:11 hristov -Default Branch split level set to 99 - -Revision 1.4 2001/06/07 18:23:52 buncic -TPC branches now correctly diverted into Digits.TPS.root file - -Revision 1.3 2001/02/05 14:34:54 hristov -Avoid deleting of Root class dictionary (R.Brun, M.Ivanov) - -Revision 1.2 2001/01/26 20:29:00 hristov -Major upgrade of AliRoot code - -Revision 1.1 2000/11/01 15:57:13 kowal2 -Moved from the TPC directory - -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.1 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:39:36 kowal2 - -New data structure handling - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -67,8 +22,10 @@ New data structure handling /////////////////////////////////////////////////////////////////////////////// #include -#include #include +#include +#include "AliRun.h" + #include "TClonesArray.h" #include "TDirectory.h" #include "AliArrayI.h" @@ -76,7 +33,6 @@ New data structure handling #include "TClass.h" #include "TFile.h" -#include "AliRun.h" #include "AliSegmentID.h" #include "AliSegmentArray.h" #include "TObjString.h" @@ -96,6 +52,7 @@ AliSegmentArray::AliSegmentArray() fTree = 0; fClass = 0; fBranch = 0; + fTreeOwner = kFALSE; } AliSegmentArray::AliSegmentArray(Text_t *classname, Int_t n) @@ -106,6 +63,7 @@ AliSegmentArray::AliSegmentArray(Text_t *classname, Int_t n) // Create an array of objects of classname. The class must inherit from // AliSegmentID . The second argument adjust number of entries in // the array. + fTreeOwner = kFALSE; fNSegment=0; fSegment =0; fTreeIndex = 0; @@ -121,14 +79,15 @@ AliSegmentArray::AliSegmentArray(Text_t *classname, Int_t n) } } -AliSegmentArray::AliSegmentArray(const AliSegmentArray &segment) +AliSegmentArray::AliSegmentArray(const AliSegmentArray &segment): + TNamed(segment) { // //copy constructor // to be later implemented } -AliSegmentArray &AliSegmentArray::operator = (const AliSegmentArray & segment) +AliSegmentArray &AliSegmentArray::operator = (const AliSegmentArray & /*segment*/) { //assignment operator //to be later implemented @@ -143,7 +102,10 @@ AliSegmentArray::~AliSegmentArray() fSegment->Delete(); delete fSegment; } - if (fTree) delete fTree; + if (fTree) + if (fTreeOwner) delete fTree; + else fTree->Reset(); + if (fTreeIndex) delete fTreeIndex; // if (fClass!=0) delete fClass; } @@ -158,17 +120,20 @@ Bool_t AliSegmentArray::SetClass(Text_t *classname) fClass = 0; } if (fTree !=0) { - delete fTree; + if (fTreeOwner) delete fTree; + else fTree->Reset(); fTree = 0; fBranch = 0; delete fTreeIndex; fTreeIndex = 0; } + if (fSegment != 0) { fSegment->Delete(); delete fSegment; fSegment = 0; } + if (!gROOT) ::Fatal("AliSegmentArray::AliSegmentArray", "ROOT system not initialized"); @@ -259,17 +224,33 @@ Bool_t AliSegmentArray::MakeArray(Int_t n) if (fSegment) return kTRUE; else return kFALSE; } +void AliSegmentArray::MakeTree(TTree* tree) +{ + //Make tree with the name + AliSegmentID * psegment = NewSegment(); + fTree = tree; + //PH fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000); + fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,99); +} void AliSegmentArray::MakeTree(char *file) { // AliSegmentID segment; AliSegmentID * psegment = NewSegment(); - if (fTree) delete fTree; - fTree = new TTree("Segment Tree","Tree with segments"); + if (fTree) + if (fTreeOwner) + { + delete fTree; + fTree = new TTree("Segment Tree","Tree with segments"); + } + else fTree->Reset(); + + //PH fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000); fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,99); - if (file) { + + if (file) { TString outFile = gAlice->GetBaseFile(); outFile = outFile + "/" + file; fBranch->SetFile(outFile.Data()); @@ -279,29 +260,12 @@ void AliSegmentArray::MakeTree(char *file) while ((b=(TBranch*)next())) { b->SetFile(outFile.Data()); } - cout << "Diverting branch " << "Segment" << " to file " << outFile << endl; + cout << "Diverting branch " << "Segment" << " to file " << outFile << endl; wd->cd(); } delete psegment; } -//////////////////////////////////////////////////////////////////////// -TTree* AliSegmentArray::MakeTree(TFile *file) -{ - // - // create the whole tree in the file file - // - AliSegmentID * psegment = NewSegment(); - if (fTree) delete fTree; - TDirectory *wd = gDirectory; - file->cd(); - fTree = new TTree("Segment Tree","Tree with segments"); - fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,99); - wd->cd(); - delete psegment; - return fTree; -} -//////////////////////////////////////////////////////////////////////// Bool_t AliSegmentArray::MakeDictionary(Int_t size) { @@ -328,15 +292,32 @@ Bool_t AliSegmentArray::MakeDictionary(Int_t size) return kTRUE; } +Bool_t AliSegmentArray::ConnectTree(TTree* tree) +{ + fTree =tree; + if (fTree == 0) return kFALSE; + fBranch = fTree->GetBranch("Segment"); + if (fBranch==0) return kFALSE; + MakeDictionary(TMath::Max(fNSegment,Int_t(fTree->GetEntries()))); + MakeArray(fTreeIndex->fN); + return kTRUE; +} + + Bool_t AliSegmentArray::ConnectTree(const char * treeName) { //connect tree from current directory if (fTree){ - delete fTree; - fTree = 0; - fBranch = 0; + if (fTreeOwner) + { + delete fTree; + fTree = 0; + } + else fTree->Reset(); + fBranch = 0; } fTree =(TTree*)gDirectory->Get(treeName); + if (fTree == 0) return kFALSE; fBranch = fTree->GetBranch("Segment"); if (fBranch==0) return kFALSE; @@ -419,7 +400,7 @@ void AliSegmentArray::Streamer(TBuffer &R__b) Version_t R__v = R__b.ReadVersion(); if (R__v) { } TNamed::Streamer(R__b); R__b>>ptreeName; - if (fTree) delete fTree; + if (fTree && fTreeOwner) delete fTree; ConnectTree(ptreeName->String()); } else { R__b.WriteVersion(AliSegmentArray::IsA()); @@ -431,3 +412,4 @@ void AliSegmentArray::Streamer(TBuffer &R__b) fTree->Write(); } } + diff --git a/CONTAINERS/AliSegmentArray.h b/CONTAINERS/AliSegmentArray.h index f3f73619e0a..24faeed0655 100644 --- a/CONTAINERS/AliSegmentArray.h +++ b/CONTAINERS/AliSegmentArray.h @@ -37,9 +37,12 @@ public: //input output functions TTree * GetTree(){return fTree;} //return pointer to connected tree - virtual void MakeTree(char *file=0); //Make tree with the name - virtual TTree* MakeTree(TFile *file); //Make tree in the file file + virtual void MakeTree(char *file=0); //Make tree with the name + virtual void MakeTree(TTree* tree); //Make tree with the name + virtual Bool_t ConnectTree(const char * treeName); //connect tree from current directory + virtual Bool_t ConnectTree(TTree* tree); //connect tree from current directory + virtual AliSegmentID * LoadSegment(Int_t index);//load segment with index to the memory virtual AliSegmentID * LoadEntry(Int_t index); //load segment entry from position index in tree virtual void StoreSegment(Int_t index);//write segmen persistent @@ -53,10 +56,11 @@ protected: AliArrayI * fTreeIndex; //!pointers(index) table in tree Int_t fNSegment; //number of alocated segments TTree * fTree; //!tree with segment objects - TBranch * fBranch; //!total branch + Bool_t fTreeOwner;// flag determing the ownership of the fTree + TBranch * fBranch; //!total branch private: TClass * fClass; //!class type of included objects - ClassDef(AliSegmentArray,1) + ClassDef(AliSegmentArray,2) }; diff --git a/CONTAINERS/AliSegmentID.cxx b/CONTAINERS/AliSegmentID.cxx index 40faed53cfe..9e5a4c14420 100644 --- a/CONTAINERS/AliSegmentID.cxx +++ b/CONTAINERS/AliSegmentID.cxx @@ -13,16 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:39:36 kowal2 - -New data structure handling - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/CONTAINERS/TArrayOfArray.cxx b/CONTAINERS/TArrayOfArray.cxx index 9ad4d3e9e94..f76d2bf285b 100644 --- a/CONTAINERS/TArrayOfArray.cxx +++ b/CONTAINERS/TArrayOfArray.cxx @@ -13,15 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2001/01/10 09:32:50 kowal2 -Changes to obey the coding rules. +/* $Id$ */ -Revision 1.1 2000/11/01 16:01:26 kowal2 -Classes for handling the new hits structures - -*/ #include "TArrayOfArray.h" #include "Riostream.h" diff --git a/CONTAINERS/libCONTAINERS.pkg b/CONTAINERS/libCONTAINERS.pkg index fb714864847..650f7d98282 100644 --- a/CONTAINERS/libCONTAINERS.pkg +++ b/CONTAINERS/libCONTAINERS.pkg @@ -10,4 +10,3 @@ HDRS= $(SRCS:.cxx=.h) DHDR:= CONTAINERSLinkDef.h -EINCLUDE:= TPC diff --git a/CRT/AliCRT.cxx b/CRT/AliCRT.cxx index d05855f7190..c1e4ffa98e6 100644 --- a/CRT/AliCRT.cxx +++ b/CRT/AliCRT.cxx @@ -13,34 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/14 14:55:34 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.4.2.2 2002/10/10 14:40:31 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.5 2002/10/07 11:12:26 gamez -Cleaned up version - -Revision 1.4 2002/07/12 12:56:18 gamez -Material numbers, correction - -Revision 1.3.2.1 2002/07/12 12:31:30 gamez -Material numbers, correction - -Revision 1.3 2002/07/10 15:53:10 gamez -Molasse redefinition - -Revision 1.2 2002/07/09 08:45:35 hristov -Old style include files needed on HP (aCC) - -Revision 1.1 2002/06/16 17:08:19 hristov -First version of CRT - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -65,14 +38,14 @@ First version of CRT /////////////////////////////////////////////////////////////////////////////// #include - -#include "AliRun.h" -#include "AliMagF.h" +#include #include "AliCRT.h" #include "AliCRTConstants.h" #include "AliCRThit.h" - +#include "AliLoader.h" +#include "AliMagF.h" +#include "AliRun.h" ClassImp(AliCRT) @@ -349,7 +322,7 @@ void AliCRT::SetTreeAddress() sprintf(branchname,"%s",GetName()); // Branch address for hit tree - TTree *treeH = gAlice->TreeH(); + TTree *treeH = fLoader->TreeH(); if (treeH && fHits) { branch = treeH->GetBranch(branchname); if (branch) branch->SetAddress(&fHits); diff --git a/CRT/AliCRTConstants.cxx b/CRT/AliCRTConstants.cxx index 2c78588bba6..280543c1728 100644 --- a/CRT/AliCRTConstants.cxx +++ b/CRT/AliCRTConstants.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.4.1 2002/11/26 16:32:24 hristov +Merging NewIO with v3-09-04 + +Revision 1.3 2002/10/14 14:55:34 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.1.4.2 2002/10/10 14:40:31 hristov Updating VirtualMC to v3-09-02 diff --git a/CRT/AliCRThit.cxx b/CRT/AliCRThit.cxx index 2b97e26852b..17b28f6ddd8 100644 --- a/CRT/AliCRThit.cxx +++ b/CRT/AliCRThit.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.6.4.1 2002/11/26 16:32:24 hristov +Merging NewIO with v3-09-04 + +Revision 1.6 2002/10/14 14:55:34 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.1.4.3 2002/10/10 14:40:31 hristov Updating VirtualMC to v3-09-02 diff --git a/CRT/AliCRTv0.cxx b/CRT/AliCRTv0.cxx index 1d3981e3301..5c45b0e91f9 100644 --- a/CRT/AliCRTv0.cxx +++ b/CRT/AliCRTv0.cxx @@ -13,46 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2002/10/29 17:20:37 hristov -Corrections for subscript out of range (Alpha) - -Revision 1.9 2002/10/23 06:47:56 alibrary -Introducing Riostream.h - -Revision 1.8 2002/10/14 14:55:34 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.4.2.4 2002/10/10 14:40:31 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.7 2002/10/07 11:13:25 gamez -Access shafts added - -Revision 1.6 2002/07/26 06:21:12 gamez -CRT3 volume taken as sensitive volume - -Revision 1.5 2002/07/25 12:52:34 morsch -AddHit call only if hit has been defined. - -Revision 1.4 2002/07/12 12:57:29 gamez -Division of CRT1 corrected - -Revision 1.3.2.1 2002/07/12 12:32:50 gamez -Division of CRT1 corrected - -Revision 1.3 2002/07/10 15:57:04 gamez -CreateHall() removed, and new Molasse volumes - -Revision 1.2 2002/07/09 08:45:35 hristov -Old style include files needed on HP (aCC) - -Revision 1.1 2002/06/16 17:08:19 hristov -First version of CRT - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -86,18 +47,18 @@ First version of CRT #include -#include #include -#include +#include #include +#include +#include -#include "AliRun.h" -#include "AliMagF.h" +#include "AliCRTConstants.h" +#include "AliCRTv0.h" #include "AliConst.h" +#include "AliMagF.h" #include "AliPDG.h" - -#include "AliCRTv0.h" -#include "AliCRTConstants.h" +#include "AliRun.h" ClassImp(AliCRTv0) diff --git a/CRT/AliCRTv1.cxx b/CRT/AliCRTv1.cxx index fe1d896e0b1..8f05fc579ea 100644 --- a/CRT/AliCRTv1.cxx +++ b/CRT/AliCRTv1.cxx @@ -13,25 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2002/11/21 19:34:52 alibrary -Removing AliMC and AliMCProcess - -Revision 1.3 2002/10/23 06:47:56 alibrary -Introducing Riostream.h - -Revision 1.2 2002/10/14 14:55:34 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.1.2.1 2002/10/10 14:40:31 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.1 2002/10/07 11:22:53 gamez -First version, stand alone detector - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -64,14 +46,12 @@ First version, stand alone detector /////////////////////////////////////////////////////////////////////////////// -#include #include #include #include #include #include - #include "AliCRTConstants.h" #include "AliCRTv1.h" #include "AliConst.h" diff --git a/CRT/AliGenCRT.cxx b/CRT/AliGenCRT.cxx index 735b350a4d5..ecf4cba8273 100644 --- a/CRT/AliGenCRT.cxx +++ b/CRT/AliGenCRT.cxx @@ -13,25 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2002/11/21 19:34:52 alibrary -Removing AliMC and AliMCProcess - -Revision 1.3 2002/10/23 06:47:56 alibrary -Introducing Riostream.h - -Revision 1.2 2002/10/14 14:55:34 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.1.2.1 2002/10/10 14:40:31 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.1 2002/10/07 11:25:28 gamez -First version, generation of cosmic muons on the surface - - -*/ +/* $Id$ */ ///////////////////////////////////////////////////////////////////////////// // @@ -54,6 +36,7 @@ First version, generation of cosmic muons on the surface ///////////////////////////////////////////////////////////////////////////// #include + #include #include diff --git a/EMCAL/AliEMCAL.cxx b/EMCAL/AliEMCAL.cxx index 8546a66cee4..89f47bd13fc 100644 --- a/EMCAL/AliEMCAL.cxx +++ b/EMCAL/AliEMCAL.cxx @@ -27,19 +27,21 @@ // --- ROOT system --- class TFile; -#include "TBranch.h" -#include "TClonesArray.h" -#include "TTree.h" +#include +#include +#include +#include // --- Standard library --- #include // --- AliRoot header files --- -#include "AliEMCAL.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliEMCAL.h" #include "AliEMCALGeometry.h" +#include "AliEMCALLoader.h" //#include "AliEMCALQAChecker.h" +#include "AliRun.h" ClassImp(AliEMCAL) //____________________________________________________________________________ @@ -57,7 +59,6 @@ AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title) { // ctor : title is used to identify the layout - fGeom = AliEMCALGeometry::GetInstance(GetTitle(),"") ; //fQATask = 0; fTreeQA = 0; } @@ -187,31 +188,57 @@ void AliEMCAL::SetTreeAddress() sprintf(branchname,"%s",GetName()); // Branch address for hit tree - TTree *treeH = gAlice->TreeH(); - if (treeH && fHits) { + TTree *treeH = TreeH(); + if (treeH) { branch = treeH->GetBranch(branchname); - if (branch) branch->SetAddress(&fHits); + if (branch) + { + if (fHits == 0x0) fHits= new TClonesArray("AliEMCALHit",1000); + //Info("SetTreeAddress","<%s> Setting Hits Address",GetName()); + branch->SetAddress(&fHits); + } + else + { + Warning("SetTreeAddress","<%s> Failed",GetName()); + } } } - //____________________________________________________________________________ void AliEMCAL::WriteQA() { - + // Make TreeQA in the output file. - + if(fTreeQA == 0) fTreeQA = new TTree("TreeQA", "QA Alarms") ; // Create Alarms branches -// Int_t bufferSize = 32000 ; -// Int_t splitlevel = 0 ; -// TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ; -// TString branchName(alarmsF->GetName()); -// TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel); -// TString branchTitle = branchName + " QA alarms" ; -// alarmsBranch->SetTitle(branchTitle); -// alarmsBranch->Fill() ; - - //fTreeQA->Fill() ; + Int_t bufferSize = 32000 ; + Int_t splitlevel = 0 ; + + TFolder* topfold = GetLoader()->GetTopFolder(); //get top aliroot folder; skowron + TString emcalqafn(AliConfig::Instance()->GetQAFolderName()+"/"); //get name of QAaut folder relative to top event; skowron + emcalqafn+=GetName(); //hard wired string!!! add the detector name to the pathname; skowron + TFolder * alarmsF = (TFolder*)topfold->FindObjectAny(emcalqafn); //get the folder + + if (alarmsF == 0x0) + { + Error("WriteQA","Can not find folder with qa alarms"); + return; + } + TString branchName(alarmsF->GetName()); + TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel); + TString branchTitle = branchName + " QA alarms" ; + alarmsBranch->SetTitle(branchTitle); + alarmsBranch->Fill() ; + + //fTreeQA } +//____________________________________________________________________________ +AliLoader* AliEMCAL::MakeLoader(const char* topfoldername) +{ +//different behaviour than standard (singleton getter) +// --> to be discussed and made eventually coherent + fLoader = new AliEMCALLoader(GetName(),topfoldername); + return fLoader; +} diff --git a/EMCAL/AliEMCAL.h b/EMCAL/AliEMCAL.h index 00b8ca93f91..673f83588b2 100644 --- a/EMCAL/AliEMCAL.h +++ b/EMCAL/AliEMCAL.h @@ -60,6 +60,8 @@ class AliEMCAL : public AliDetector { return *this ; } + virtual AliLoader* MakeLoader(const char* topfoldername); + protected: //AliEMCALQAChecker * fQATask ; //! PHOS checkers container diff --git a/EMCAL/AliEMCALClusterizer.cxx b/EMCAL/AliEMCALClusterizer.cxx index 2582a70dbef..50010de60e9 100644 --- a/EMCAL/AliEMCALClusterizer.cxx +++ b/EMCAL/AliEMCALClusterizer.cxx @@ -48,26 +48,20 @@ ClassImp(AliEMCALClusterizer) AliEMCALClusterizer::AliEMCALClusterizer():TTask("","") { // ctor - fSplitFile = 0 ; - fToSplit = kFALSE ; - + fEventFolderName = "" ; } //____________________________________________________________________________ -AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name, const Bool_t toSplit): -TTask(name, headerFile) +AliEMCALClusterizer::AliEMCALClusterizer(const TString alirunFileName, const TString eventFolderName): + TTask("EMCAL"+AliConfig::fgkReconstructionerTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - fToSplit = toSplit ; - fSplitFile = 0 ; - + } //____________________________________________________________________________ AliEMCALClusterizer::~AliEMCALClusterizer() { // dtor - - fSplitFile = 0 ; - } +} diff --git a/EMCAL/AliEMCALClusterizer.h b/EMCAL/AliEMCALClusterizer.h index 1babb7cb542..e7299a8ca74 100644 --- a/EMCAL/AliEMCALClusterizer.h +++ b/EMCAL/AliEMCALClusterizer.h @@ -18,15 +18,14 @@ // --- Standard library --- // --- AliRoot header files --- - -//#include "AliEMCALDigit.h" +#include "AliConfig.h" class AliEMCALClusterizer : public TTask { public: AliEMCALClusterizer() ; // default ctor - AliEMCALClusterizer(const char * headerFile, const char * name, const Bool_t toSplit) ; + AliEMCALClusterizer(const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; virtual ~AliEMCALClusterizer() ; // dtor virtual Float_t GetTowerClusteringThreshold()const {Warning("GetTowerClusteringThreshold", "Not Defined") ; return 0. ; } @@ -59,11 +58,9 @@ public: virtual const char * Version() const {Warning("Version", "Not Defined") ; return 0 ; } protected: - - TFile * fSplitFile ; //! file in which RecPoints will eventually be stored - Bool_t fToSplit ; //! Should we write to splitted file + TString fEventFolderName ; // event folder name - ClassDef(AliEMCALClusterizer,2) // Clusterization algorithm class + ClassDef(AliEMCALClusterizer,3) // Clusterization algorithm class } ; diff --git a/EMCAL/AliEMCALClusterizerv1.cxx b/EMCAL/AliEMCALClusterizerv1.cxx index 2daf060bf58..8d821081115 100644 --- a/EMCAL/AliEMCALClusterizerv1.cxx +++ b/EMCAL/AliEMCALClusterizerv1.cxx @@ -68,15 +68,13 @@ // --- AliRoot header files --- - +#include "AliEMCALGetter.h" #include "AliEMCALClusterizerv1.h" +#include "AliEMCALTowerRecPoint.h" #include "AliEMCALDigit.h" #include "AliEMCALDigitizer.h" -#include "AliEMCALTowerRecPoint.h" #include "AliEMCAL.h" -#include "AliEMCALGetter.h" #include "AliEMCALGeometry.h" -#include "AliRun.h" ClassImp(AliEMCALClusterizerv1) @@ -90,8 +88,8 @@ ClassImp(AliEMCALClusterizerv1) } //____________________________________________________________________________ -AliEMCALClusterizerv1::AliEMCALClusterizerv1(const char* headerFile, const char* name, const Bool_t toSplit) -:AliEMCALClusterizer(headerFile, name, toSplit) +AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const TString eventFolderName) +:AliEMCALClusterizer(alirunFileName, eventFolderName) { // ctor with the indication of the file where header Tree and digits Tree are stored @@ -105,16 +103,14 @@ AliEMCALClusterizerv1::AliEMCALClusterizerv1(const char* headerFile, const char* AliEMCALClusterizerv1::~AliEMCALClusterizerv1() { // dtor - fSplitFile = 0 ; } //____________________________________________________________________________ const TString AliEMCALClusterizerv1::BranchName() const { - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + return GetName(); + } //____________________________________________________________________________ @@ -124,10 +120,10 @@ Float_t AliEMCALClusterizerv1::Calibrate(Int_t amp, Int_t where) const // where = 0 == PRE ; where = 1 == ECAL ; where = 2 == HCAL if ( where == 0 ) // calibrate as PRE section return -fADCpedestalPRE + amp * fADCchannelPRE ; - else if (where == 1) //calibrate as EC section - return -fADCpedestalEC + amp * fADCchannelEC ; - else if (where == 2) //calibrate as HC section - return -fADCpedestalHC + amp * fADCchannelHC ; + else if (where == 1) //calibrate as ECA section + return -fADCpedestalECA + amp * fADCchannelECA ; + else if (where == 2) //calibrate as HCA section + return -fADCpedestalHCA + amp * fADCchannelHCA ; else Fatal("Calibrate", "Something went wrong!") ; return -9999999. ; @@ -138,18 +134,14 @@ void AliEMCALClusterizerv1::Exec(Option_t * option) { // Steering method - if( strcmp(GetName(), "")== 0 ) - Init() ; - if(strstr(option,"tim")) gBenchmark->Start("EMCALClusterizer"); if(strstr(option,"print")) Print("") ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - if(gime->BranchExists("RecPoints")) - return ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; @@ -157,10 +149,9 @@ void AliEMCALClusterizerv1::Exec(Option_t * option) gime->Event(ievent,"D") ; - if(ievent == 0) - GetCalibrationParameters() ; + GetCalibrationParameters() ; - fNumberOfPREClusters = fNumberOfECClusters = fNumberOfHCClusters = 0 ; + fNumberOfPREClusters = fNumberOfECAClusters = fNumberOfHCAClusters = 0 ; MakeClusters() ; @@ -172,18 +163,19 @@ void AliEMCALClusterizerv1::Exec(Option_t * option) if(strstr(option,"deb")) PrintRecPoints(option) ; - //increment the total number of digits per run + //increment the total number of recpoints per run fRecPointsInRun += gime->PRERecPoints()->GetEntriesFast() ; - fRecPointsInRun += gime->ECALRecPoints()->GetEntriesFast() ; - fRecPointsInRun += gime->HCALRecPoints()->GetEntriesFast() ; - } + fRecPointsInRun += gime->ECARecPoints()->GetEntriesFast() ; + fRecPointsInRun += gime->HCARecPoints()->GetEntriesFast() ; + } + Unload(); + if(strstr(option,"tim")){ gBenchmark->Stop("EMCALClusterizer"); Info("Exec", "took %f seconds for Clusterizing %f seconds per event", gBenchmark->GetCpuTime("EMCALClusterizer"), gBenchmark->GetCpuTime("EMCALClusterizer")/nevents ) ; } - } //____________________________________________________________________________ @@ -194,7 +186,7 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDig // The initial values for fitting procedure are set equal to the positions of local maxima. // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; TClonesArray * digits = gime->Digits() ; @@ -281,17 +273,20 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDig //____________________________________________________________________________ void AliEMCALClusterizerv1::GetCalibrationParameters() { - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - const AliEMCALDigitizer * dig = gime->Digitizer(BranchName()) ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + if ( !gime->Digitizer() ) + gime->LoadDigitizer(); + AliEMCALDigitizer * dig = gime->Digitizer(); + fADCchannelPRE = dig->GetPREchannel() ; fADCpedestalPRE = dig->GetPREpedestal() ; - fADCchannelEC = dig->GetECchannel() ; - fADCpedestalEC = dig->GetECpedestal(); + fADCchannelECA = dig->GetECAchannel() ; + fADCpedestalECA = dig->GetECApedestal(); - fADCchannelHC = dig->GetHCchannel() ; - fADCpedestalHC = dig->GetHCpedestal(); + fADCchannelHCA = dig->GetHCAchannel() ; + fADCpedestalHCA = dig->GetHCApedestal(); } //____________________________________________________________________________ @@ -300,78 +295,39 @@ void AliEMCALClusterizerv1::Init() // Make all memory allocations which can not be done in default constructor. // Attach the Clusterizer task to the list of EMCAL tasks - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname = GetName() ; - branchname.Remove(branchname.Index(Version())-1) ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data()); - AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), branchname.Data(), fToSplit ) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !" ) ; - return ; - } - - fSplitFile = 0 ; - if(fToSplit){ - // construct the name of the file as /path/EMCAL.SDigits.root - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } + AliEMCALGeometry * geom = gime->EMCALGeometry() ; - const AliEMCALGeometry * geom = gime->EMCALGeometry() ; fNTowers = geom->GetNZ() * geom->GetNPhi() ; if(!gMinuit) gMinuit = new TMinuit(100) ; - gime->PostClusterizer(this) ; - gime->PostRecPoints(branchname ) ; - + if ( !gime->Clusterizer() ) + gime->PostClusterizer(this); } //____________________________________________________________________________ void AliEMCALClusterizerv1::InitParameters() { - fNumberOfPREClusters = fNumberOfECClusters = fNumberOfHCClusters = 0 ; + fNumberOfPREClusters = fNumberOfECAClusters = fNumberOfHCAClusters = 0 ; fPREClusteringThreshold = 0.0001; // must be adjusted according to the noise leve set by digitizer - fECClusteringThreshold = 0.0045; // must be adjusted according to the noise leve set by digitizer - fHCClusteringThreshold = 0.001; // must be adjusted according to the noise leve set by digitizer + fECAClusteringThreshold = 0.0045; // must be adjusted according to the noise leve set by digitizer + fHCAClusteringThreshold = 0.001; // must be adjusted according to the noise leve set by digitizer fPRELocMaxCut = 0.03 ; - fECLocMaxCut = 0.03 ; - fHCLocMaxCut = 0.03 ; + fECALocMaxCut = 0.03 ; + fHCALocMaxCut = 0.03 ; fPREW0 = 4.0 ; - fECW0 = 4.5 ; - fHCW0 = 4.5 ; + fECAW0 = 4.5 ; + fHCAW0 = 4.5 ; fTimeGate = 1.e-8 ; fToUnfold = kFALSE ; - - TString clusterizerName( GetName()) ; - if (clusterizerName.IsNull() ) - clusterizerName = "Default" ; - clusterizerName.Append(":") ; - clusterizerName.Append(Version()) ; - SetName(clusterizerName) ; - fRecPointsInRun = 0 ; - + + fRecPointsInRun = 0 ; + } //____________________________________________________________________________ @@ -384,7 +340,7 @@ Int_t AliEMCALClusterizerv1::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster // which is compared to a digit (d2) not yet in a cluster - AliEMCALGeometry * geom = AliEMCALGetter::GetInstance()->EMCALGeometry() ; + AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ; Int_t rv = 0 ; @@ -423,6 +379,13 @@ Int_t AliEMCALClusterizerv1::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d return rv ; } +//____________________________________________________________________________ +void AliEMCALClusterizerv1::Unload() +{ + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + gime->EmcalLoader()->UnloadDigits() ; + gime->EmcalLoader()->UnloadRecPoints() ; +} //____________________________________________________________________________ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event) @@ -431,32 +394,15 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event) // Creates new branches with given title // fills and writes into TreeR. - AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter *gime = AliEMCALGetter::Instance() ; TObjArray * aPRERecPoints = gime->PRERecPoints() ; - TObjArray * aECRecPoints = gime->ECALRecPoints() ; - TObjArray * aHCRecPoints = gime->HCALRecPoints() ; + TObjArray * aECARecPoints = gime->ECARecPoints() ; + TObjArray * aHCARecPoints = gime->HCARecPoints() ; TClonesArray * digits = gime->Digits() ; - TTree * treeR ; + TTree * treeR = gime->TreeR(); ; - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - TString name("TreeR") ; - name += event ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - - if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; - } - Int_t index ; //Evaluate position, dispersion and other RecPoint properties for PRE section @@ -470,26 +416,26 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event) aPRERecPoints->Expand(aPRERecPoints->GetEntriesFast()) ; //Evaluate position, dispersion and other RecPoint properties for EC section - for(index = 0; index < aECRecPoints->GetEntries(); index++) - (dynamic_cast(aECRecPoints->At(index)))->EvalAll(fECW0,digits) ; + for(index = 0; index < aECARecPoints->GetEntries(); index++) + (dynamic_cast(aECARecPoints->At(index)))->EvalAll(fECAW0,digits) ; - aECRecPoints->Sort() ; + aECARecPoints->Sort() ; - for(index = 0; index < aECRecPoints->GetEntries(); index++) - (dynamic_cast(aECRecPoints->At(index)))->SetIndexInList(index) ; + for(index = 0; index < aECARecPoints->GetEntries(); index++) + (dynamic_cast(aECARecPoints->At(index)))->SetIndexInList(index) ; - aECRecPoints->Expand(aECRecPoints->GetEntriesFast()) ; + aECARecPoints->Expand(aECARecPoints->GetEntriesFast()) ; - //Evaluate position, dispersion and other RecPoint properties for HC section - for(index = 0; index < aHCRecPoints->GetEntries(); index++) - (dynamic_cast(aHCRecPoints->At(index)))->EvalAll(fHCW0,digits) ; + //Evaluate position, dispersion and other RecPoint properties for HCA section + for(index = 0; index < aHCARecPoints->GetEntries(); index++) + (dynamic_cast(aHCARecPoints->At(index)))->EvalAll(fHCAW0,digits) ; - aHCRecPoints->Sort() ; + aHCARecPoints->Sort() ; - for(index = 0; index < aHCRecPoints->GetEntries(); index++) - (dynamic_cast(aHCRecPoints->At(index)))->SetIndexInList(index) ; + for(index = 0; index < aHCARecPoints->GetEntries(); index++) + (dynamic_cast(aHCARecPoints->At(index)))->SetIndexInList(index) ; - aHCRecPoints->Expand(aHCRecPoints->GetEntriesFast()) ; + aHCARecPoints->Expand(aHCARecPoints->GetEntriesFast()) ; Int_t bufferSize = 32000 ; Int_t splitlevel = 0 ; @@ -499,27 +445,19 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event) branchPRE->SetTitle(BranchName()); //EC section branch - TBranch * branchEC = treeR->Branch("EMCALECRP","TObjArray",&aECRecPoints,bufferSize,splitlevel); - branchEC->SetTitle(BranchName()); + TBranch * branchECA = treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel); + branchECA->SetTitle(BranchName()); - //HC section branch - TBranch * branchHC = treeR->Branch("EMCALHCRP","TObjArray",&aHCRecPoints,bufferSize,splitlevel); - branchHC->SetTitle(BranchName()); - - //And Finally clusterizer branch - AliEMCALClusterizerv1 * cl = (AliEMCALClusterizerv1*)gime->Clusterizer(BranchName()) ; - TBranch * clusterizerBranch = treeR->Branch("AliEMCALClusterizer","AliEMCALClusterizerv1", - &cl,bufferSize,splitlevel); - clusterizerBranch->SetTitle(BranchName()); + //HCA section branch + TBranch * branchHCA = treeR->Branch("EMCALHCARP","TObjArray",&aHCARecPoints,bufferSize,splitlevel); + branchHCA->SetTitle(BranchName()); branchPRE->Fill() ; - branchEC->Fill() ; - branchHC->Fill() ; - clusterizerBranch->Fill() ; + branchECA->Fill() ; + branchHCA->Fill() ; - treeR->AutoSave() ; //Write(0,kOverwrite) ; - if(gAlice->TreeR()!=treeR) - treeR->Delete(); + gime->WriteRecPoints("OVERWRITE"); + gime->WriteClusterizer("OVERWRITE"); } //____________________________________________________________________________ @@ -528,48 +466,45 @@ void AliEMCALClusterizerv1::MakeClusters() // Steering method to construct the clusters stored in a list of Reconstructed Points // A cluster is defined as a list of neighbour digits - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; AliEMCALGeometry * geom = gime->EMCALGeometry() ; - TObjArray * aPRERecPoints = gime->PRERecPoints(BranchName()) ; - TObjArray * aECRecPoints = gime->ECALRecPoints(BranchName()) ; - TObjArray * aHCRecPoints = gime->HCALRecPoints(BranchName()) ; + TObjArray * aPRERecPoints = gime->PRERecPoints() ; + TObjArray * aECARecPoints = gime->ECARecPoints() ; + TObjArray * aHCARecPoints = gime->HCARecPoints() ; aPRERecPoints->Delete() ; - aECRecPoints->Delete() ; - aHCRecPoints->Delete() ; + aECARecPoints->Delete() ; + aHCARecPoints->Delete() ; TClonesArray * digits = gime->Digits() ; - if ( !digits ) { - Fatal("MakeClusters -> Digits with name %s not found", GetName() ) ; - } TIter next(digits) ; AliEMCALDigit * digit ; - Int_t ndigEC=0, ndigPRE=0, ndigHC=0 ; + Int_t ndigECA=0, ndigPRE=0, ndigHCA=0 ; - // count the number of digits in EC section + // count the number of digits in ECA section while ( (digit = dynamic_cast(next())) ) { // scan over the list of digits - if (geom->IsInECAL(digit->GetId())) - ndigEC++ ; + if (geom->IsInECA(digit->GetId())) + ndigECA++ ; else if (geom->IsInPRE(digit->GetId())) ndigPRE++; - else if (geom->IsInHCAL(digit->GetId())) - ndigHC++; + else if (geom->IsInHCA(digit->GetId())) + ndigHCA++; else { Error("MakeClusters", "id = %d is a wrong ID!", digit->GetId()) ; abort() ; } } - // add amplitude of PRE and EC sections - Int_t digEC ; - for (digEC = 0 ; digEC < ndigEC ; digEC++) { - digit = dynamic_cast(digits->At(digEC)) ; + // add amplitude of PRE and ECA sections + Int_t digECA ; + for (digECA = 0 ; digECA < ndigECA ; digECA++) { + digit = dynamic_cast(digits->At(digECA)) ; Int_t digPRE ; - for (digPRE = ndigEC ; digPRE < ndigEC+ndigPRE ; digPRE++) { + for (digPRE = ndigECA ; digPRE < ndigECA+ndigPRE ; digPRE++) { AliEMCALDigit * digitPRE = dynamic_cast(digits->At(digPRE)) ; if ( geom->AreInSameTower(digit->GetId(), digitPRE->GetId()) ){ Float_t amp = static_cast(digit->GetAmp()) + geom->GetSummationFraction() * static_cast(digitPRE->GetAmp()) + 0.5 ; @@ -587,61 +522,61 @@ void AliEMCALClusterizerv1::MakeClusters() // Clusterization starts TIter nextdigit(digitsC) ; - Bool_t notremovedEC = kTRUE, notremovedPRE = kTRUE ; + Bool_t notremovedECA = kTRUE, notremovedPRE = kTRUE ; while ( (digit = dynamic_cast(nextdigit())) ) { // scan over the list of digitsC AliEMCALRecPoint * clu = 0 ; - TArrayI clusterPREdigitslist(50), clusterECdigitslist(50), clusterHCdigitslist(50); + TArrayI clusterPREdigitslist(50), clusterECAdigitslist(50), clusterHCAdigitslist(50); - Bool_t inPRE = kFALSE, inECAL = kFALSE, inHCAL = kFALSE ; + Bool_t inPRE = kFALSE, inECA = kFALSE, inHCA = kFALSE ; if( geom->IsInPRE(digit->GetId()) ) { inPRE = kTRUE ; } - else if( geom->IsInECAL(digit->GetId()) ) { - inECAL = kTRUE ; + else if( geom->IsInECA(digit->GetId()) ) { + inECA = kTRUE ; } - else if( geom->IsInHCAL(digit->GetId()) ) { - inHCAL = kTRUE ; + else if( geom->IsInHCA(digit->GetId()) ) { + inHCA = kTRUE ; } if (gDebug == 2) { if (inPRE) Info("MakeClusters","id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp(), 0), fPREClusteringThreshold) ; - if (inECAL) + if (inECA) Info("MakeClusters","id = %d, ene = %f , thre = %f", - digit->GetId(),Calibrate(digit->GetAmp(), 1), fECClusteringThreshold) ; - if (inHCAL) + digit->GetId(),Calibrate(digit->GetAmp(), 1), fECAClusteringThreshold) ; + if (inHCA) Info("MakeClusters","id = %d, ene = %f , thre = %f", - digit->GetId(),Calibrate(digit->GetAmp(), 2), fHCClusteringThreshold ) ; + digit->GetId(),Calibrate(digit->GetAmp(), 2), fHCAClusteringThreshold ) ; } if ( (inPRE && (Calibrate(digit->GetAmp(), 0) > fPREClusteringThreshold )) || - (inECAL && (Calibrate(digit->GetAmp(), 1) > fECClusteringThreshold )) || - (inHCAL && (Calibrate(digit->GetAmp(), 2) > fHCClusteringThreshold )) ) { + (inECA && (Calibrate(digit->GetAmp(), 1) > fECAClusteringThreshold )) || + (inHCA && (Calibrate(digit->GetAmp(), 2) > fHCAClusteringThreshold )) ) { - Int_t iDigitInPRECluster = 0, iDigitInECCluster = 0, iDigitInHCCluster = 0; + Int_t iDigitInPRECluster = 0, iDigitInECACluster = 0, iDigitInHCACluster = 0; Int_t where ; // PRE = 0, ECAl = 1, HCAL = 2 // Find the seed in each of the section ECAL/PRE/HCAL - if( geom->IsInECAL(digit->GetId()) ) { + if( geom->IsInECA(digit->GetId()) ) { where = 1 ; // to tell we are in ECAL // start a new Tower RecPoint - if(fNumberOfECClusters >= aECRecPoints->GetSize()) - aECRecPoints->Expand(2*fNumberOfECClusters+1) ; + if(fNumberOfECAClusters >= aECARecPoints->GetSize()) + aECARecPoints->Expand(2*fNumberOfECAClusters+1) ; AliEMCALTowerRecPoint * rp = new AliEMCALTowerRecPoint("") ; - rp->SetECAL() ; - aECRecPoints->AddAt(rp, fNumberOfECClusters) ; - clu = dynamic_cast(aECRecPoints->At(fNumberOfECClusters)) ; - fNumberOfECClusters++ ; + rp->SetECA() ; + aECARecPoints->AddAt(rp, fNumberOfECAClusters) ; + clu = dynamic_cast(aECARecPoints->At(fNumberOfECAClusters)) ; + fNumberOfECAClusters++ ; clu->AddDigit(*digit, Calibrate(digit->GetAmp(), where)) ; - clusterECdigitslist[iDigitInECCluster] = digit->GetIndexInList() ; - iDigitInECCluster++ ; + clusterECAdigitslist[iDigitInECACluster] = digit->GetIndexInList() ; + iDigitInECACluster++ ; digitsC->Remove(digit) ; if (gDebug == 2 ) - Info("MakeClusters","OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp(), 1), fECClusteringThreshold) ; + Info("MakeClusters","OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp(), 1), fECAClusteringThreshold) ; } else if( geom->IsInPRE(digit->GetId()) ) { @@ -663,35 +598,35 @@ void AliEMCALClusterizerv1::MakeClusters() nextdigit.Reset() ; - // Here we remove remaining EC digits, which cannot make a cluster + // Here we remove remaining ECA digits, which cannot make a cluster - if( notremovedEC ) { + if( notremovedECA ) { while( ( digit = dynamic_cast(nextdigit()) ) ) { - if( geom->IsInECAL(digit->GetId()) ) + if( geom->IsInECA(digit->GetId()) ) digitsC->Remove(digit) ; else break ; } - notremovedEC = kFALSE ; + notremovedECA = kFALSE ; } } - else if( geom->IsInHCAL(digit->GetId()) ) { + else if( geom->IsInHCA(digit->GetId()) ) { where = 2 ; // to tell we are in HCAL // start a new HCAL cluster - if(fNumberOfHCClusters >= aHCRecPoints->GetSize()) - aHCRecPoints->Expand(2*fNumberOfHCClusters+1); + if(fNumberOfHCAClusters >= aHCARecPoints->GetSize()) + aHCARecPoints->Expand(2*fNumberOfHCAClusters+1); AliEMCALTowerRecPoint * rp = new AliEMCALTowerRecPoint("") ; - rp->SetHCAL() ; - aHCRecPoints->AddAt(rp, fNumberOfHCClusters) ; - clu = dynamic_cast(aHCRecPoints->At(fNumberOfHCClusters)) ; - fNumberOfHCClusters++ ; + rp->SetHCA() ; + aHCARecPoints->AddAt(rp, fNumberOfHCAClusters) ; + clu = dynamic_cast(aHCARecPoints->At(fNumberOfHCAClusters)) ; + fNumberOfHCAClusters++ ; clu->AddDigit(*digit, Calibrate(digit->GetAmp(), where)); - clusterHCdigitslist[iDigitInHCCluster] = digit->GetIndexInList() ; - iDigitInHCCluster++ ; + clusterHCAdigitslist[iDigitInHCACluster] = digit->GetIndexInList() ; + iDigitInHCACluster++ ; digitsC->Remove(digit) ; if (gDebug == 2 ) - Info("MakeClusters","OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp(), 2), fHCClusteringThreshold) ; + Info("MakeClusters","OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp(), 2), fHCAClusteringThreshold) ; nextdigit.Reset() ; @@ -715,8 +650,8 @@ void AliEMCALClusterizerv1::MakeClusters() // Do the Clustering in each of the three section ECAL/PRE/HCAL - while (index < iDigitInECCluster){ // scan over digits already in cluster - digit = (AliEMCALDigit*)digits->At(clusterECdigitslist[index]) ; + while (index < iDigitInECACluster){ // scan over digits already in cluster + digit = (AliEMCALDigit*)digits->At(clusterECAdigitslist[index]) ; index++ ; while ( (digitN = (AliEMCALDigit *)nextdigit()) ) { // scan over the reduced list of digits Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! @@ -726,8 +661,8 @@ void AliEMCALClusterizerv1::MakeClusters() break ; case 1 : // are neighbours clu->AddDigit(*digitN, Calibrate( digitN->GetAmp(), 1) ) ; - clusterECdigitslist[iDigitInECCluster] = digitN->GetIndexInList() ; - iDigitInECCluster++ ; + clusterECAdigitslist[iDigitInECACluster] = digitN->GetIndexInList() ; + iDigitInECACluster++ ; digitsC->Remove(digitN) ; break ; case 2 : // too far from each other @@ -738,7 +673,7 @@ void AliEMCALClusterizerv1::MakeClusters() endofloop1: ; nextdigit.Reset() ; - } // loop over EC cluster + } // loop over ECA cluster index = 0 ; while (index < iDigitInPRECluster){ // scan over digits already in cluster @@ -767,8 +702,8 @@ void AliEMCALClusterizerv1::MakeClusters() } // loop over PRE cluster index = 0 ; - while (index < iDigitInHCCluster){ // scan over digits already in cluster - digit = (AliEMCALDigit*)digits->At(clusterHCdigitslist[index]) ; + while (index < iDigitInHCACluster){ // scan over digits already in cluster + digit = (AliEMCALDigit*)digits->At(clusterHCAdigitslist[index]) ; index++ ; while ( (digitN = (AliEMCALDigit *)nextdigit()) ) { // scan over the reduced list of digits Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! @@ -778,8 +713,8 @@ void AliEMCALClusterizerv1::MakeClusters() break ; case 1 : // are neighbours clu->AddDigit(*digitN, Calibrate( digitN->GetAmp(), 2) ) ; - clusterHCdigitslist[iDigitInHCCluster] = digitN->GetIndexInList() ; - iDigitInHCCluster++ ; + clusterHCAdigitslist[iDigitInHCACluster] = digitN->GetIndexInList() ; + iDigitInHCACluster++ ; digitsC->Remove(digitN) ; break ; case 2 : // too far from each other @@ -789,7 +724,7 @@ void AliEMCALClusterizerv1::MakeClusters() endofloop3: ; nextdigit.Reset() ; - } // loop over HC cluster + } // loop over HCA cluster } // energy theshold } // while digit @@ -864,18 +799,18 @@ void AliEMCALClusterizerv1::Print(Option_t * option)const message += fPRELocMaxCut ; message += "\n Pre Shower Logarothmic weight = " ; message += fPREW0 ; - message += "\n EC Clustering threshold = " ; - message += fECClusteringThreshold ; - message += "\n EC Local Maximum cut = " ; - message += fECLocMaxCut ; - message += "\n EC Logarothmic weight = " ; - message += fECW0 ; + message += "\n ECA Clustering threshold = " ; + message += fECAClusteringThreshold ; + message += "\n ECA Local Maximum cut = " ; + message += fECALocMaxCut ; + message += "\n ECA Logarothmic weight = " ; + message += fECAW0 ; message += "\n Pre Shower Clustering threshold = " ; - message += fHCClusteringThreshold ; - message += "\n HC Local Maximum cut = " ; - message += fHCLocMaxCut ; - message += "\n HC Logarothmic weight = " ; - message += fHCW0 ; + message += fHCAClusteringThreshold ; + message += "\n HCA Local Maximum cut = " ; + message += fHCALocMaxCut ; + message += "\n HCA Logarothmic weight = " ; + message += fHCAW0 ; if(fToUnfold) message +="\nUnfolding on\n" ; else @@ -894,19 +829,19 @@ void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option) { // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer - TObjArray * aPRERecPoints = AliEMCALGetter::GetInstance()->PRERecPoints() ; - TObjArray * aECRecPoints = AliEMCALGetter::GetInstance()->ECALRecPoints() ; - TObjArray * aHCRecPoints = AliEMCALGetter::GetInstance()->HCALRecPoints() ; + TObjArray * aPRERecPoints = AliEMCALGetter::Instance()->PRERecPoints() ; + TObjArray * aECARecPoints = AliEMCALGetter::Instance()->ECARecPoints() ; + TObjArray * aHCARecPoints = AliEMCALGetter::Instance()->HCARecPoints() ; Info("PrintRecPoints", "Clusterization result:") ; printf("event # %d\n", gAlice->GetEvNumber() ) ; - printf(" Found %d PRE SHOWER RecPoints, %d EC Rec Points and %d HC Rec Points\n ", - aPRERecPoints->GetEntriesFast(), aECRecPoints->GetEntriesFast(), aHCRecPoints->GetEntriesFast() ) ; + printf(" Found %d PRE SHOWER RecPoints, %d ECA Rec Points and %d HCA Rec Points\n ", + aPRERecPoints->GetEntriesFast(), aECARecPoints->GetEntriesFast(), aHCARecPoints->GetEntriesFast() ) ; fRecPointsInRun += aPRERecPoints->GetEntriesFast() ; - fRecPointsInRun += aECRecPoints->GetEntriesFast() ; - fRecPointsInRun += aHCRecPoints->GetEntriesFast() ; + fRecPointsInRun += aECARecPoints->GetEntriesFast() ; + fRecPointsInRun += aHCARecPoints->GetEntriesFast() ; if(strstr(option,"all")) { @@ -942,8 +877,8 @@ void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option) printf("Clusters in ECAL section\n") ; printf("Index Ene(GeV) Multi Module phi r theta X Y Z Dispersion Lambda 1 Lambda 2 # of prim Primaries list\n") ; - for (index = 0 ; index < aECRecPoints->GetEntries() ; index++) { - AliEMCALTowerRecPoint * rp = dynamic_cast(aECRecPoints->At(index)) ; + for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) { + AliEMCALTowerRecPoint * rp = dynamic_cast(aECARecPoints->At(index)) ; TVector3 globalpos; rp->GetGlobalPosition(globalpos); TVector3 localpos; @@ -966,8 +901,8 @@ void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option) printf("Clusters in HCAL section\n") ; printf("Index Ene(GeV) Multi Module phi r theta X Y Z Dispersion Lambda 1 Lambda 2 # of prim Primaries list\n") ; - for (index = 0 ; index < aHCRecPoints->GetEntries() ; index++) { - AliEMCALTowerRecPoint * rp = dynamic_cast(aHCRecPoints->At(index)) ; + for (index = 0 ; index < aHCARecPoints->GetEntries() ; index++) { + AliEMCALTowerRecPoint * rp = dynamic_cast(aHCARecPoints->At(index)) ; TVector3 globalpos; rp->GetGlobalPosition(globalpos); TVector3 localpos; diff --git a/EMCAL/AliEMCALClusterizerv1.h b/EMCAL/AliEMCALClusterizerv1.h index 6b3630da6f2..29adee0dca8 100644 --- a/EMCAL/AliEMCALClusterizerv1.h +++ b/EMCAL/AliEMCALClusterizerv1.h @@ -35,7 +35,7 @@ class AliEMCALClusterizerv1 : public AliEMCALClusterizer { public: AliEMCALClusterizerv1() ; - AliEMCALClusterizerv1(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE); + AliEMCALClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName); virtual ~AliEMCALClusterizerv1() ; virtual Int_t AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ; @@ -44,19 +44,19 @@ public: virtual Float_t Calibrate(Int_t amp, Int_t where)const ; // Tranforms Amp to energy virtual void GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfPREClusters ; - numb[1] = fNumberOfECClusters ; - numb[2] = fNumberOfHCClusters ; } + numb[1] = fNumberOfECAClusters ; + numb[2] = fNumberOfHCAClusters ; } virtual Float_t GetPREClusteringThreshold()const{ return fPREClusteringThreshold; } - virtual Float_t GetECClusteringThreshold()const{ return fECClusteringThreshold;} - virtual Float_t GetHCClusteringThreshold()const{ return fHCClusteringThreshold;} + virtual Float_t GetECAClusteringThreshold()const{ return fECAClusteringThreshold;} + virtual Float_t GetHCAClusteringThreshold()const{ return fHCAClusteringThreshold;} virtual Float_t GetPRELocalMaxCut()const { return fPRELocMaxCut;} virtual Float_t GetPREShoLogWeight()const { return fPREW0;} - virtual Float_t GetECLocalMaxCut()const { return fECLocMaxCut;} - virtual Float_t GetECLogWeight()const { return fECW0;} - virtual Float_t GetHCLocalMaxCut()const { return fHCLocMaxCut;} - virtual Float_t GetHCLogWeight()const { return fHCW0;} + virtual Float_t GetECALocalMaxCut()const { return fECALocMaxCut;} + virtual Float_t GetECALogWeight()const { return fECAW0;} + virtual Float_t GetHCALocalMaxCut()const { return fHCALocMaxCut;} + virtual Float_t GetHCALogWeight()const { return fHCAW0;} virtual Float_t GetTimeGate() const { return fTimeGate ; } virtual const char * GetRecPointsBranch() const{ return GetName() ;} @@ -66,21 +66,22 @@ public: virtual void Print(Option_t * option)const ; - virtual void SetECClusteringThreshold(Float_t cluth) { fECClusteringThreshold = cluth ; } - virtual void SetECLocalMaxCut(Float_t cut) { fECLocMaxCut = cut ; } - virtual void SetECLogWeight(Float_t w) { fECW0 = w ; } - virtual void SetHCClusteringThreshold(Float_t cluth) { fHCClusteringThreshold = cluth ; } - virtual void SetHCLocalMaxCut(Float_t cut) { fHCLocMaxCut = cut ; } - virtual void SetHCLogWeight(Float_t w) { fHCW0 = w ; } - virtual void SetTimeGate(Float_t gate) { fTimeGate = gate ;} - virtual void SetPREClusteringThreshold(Float_t cluth) { fPREClusteringThreshold = cluth ; } - virtual void SetPRELocalMaxCut(Float_t cut) { fPRELocMaxCut = cut ; } - virtual void SetPRELogWeight(Float_t w) { fPREW0 = w ; } - virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;} + virtual void SetECAClusteringThreshold(Float_t cluth) { fECAClusteringThreshold = cluth ; } + virtual void SetECALocalMaxCut(Float_t cut) { fECALocMaxCut = cut ; } + virtual void SetECALogWeight(Float_t w) { fECAW0 = w ; } + virtual void SetHCAClusteringThreshold(Float_t cluth) { fHCAClusteringThreshold = cluth ; } + virtual void SetHCALocalMaxCut(Float_t cut) { fHCALocMaxCut = cut ; } + virtual void SetHCALogWeight(Float_t w) { fHCAW0 = w ; } + virtual void SetTimeGate(Float_t gate) { fTimeGate = gate ;} + virtual void SetPREClusteringThreshold(Float_t cluth) { fPREClusteringThreshold = cluth ; } + virtual void SetPRELocalMaxCut(Float_t cut) { fPRELocMaxCut = cut ; } + virtual void SetPRELogWeight(Float_t w) { fPREW0 = w ; } + virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;} static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding; //class member function (not object member function) static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag) ; // Chi^2 of the fit. Should be static to be passes to MINUIT + void Unload() ; virtual const char * Version() const { return "clu-v1" ; } protected: @@ -112,28 +113,28 @@ private: Bool_t fToUnfold ; // To perform unfolding Int_t fNumberOfPREClusters ; // number of clusters found in PRE section - Int_t fNumberOfECClusters ; // number of clusters found in EC section - Int_t fNumberOfHCClusters ; // number of clusters found in HC section + Int_t fNumberOfECAClusters ; // number of clusters found in EC section + Int_t fNumberOfHCAClusters ; // number of clusters found in HC section //Calibration parameters... to be replaced by database Float_t fADCchannelPRE ; // width of one ADC channel for PRE section (GeV) Float_t fADCpedestalPRE ; // pedestal of ADC for PRE section (GeV) - Float_t fADCchannelEC ; // width of one ADC channel for EC section (GeV) - Float_t fADCpedestalEC ; // pedestal of ADC for EC section (GeV) - Float_t fADCchannelHC ; // width of one ADC channel for HC section (GeV) - Float_t fADCpedestalHC ; // pedestal of ADC for HC section (GeV) + Float_t fADCchannelECA ; // width of one ADC channel for EC section (GeV) + Float_t fADCpedestalECA ; // pedestal of ADC for EC section (GeV) + Float_t fADCchannelHCA ; // width of one ADC channel for HC section (GeV) + Float_t fADCpedestalHCA ; // pedestal of ADC for HC section (GeV) - Float_t fECClusteringThreshold ; // minimum energy to include a EC digit in a cluster - Float_t fHCClusteringThreshold ; // minimum energy to include a HC digit in a cluster - Float_t fPREClusteringThreshold ; // minimum energy to include a PRE digit in a cluster - Float_t fECLocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster - Float_t fECW0 ; // logarithmic weight for the cluster center of gravity calculation - Float_t fHCLocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster - Float_t fHCW0 ; // logarithmic weight for the cluster center of gravity calculation - Float_t fPRELocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster - Float_t fPREW0 ; // logarithmic weight for the CPV cluster center of gravity calculation - Int_t fRecPointsInRun ; //! Total number of recpoints in one run - Float_t fTimeGate ; // Maximum time difference between the digits in ont EMC cluster + Float_t fECAClusteringThreshold ; // minimum energy to include a EC digit in a cluster + Float_t fHCAClusteringThreshold ; // minimum energy to include a HC digit in a cluster + Float_t fPREClusteringThreshold ; // minimum energy to include a PRE digit in a cluster + Float_t fECALocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster + Float_t fECAW0 ; // logarithmic weight for the cluster center of gravity calculation + Float_t fHCALocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster + Float_t fHCAW0 ; // logarithmic weight for the cluster center of gravity calculation + Float_t fPRELocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster + Float_t fPREW0 ; // logarithmic weight for the CPV cluster center of gravity calculation + Int_t fRecPointsInRun ; //! Total number of recpoints in one run + Float_t fTimeGate ; // Maximum time difference between the digits in ont EMC cluster ClassDef(AliEMCALClusterizerv1,2) // Clusterizer implementation version 1 diff --git a/EMCAL/AliEMCALDigit.cxx b/EMCAL/AliEMCALDigit.cxx index 9aeac80cf14..d61b9fb7c28 100644 --- a/EMCAL/AliEMCALDigit.cxx +++ b/EMCAL/AliEMCALDigit.cxx @@ -46,12 +46,11 @@ ClassImp(AliEMCALDigit) { // default ctor - fIndexInList = 0 ; + fIndexInList = -1 ; fNprimary = 0 ; - fNMaxPrimary = 0 ; - fNiparent = 0 ; - - fNMaxiparent = 0; + fNMaxPrimary = 5 ; + fNiparent = 0 ; + fNMaxiparent = 5; fPrimary = 0 ; fIparent = 0 ; fMaxIter = 0; @@ -149,21 +148,21 @@ Int_t AliEMCALDigit::Compare(const TObject * obj) const } //____________________________________________________________________________ -const Float_t AliEMCALDigit::GetEta() const +Float_t AliEMCALDigit::GetEta() const { Float_t eta=-10., phi=-10.; Int_t id = GetId(); - const AliEMCALGeometry *g = AliEMCALGetter::GetInstance()->EMCALGeometry(); + const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry(); g->EtaPhiFromIndex(id,eta,phi); return eta ; } //____________________________________________________________________________ -const Float_t AliEMCALDigit::GetPhi() const +Float_t AliEMCALDigit::GetPhi() const { Float_t eta=-10., phi=-10.; Int_t id = GetId(); - const AliEMCALGeometry *g = AliEMCALGetter::GetInstance()->EMCALGeometry(); + const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry(); g->EtaPhiFromIndex(id,eta,phi); return phi ; } diff --git a/EMCAL/AliEMCALDigit.h b/EMCAL/AliEMCALDigit.h index 6a1aab285e1..b05c7b71cca 100644 --- a/EMCAL/AliEMCALDigit.h +++ b/EMCAL/AliEMCALDigit.h @@ -40,26 +40,21 @@ class AliEMCALDigit : public AliDigitNew { AliEMCALDigit& operator*(Float_t factor) ; Int_t Compare(const TObject * obj) const ; - const Float_t GetEta() const ; - Int_t GetNprimary() const { - // returns the number of primaries - return fNprimary ; } + Float_t GetEta() const ; + Int_t GetNprimary() const { return fNprimary ; } Int_t GetPrimary(Int_t index) const ; Int_t GetNiparent() const {return fNiparent;} Int_t GetIparent(Int_t index) const ; - const Float_t GetPhi() const; + Float_t GetPhi() const; Float_t GetTime(void) const {return fTime ;} - Bool_t IsSortable() const { - // says that AliEMCALDigits are sortable (needed for Sort method - return kTRUE ; } - void SetAmp(Int_t amp) { - // sets the amplitude data member - fAmp= amp ; } - void SetId(Int_t id) {fId = id ;} - void SetTime(Float_t time) {fTime = time ;} - void ShiftPrimary(Int_t shift); // shift to semarate different TreeK in merging + Bool_t IsSortable() const { return kTRUE ; } + void SetAmp(Int_t amp) { fAmp= amp ; } + void SetId(Int_t id) {fId = id ;} + void SetTime(Float_t time) {fTime = time ;} + void ShiftPrimary(Int_t shift); // shift to semarate different TreeK in merging private: + Int_t fNprimary ; // Number of primaries Int_t fNMaxPrimary ; // Max Number of primaries Int_t *fPrimary ; //[fNMaxPrimary] Array of primaries diff --git a/EMCAL/AliEMCALDigitizer.cxx b/EMCAL/AliEMCALDigitizer.cxx index 5f1c50da822..804d4756730 100644 --- a/EMCAL/AliEMCALDigitizer.cxx +++ b/EMCAL/AliEMCALDigitizer.cxx @@ -86,54 +86,80 @@ ClassImp(AliEMCALDigitizer) //____________________________________________________________________________ - AliEMCALDigitizer::AliEMCALDigitizer() + AliEMCALDigitizer::AliEMCALDigitizer():AliDigitizer("",""), + fInput(0), + fInputFileNames(0x0), + fEventNames(0x0) { // ctor - //InitParameters() ; + InitParameters() ; fDefaultInit = kTRUE ; fManager = 0 ; // We work in the standalong mode - + fEventFolderName = "" ; } //____________________________________________________________________________ -AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile, const char *name, const Bool_t toSplit) +AliEMCALDigitizer::AliEMCALDigitizer(const TString alirunFileName, const TString eventFolderName): + AliDigitizer("EMCAL"+AliConfig::fgkDigitizerTaskName, alirunFileName), + fInputFileNames(0), fEventNames(0), fEventFolderName(eventFolderName) { // ctor - SetTitle(headerFile) ; - SetName(name) ; - fManager = 0 ; // We work in the standalong mode - fSplitFile= 0 ; - fToSplit = toSplit ; - Init() ; InitParameters() ; + Init() ; fDefaultInit = kFALSE ; + fManager = 0 ; // We work in the standalong mode } //____________________________________________________________________________ -AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * ard):AliDigitizer(ard) +AliEMCALDigitizer::AliEMCALDigitizer(const AliEMCALDigitizer & d) +{ + // copyy ctor + + SetName(d.GetName()) ; + SetTitle(d.GetTitle()) ; + fDigitThreshold = d.fDigitThreshold ; + fMeanPhotonElectron = d.fMeanPhotonElectron ; + fPedestal = d.fPedestal ; + fSlope = d.fSlope ; + fPinNoise = d.fPinNoise ; + fTimeResolution = d.fTimeResolution ; + fTimeThreshold = d.fTimeThreshold ; + fTimeSignalLength = d.fTimeSignalLength ; + fADCchannelEC = d.fADCchannelEC ; + fADCpedestalEC = d.fADCpedestalEC ; + fNADCEC = d.fNADCEC ; + fADCchannelHC = d.fADCchannelHC ; + fADCpedestalHC = d.fADCpedestalHC ; + fNADCHC = d.fNADCHC ; + fADCchannelPRE = d.fADCchannelPRE ; + fADCpedestalPRE = d.fADCpedestalPRE ; + fNADCPRE = d.fNADCPRE ; + fEventFolderName = d.fEventFolderName; + } + +//____________________________________________________________________________ +AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * rd): + AliDigitizer(rd,"EMCAL"+AliConfig::fgkDigitizerTaskName), + fEventFolderName(0) { // ctor - SetTitle(ard->GetInputFileName(0,0)) ; + fManager = rd ; + SetName(fManager->GetInputFolderName(0)) ; + // take title as name of stream 0 + SetTitle(dynamic_cast(fManager->GetInputStream(0))->GetFileName(0)); InitParameters() ; + Init() ; fDefaultInit = kFALSE ; - fSplitFile = 0 ; - - if (ard->GetOutputFile()) { - SetName(ard->GetOutputFile().Data()); - fToSplit = kTRUE ; - } else { - SetName("Default") ; - fToSplit = kFALSE ; - } } //____________________________________________________________________________ AliEMCALDigitizer::~AliEMCALDigitizer() { // dtor + delete [] fInputFileNames ; + delete [] fEventNames ; - fSplitFile = 0 ; } //____________________________________________________________________________ @@ -147,9 +173,8 @@ void AliEMCALDigitizer::Digitize(const Int_t event) // helps to avoid scanning over the list of digits to add // contribution of any new SDigit. - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TClonesArray * digits = gime->Digits(GetName()) ; - + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; + TClonesArray * digits = gime->Digits() ; digits->Clear() ; const AliEMCALGeometry *geom = gime->EMCALGeometry() ; @@ -159,47 +184,44 @@ void AliEMCALDigitizer::Digitize(const Int_t event) nEMC = 3*geom->GetNPhi()*geom->GetNZ(); //max number of digits possible (Preshower, ECAL, HCAL) else nEMC = 2*geom->GetNPhi()*geom->GetNZ(); //max number of digits possible (Preshower, ECAL) - - Int_t absID ; - TString name = geom->GetName() ; + + Int_t absID ; - // get first the sdigitizer from the tasks list (must have same name as the digitizer) - const AliEMCALSDigitizer * sDigitizer = gime->SDigitizer(GetName()); - if ( !sDigitizer) { - Fatal("Digitize", "SDigitizer with name %s not found", GetName() ); - } + digits->Expand(nEMC) ; -// loop through the sdigits posted to the White Board and add them to the noise - TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ; - TIter next(folderslist) ; - TFolder * folder = 0 ; - TClonesArray * sdigits = 0 ; - Int_t input = 0 ; - TObjArray * sdigArray = new TObjArray(2) ; - while ( (folder = (TFolder*)next()) ) { - if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) { - TString fileName(folder->GetName()) ; - fileName.ReplaceAll("_","/") ; - if (gDebug) - Info("Digitize", "Adding SDigits %s from %s", GetName(), fileName.Data()) ; - sdigArray->AddAt(sdigits, input) ; - input++ ; - } + // get first the sdigitizer from the tasks list (must have same name as the digitizer) + if ( !gime->SDigitizer() ) + gime->LoadSDigitizer(); + AliEMCALSDigitizer * sDigitizer = gime->SDigitizer(); + + if ( !sDigitizer ) + Fatal("Digitize", "SDigitizer with name %s %s not found", fEventFolderName.Data(), GetTitle() ) ; + + //take all the inputs to add together and load the SDigits + TObjArray * sdigArray = new TObjArray(fInput) ; + sdigArray->AddAt(gime->SDigits(), 0) ; + Int_t i ; + for(i = 1 ; i < fInput ; i++){ + TString tempo(fEventNames[i]) ; + tempo += i ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[i], tempo) ; + gime->Event(event,"S"); + sdigArray->AddAt(gime->SDigits(), i) ; } - + //Find the first tower with signal Int_t nextSig = nEMC + 1 ; - Int_t i; - for(i=0; iAt(i) ; + TClonesArray * sdigits ; + for(i = 0 ; i < fInput ; i++){ + sdigits = dynamic_cast(sdigArray->At(i)) ; if ( !sdigits->GetEntriesFast() ) continue ; - Int_t curNext = ((AliEMCALDigit *)sdigits->At(0))->GetId() ; + Int_t curNext = dynamic_cast(sdigits->At(0))->GetId() ; if(curNext < nextSig) nextSig = curNext ; } - TArrayI index(input) ; + TArrayI index(fInput) ; index.Reset() ; //Set all indexes to zero AliEMCALDigit * digit ; @@ -209,28 +231,27 @@ void AliEMCALDigitizer::Digitize(const Int_t event) //Put Noise contribution for(absID = 1; absID <= nEMC; absID++){ - Float_t amp = 0 ; - // Float_t noise = TMath::Abs(gRandom->Gaus(0., fPinNoise)); - //new((*digits)[absID-1]) AliEMCALDigit( -1, -1, absID, sDigitizer->Digitize(noise), TimeOfNoise() ) ; + Float_t amp = 0 ; // amplitude set to zero, noise will be added later new((*digits)[absID-1]) AliEMCALDigit( -1, -1, absID, 0, TimeOfNoise() ) ; //look if we have to add signal? - digit = (AliEMCALDigit *) digits->At(absID-1) ; + digit = dynamic_cast(digits->At(absID-1)) ; + if(absID==nextSig){ //Add SDigits from all inputs ticks->Clear() ; Int_t contrib = 0 ; Float_t a = digit->GetAmp() ; Float_t b = TMath::Abs( a /fTimeSignalLength) ; - //Mark the beginnign of the signal + //Mark the beginning of the signal new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b); //Mark the end of the ignal new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b); - // loop over input - for(i = 0; i< input ; i++){ //loop over (possible) merge sources - if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliEMCALDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + // loop over input + for(i = 0; i< fInput ; i++){ //loop over (possible) merge sources + if(dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast(dynamic_cast(sdigArray->At(i))->At(index[i])) ; else curSDigit = 0 ; //May be several digits will contribute from the same input @@ -251,45 +272,39 @@ void AliEMCALDigitizer::Digitize(const Int_t event) *digit = *digit + *curSDigit ; //add energies index[i]++ ; - if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliEMCALDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + if( dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast(dynamic_cast(sdigArray->At(i))->At(index[i])) ; else curSDigit = 0 ; } } // add fluctuations for photo-electron creation amp = sDigitizer->Calibrate(digit->GetAmp()) ; // GeV - if (gDebug==1) - Info("Digitize", "id = %d BEFORE amp = %f\n", digit->GetId(),amp) ; amp *= static_cast(gRandom->Poisson(fMeanPhotonElectron)) / static_cast(fMeanPhotonElectron) ; - if (gDebug==1) - Info("Digitize", "After fluctuation amp = %f\n", amp) ; + //calculate and set time Float_t time = FrontEdgeTime(ticks) ; digit->SetTime(time) ; //Find next signal module nextSig = nEMC + 1 ; - for(i=0; iAt(i)) ; + for(i = 0 ; i < fInput ; i++){ + sdigits = dynamic_cast(sdigArray->At(i)) ; Int_t curNext = nextSig ; if(sdigits->GetEntriesFast() > index[i] ){ - curNext = ((AliEMCALDigit *) sdigits->At(index[i]))->GetId() ; - + curNext = dynamic_cast(sdigits->At(index[i]))->GetId() ; } if(curNext < nextSig) nextSig = curNext ; } } // add the noise now - if (geom->IsInECAL(digit->GetId())) + if (geom->IsInECA(digit->GetId())) amp += TMath::Abs(gRandom->Gaus(0., fPinNoise)) ; else if (geom->IsInPRE(digit->GetId())) amp += TMath::Abs(gRandom->Gaus(0., fPinNoise/100.)) ; // arbitrarely divide by 100, assuming that the gain of APD will be higher - else if (geom->IsInHCAL(digit->GetId())) + else if (geom->IsInHCA(digit->GetId())) amp += TMath::Abs(gRandom->Gaus(0., fPinNoise/10.)) ; // arbitrarely divide by 10, assuming that the gain of APD will be higher - if (gDebug==1) - Info("Digitize", "After noise amp = %f \n", amp) ; digit->SetAmp(sDigitizer->Digitize(amp)) ; } @@ -299,30 +314,27 @@ void AliEMCALDigitizer::Digitize(const Int_t event) delete sdigArray ; //We should not delete its contents //remove digits below thresholds - for(absID = 0; absID < nEMC; absID++){ - digit = dynamic_cast( digits->At(absID) ) ; + for(i = 0 ; i < nEMC ; i++){ + digit = dynamic_cast( digits->At(i) ) ; Float_t threshold = 0 ; - if (geom->IsInECAL(digit->GetId())) + if (geom->IsInECA(digit->GetId())) threshold = fDigitThreshold ; else if (geom->IsInPRE(digit->GetId())) threshold = fDigitThreshold / 100. ; // arbitrary see before when noise is added - else if (geom->IsInHCAL(digit->GetId())) + else if (geom->IsInHCA(digit->GetId())) threshold = fDigitThreshold / 10. ; // arbitrary see before when noise is added - if(sDigitizer->Calibrate( digit->GetAmp() ) <= threshold) - digits->RemoveAt(absID) ; - else { - if (gDebug == 1) - Info("Digitize", "id = %d, amp = %f, noise = %f", absID, sDigitizer->Calibrate(digit->GetAmp()), fPinNoise) ; + if(sDigitizer->Calibrate( digit->GetAmp() ) < threshold) + digits->RemoveAt(i) ; + else digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ; - } } digits->Compress() ; Int_t ndigits = digits->GetEntriesFast() ; - // digits->Expand(ndigits) ; + digits->Expand(ndigits) ; //Set indexes in list of digits for (i = 0 ; i < ndigits ; i++) { @@ -338,19 +350,19 @@ void AliEMCALDigitizer::Digitize(const Int_t event) Int_t AliEMCALDigitizer::DigitizeEnergy(Float_t energy, Int_t absId) { Int_t channel = -999; - AliEMCALGeometry * geom = AliEMCALGetter::GetInstance()->EMCALGeometry() ; + AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ; if(geom->IsInPRE(absId)){ //digitize as PRE section channel = static_cast(TMath::Ceil( (energy + fADCpedestalPRE)/fADCchannelPRE )) ; if(channel > fNADCPRE ) channel = fNADCPRE ; } - else if(geom->IsInECAL(absId)){ //digitize as ECAL section + else if(geom->IsInECA(absId)){ //digitize as ECAL section channel = static_cast (TMath::Ceil( (energy + fADCpedestalEC)/fADCchannelEC )) ; if(channel > fNADCEC ) channel = fNADCEC ; } - else if(geom->IsInHCAL(absId)){ //digitize as HCAL section + else if(geom->IsInHCA(absId)){ //digitize as HCAL section channel = static_cast (TMath::Ceil( (energy + fADCpedestalHC)/fADCchannelHC )) ; if(channel > fNADCHC ) channel = fNADCHC ; @@ -364,86 +376,39 @@ void AliEMCALDigitizer::Exec(Option_t *option) { // Managing method - if(strcmp(GetName(), "") == 0 ) - Init() ; + if (!fInit) { // to prevent overwrite existing file + Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ; + return ; + } + if (strstr(option,"print")) { - Print(""); + Print(); return ; } if(strstr(option,"tim")) gBenchmark->Start("EMCALDigitizer"); - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + if (fManager) + fInput = fManager->GetNinputs() ; - Int_t nevents ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; - TTree * treeD ; - - if(fManager){ - treeD = fManager->GetTreeD() ; - nevents = 1 ; // Will process only one event - - //Check, if this branch already exits - if (treeD) { - TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ; - TIter next(lob) ; - TBranch * branch = 0 ; - Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; - - while ( (branch = (TBranch*)next()) && (!emcalfound || !digitizerfound) ) { - if ( (strcmp(branch->GetName(), "EMCAL")==0) && - (strcmp(branch->GetTitle(), GetName())==0) ) - emcalfound = kTRUE ; - - else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && - (strcmp(branch->GetTitle(), GetName())==0) ) - digitizerfound = kTRUE ; - } - - if ( emcalfound ) { - Error( "Exec", "Digits branch with name %s already exits", GetName() ) ; - return ; - } - if ( digitizerfound ) { - Error( "Exec", "Digitizer branch with name %s already exit", GetName() ) ; - return ; - } - } - } - else { //EMCAL standalone - if(gime->BranchExists("Digits") ) - return ; - nevents=gime->MaxEvent() ; - } + Int_t nevents = gime->MaxEvent() ;; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ - if(fManager){ - - Int_t input ; - for(input = 0 ; input < fManager->GetNinputs(); input ++){ - TTree * treeS = fManager->GetInputTreeS(input) ; - if(!treeS){ - Error( "Exec", "No Input") ; - return ; - } - gime->ReadTreeS(treeS,input) ; - } + gime->Event(ievent,"S") ; - } - else - gime->Event(ievent,"S") ; - Digitize(ievent) ; //Add prepared SDigits to digits and add the noise - + WriteDigits(ievent) ; - + if(strstr(option,"deb")) PrintDigits(option); - + //increment the total number of Digits per run fDigitsInRun += gime->Digits()->GetEntriesFast() ; } @@ -452,13 +417,14 @@ void AliEMCALDigitizer::Exec(Option_t *option) gBenchmark->Stop("EMCALDigitizer"); Info("Exec", "took %f seconds for Digitizing %f seconds per event", gBenchmark->GetCpuTime("EMCALDigitizer"), gBenchmark->GetCpuTime("EMCALDigitizer")/nevents ) ; - } - + } } //____________________________________________________________________________ Float_t AliEMCALDigitizer::FrontEdgeTime(TClonesArray * ticks) -{ // +{ + // Returns the shortest time among all time ticks + ticks->Sort() ; //Sort in accordance with times of ticks TIter it(ticks) ; AliEMCALTick * ctick = (AliEMCALTick *) it.Next() ; @@ -480,64 +446,51 @@ Float_t AliEMCALDigitizer::FrontEdgeTime(TClonesArray * ticks) Bool_t AliEMCALDigitizer::Init() { // Makes all memory allocations - - if( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), fToSplit) ; + fInit = kTRUE ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !" ) ; + Error("Init", "Could not obtain the Getter object for file %s and event %s !", GetTitle(), fEventFolderName.Data()) ; return kFALSE; } - //const AliEMCALGeometry * geom = gime->EMCALGeometry() ; + TString opt("Digits") ; + if(gime->VersionExists(opt) ) { + Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ; + fInit = kFALSE ; + } - //fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ; - - // Post Digits to the white board - gime->PostDigits(GetName() ) ; - // Post Digitizer to the white board gime->PostDigitizer(this) ; - fSplitFile = 0 ; - if(fToSplit){ - // construct the name of the file as /path/EMCAL.SDigits.root - //First - extract full path if necessary - TString digitsFileName(GetTitle()) ; - Ssiz_t islash = digitsFileName.Last('/') ; - if(islash(gROOT->GetFile(digitsFileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(digitsFileName.Data(),"update") ; + if(fManager) + fInput = fManager->GetNinputs() ; + else + fInput = 1 ; + + fInputFileNames = new TString[fInput] ; + fEventNames = new TString[fInput] ; + fInputFileNames[0] = GetTitle() ; + fEventNames[0] = fEventFolderName.Data() ; + Int_t index ; + for (index = 1 ; index < fInput ; index++) { + fInputFileNames[index] = dynamic_cast(fManager->GetInputStream(index))->GetFileName(0); + TString tempo = fManager->GetInputFolderName(index) ; + fEventNames[index] = tempo.Remove(tempo.Length()-1) ; // strip of the stream number added bt fManager } - //Mark that we will use current header file - if(!fManager){ - gime->PostSDigits(GetName(),GetTitle()) ; - gime->PostSDigitizer(GetName(),GetTitle()) ; - } - return kTRUE ; + //to prevent cleaning of this object while GetEvent is called + gime->EmcalLoader()->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + + return fInit ; } //____________________________________________________________________________ void AliEMCALDigitizer::InitParameters() { fMeanPhotonElectron = 1250 ; // electrons per GeV - - Warning("InitParameters", "No noise added\n") ; - fPinNoise = 0. ; // 0.001 ; // noise equivalent GeV (random choice) + fPinNoise = 0.001 ; // noise equivalent GeV (random choice) + if (fPinNoise == 0. ) + Warning("InitParameters", "No noise added\n") ; fDigitThreshold = fPinNoise * 3; //2 sigma fTimeResolution = 0.5e-9 ; fTimeSignalLength = 1.0e-9 ; @@ -559,7 +512,7 @@ void AliEMCALDigitizer::InitParameters() } //__________________________________________________________________ -void AliEMCALDigitizer::MixWith(char* headerFile) +void AliEMCALDigitizer::MixWith(const TString alirunFileName, const TString eventFolderName) { // Allows to produce digits by superimposing background and signal event. // It is assumed, that headers file with SIGNAL events is opened in @@ -580,105 +533,99 @@ void AliEMCALDigitizer::MixWith(char* headerFile) Error("MixWith", "Cannot use this method under AliRunDigitizer") ; return ; } - - // check if the specified SDigits do not already exist on the White Board: - // //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname - - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TString path = gime->SDigitsFolder()->GetName() ; - - // before it was ???? "Folders/RunMC/Event/Data/EMCAL/SDigits" ; - path += headerFile ; - path += "/" ; - path += GetName() ; - if ( gROOT->FindObjectAny(path.Data()) ) { - Error("MixWith", "Entry already exists, do not add" ) ; - return; + // looking for file which contains AliRun + if (gSystem->AccessPathName(alirunFileName)) {// file does not exist + Error("MixWith", "File %s does not exist!", alirunFileName.Data()) ; + return ; } - - gime->PostSDigits(GetName(),headerFile) ; - - // check if the requested file is already open or exist and if SDigits Branch exist - TFile * file = (TFile*)gROOT->FindObject(headerFile); - if ( !file ) { - file = new TFile(headerFile, "READ") ; - if (!file) { - Error("MixWith", "File %s does not exist!", headerFile) ; - return ; + // looking for the file which contains SDigits + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + TString fileName( gime->GetSDigitsFileName() ) ; + if ( eventFolderName != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + eventFolderName + ".root" ; + if ( (gSystem->AccessPathName(fileName)) ) { + Error("MixWith", "The file %s does not exist!", fileName.Data()) ; + return ; } - } - -} - + // need to increase the arrays + TString tempo = fInputFileNames[fInput-1] ; + delete [] fInputFileNames ; + fInputFileNames = new TString[fInput+1] ; + fInputFileNames[fInput-1] = tempo ; + + tempo = fEventNames[fInput-1] ; + delete [] fEventNames ; + fEventNames = new TString[fInput+1] ; + fEventNames[fInput-1] = tempo ; + + fInputFileNames[fInput] = alirunFileName ; + fEventNames[fInput] = eventFolderName ; + fInput++ ; +} + //__________________________________________________________________ -void AliEMCALDigitizer::Print(Option_t* option)const { - - TString message("\n") ; - - if( strcmp(GetName(), "") != 0) { - message += "------------------- " ; - message += GetName() ; - message += " -------------" ; - const Int_t nStreams = GetNInputStreams() ; - if (nStreams) { - Int_t index = 0 ; - for (index = 0 ; index < nStreams ; index++) { - message += "\nAdding SDigits " ; - message += GetName() ; - message += " from " ; - message += fManager->GetInputFileName(index, 0) ; - } - - message += "\nWriting digits to " ; - message += fManager->GetInputFileName(0, 0) ; - } else { - message += "\nWriting digits to " ; - message += GetTitle() ; - } - message += "\nWith following parameters: " ; - message += "\n Electronics noise in EMC (fPinNoise) = " ; - message += fPinNoise ; - message += "\n Threshold in EMC (fDigitThreshold) = " ; - message += fDigitThreshold ; - message += "\n---------------------------------------------------" ; +void AliEMCALDigitizer::Print()const +{ + // Print Digitizer's parameters + Info("Print", "\n------------------- %s -------------", GetName() ) ; + if( strcmp(fEventFolderName.Data(), "") != 0 ){ + printf(" Writing Digits to branch with title %s\n", fEventFolderName.Data()) ; + + Int_t nStreams ; + if (fManager) + nStreams = GetNInputStreams() ; + else + nStreams = fInput ; + + Int_t index = 0 ; + for (index = 0 ; index < nStreams ; index++) { + TString tempo(fEventNames[index]) ; + tempo += index ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[index], tempo) ; + TString fileName( gime->GetSDigitsFileName() ) ; + if ( fEventNames[index] != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + fEventNames[index] + ".root" ; + printf ("Adding SDigits from %s %s\n", fInputFileNames[index].Data(), fileName.Data()) ; + } + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; + printf("\nWriting digits to %s", gime->GetDigitsFileName().Data()) ; + + printf("\nWith following parameters:\n") ; + + printf(" Electronics noise in EMC (fPinNoise) = %f\n", fPinNoise) ; + printf(" Threshold in EMC (fDigitThreshold) = %f\n", fDigitThreshold) ; + printf("---------------------------------------------------\n") ; } else - message += "\nAliEMCALDigitizer not initialized " ; - - Info("Print", message.Data() ) ; + Info("Print", "AliEMCALDigitizer not initialized") ; } //__________________________________________________________________ void AliEMCALDigitizer::PrintDigits(Option_t * option){ - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TClonesArray * fDigits = gime->Digits() ; - - TString message("\n") ; - message += " Number of entries in Digits list " ; - message += fDigits->GetEntriesFast() ; - - if(strstr(option,"all")){ - + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; + TClonesArray * digits = gime->Digits() ; + + Info("PrintDigits", "%d", digits->GetEntriesFast()) ; + printf("\nevent %d", gAlice->GetEvNumber()) ; + printf("\n Number of entries in Digits list %d", digits->GetEntriesFast() ) ; + + if(strstr(option,"all")){ //loop over digits AliEMCALDigit * digit; - message += "\n Id Amplitude Time Index Nprim: Primaries list \n" ; + printf("\nEMC digits (with primaries):\n") ; + printf("\n Id Amplitude Time Index Nprim: Primaries list \n") ; Int_t index ; - char * tempo = new char[8192]; - for (index = 0 ; index < fDigits->GetEntries() ; index++) { - digit = (AliEMCALDigit * ) fDigits->At(index) ; - sprintf(tempo, "\n%6d %8d %6.5e %4d %2d : ", + for (index = 0 ; index < digits->GetEntries() ; index++) { + digit = dynamic_cast(digits->At(index)) ; + printf("\n%6d %8d %6.5e %4d %2d : ", digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ; - message += tempo ; Int_t iprimary; for (iprimary=0; iprimaryGetNprimary(); iprimary++) { - sprintf(tempo, "%d ",digit->GetPrimary(iprimary+1) ) ; - message += tempo ; + printf("%d ",digit->GetPrimary(iprimary+1) ) ; } } - delete tempo ; } - Info("PrintDigits", message.Data() ) ; } //__________________________________________________________________ @@ -689,6 +636,22 @@ Float_t AliEMCALDigitizer::TimeOfNoise(void) } +//__________________________________________________________________ +void AliEMCALDigitizer::Unload() +{ + + Int_t i ; + for(i = 1 ; i < fInput ; i++){ + TString tempo(fEventNames[i]) ; + tempo += i ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[i], tempo) ; + gime->EmcalLoader()->UnloadSDigits() ; + } + + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; + gime->EmcalLoader()->UnloadDigits() ; +} + //_________________________________________________________________________________________ void AliEMCALDigitizer::WriteDigits(Int_t event) { @@ -701,34 +664,20 @@ void AliEMCALDigitizer::WriteDigits(Int_t event) // and branch "AliEMCALDigitizer", with the same title to keep all the parameters // and names of files, from which digits are made. - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - const TClonesArray * digits = gime->Digits(GetName()) ; - TTree * treeD ; - - if(fManager) - treeD = fManager->GetTreeD() ; - else { - if ((gAlice->TreeD() == 0) || (fSplitFile)) // we should not create TreeD if it is already here - gAlice->MakeTree("D", fSplitFile); // We overwrite TreeD in split file in the case of second reconstruction - if(fSplitFile) - fSplitFile->cd() ; - treeD = gAlice->TreeD(); - } - - // -- create Digits branch - Int_t bufferSize = 32000 ; - TBranch * digitsBranch = treeD->Branch("EMCAL",&digits,bufferSize); - digitsBranch->SetTitle(GetName()); - - // -- Create Digitizer branch - Int_t splitlevel = 0 ; - const AliEMCALDigitizer * d = gime->Digitizer(GetName()) ; - TBranch * digitizerBranch = treeD->Branch("AliEMCALDigitizer", "AliEMCALDigitizer", &d,bufferSize,splitlevel); - digitizerBranch->SetTitle(GetName()); - - digitsBranch->Fill() ; - digitizerBranch->Fill() ; - treeD->AutoSave() ; - + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; + const TClonesArray * digits = gime->Digits() ; + TTree * treeD = gime->TreeD(); + + // -- create Digits branch + Int_t bufferSize = 32000 ; + TBranch * digitsBranch = treeD->Branch("EMCAL",&digits,bufferSize); + digitsBranch->SetTitle(fEventFolderName); + digitsBranch->Fill() ; + + gime->WriteDigits("OVERWRITE"); + gime->WriteDigitizer("OVERWRITE"); + + Unload() ; + } diff --git a/EMCAL/AliEMCALDigitizer.h b/EMCAL/AliEMCALDigitizer.h index 4cf238f1846..32fae09a8ce 100644 --- a/EMCAL/AliEMCALDigitizer.h +++ b/EMCAL/AliEMCALDigitizer.h @@ -10,6 +10,7 @@ // //*-- Author: Sahal Yacoob (LBL) // based on : AliPHOSDigit +// July 2003 Yves Schutz : NewIO //_________________________________________________________________________ @@ -19,10 +20,10 @@ class TArrayI ; class TClonesArray ; // --- Standard library --- -#include // --- AliRoot header files --- #include "AliDigitizer.h" +#include "AliConfig.h" class AliEMCALSDigitizer ; class AliRunDigitizer ; @@ -30,10 +31,9 @@ class AliEMCALDigitizer: public AliDigitizer { public: AliEMCALDigitizer() ; // ctor - AliEMCALDigitizer(const char *headerFile, const char * sDigitsBranchTitle = "Default", const Bool_t toSplit = kFALSE) ; - AliEMCALDigitizer(AliRunDigitizer * ard) ; - AliEMCALDigitizer(const AliEMCALDigitizer & dtizer) - {( (AliEMCALDigitizer &)dtizer ).Copy(*this) ;} + AliEMCALDigitizer(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliEMCALDigitizer(const AliEMCALDigitizer & dtizer) ; + AliEMCALDigitizer(AliRunDigitizer * manager) ; virtual ~AliEMCALDigitizer() ; void Digitize(const Int_t event); // Make Digits from SDigits stored in fSDigits @@ -44,10 +44,10 @@ public: const Float_t GetPinNoise() const { return fPinNoise;} const Float_t GetSlope() const { return fSlope; } const Float_t GetTimeResolution() const { return fTimeResolution ; } - const Float_t GetECchannel() const { return fADCchannelEC ; } - const Float_t GetECpedestal() const { return fADCpedestalEC ; } - const Float_t GetHCchannel() const { return fADCchannelHC ; } - const Float_t GetHCpedestal() const { return fADCpedestalHC ; } + const Float_t GetECAchannel() const { return fADCchannelEC ; } + const Float_t GetECApedestal() const { return fADCpedestalEC ; } + const Float_t GetHCAchannel() const { return fADCchannelHC ; } + const Float_t GetHCApedestal() const { return fADCpedestalHC ; } const Float_t GetPREchannel() const { return fADCchannelPRE ; } const Float_t GetPREpedestal() const { return fADCpedestalPRE ; } @@ -55,9 +55,10 @@ public: void SetPinNoise(Float_t PinNoise ) {fPinNoise = PinNoise;} //General - const Int_t GetDigitsInRun() const { return fDigitsInRun; } ; - void MixWith(char* HeaderFile) ; // Add another one file to mix - void Print(Option_t* option)const ; + const Int_t GetDigitsInRun() const { return fDigitsInRun; } + void MixWith(const TString alirunFileName, + const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; // Add another one file to mix + void Print()const ; AliEMCALDigitizer & operator = (const AliEMCALDigitizer & rvalue) { // assignement operator requested by coding convention but not needed @@ -70,16 +71,24 @@ private: Bool_t Init(); void InitParameters() ; void PrintDigits(Option_t * option) ; + void Unload() ; void WriteDigits(Int_t evt) ; // Writes Digits for particular event Float_t TimeOfNoise(void) ; // Calculate time signal generated by noise + //Calculate the time of crossing of the threshold by front edge Float_t FrontEdgeTime(TClonesArray * ticks) ; Int_t DigitizeEnergy(Float_t energy, Int_t absId) ; private: - Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) - Int_t fDigitsInRun ; //! Total number of digits in one run + Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) + Int_t fDigitsInRun ; //! Total number of digits in one run + Bool_t fInit ; //! To avoid overwriting existing files + + Int_t fInput ; // Number of files to merge + TString * fInputFileNames ; //[fInput] List of file names to merge + TString * fEventNames ; //[fInput] List of event names to merge + Float_t fDigitThreshold ; // Threshold for storing digits in EMC Int_t fMeanPhotonElectron ; // number of photon electrons per GeV deposited energy Float_t fPedestal ; // Calibration parameters @@ -97,10 +106,10 @@ private: Float_t fADCchannelPRE ; // width of one ADC channel in PRE section (GeV) Float_t fADCpedestalPRE ; // Int_t fNADCPRE ; // number of channels in PRE section ADC - Bool_t fToSplit ; //! Do we work in the split mode - TFile * fSplitFile ; //! file in which Digits will eventually be stored - ClassDef(AliEMCALDigitizer,3) // description + TString fEventFolderName; // skowron: name of EFN to read data from in stand alone mode + + ClassDef(AliEMCALDigitizer,4) // description }; diff --git a/EMCAL/AliEMCALFast.cxx b/EMCAL/AliEMCALFast.cxx index 3e405d08646..a8918ac6e92 100644 --- a/EMCAL/AliEMCALFast.cxx +++ b/EMCAL/AliEMCALFast.cxx @@ -16,6 +16,12 @@ /* $Log$ +Revision 1.3.4.1 2003/07/07 14:13:31 schutz +NewIO + +Revision 1.4 2002/12/18 08:25:31 morsch +Correction in efficiency for p < 0.5. + Revision 1.3 2002/02/05 11:32:15 morsch Smearing parameters with TRD included added. diff --git a/EMCAL/AliEMCALGeometry.cxx b/EMCAL/AliEMCALGeometry.cxx index c639c3773d3..a36fb8d538b 100644 --- a/EMCAL/AliEMCALGeometry.cxx +++ b/EMCAL/AliEMCALGeometry.cxx @@ -200,14 +200,16 @@ void AliEMCALGeometry::Init(void){ fgInit = kTRUE; - Info("Init", "geometry of EMCAL named %s is as follows:", name.Data()); - printf( "Tower geometry pre-shower: %d x (%f mm Pb, %f mm Sc) \n", GetNPRLayers(), GetPRPbRadThick(), GetPRScintThick() ) ; - printf( " ECAL : %d x (%f mm Pb, %f mm Sc) \n", GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; - if ( GetNHCLayers() > 0 ) - printf( " HCAL : %d x (%f mm Pb, %f mm Sc) \n", GetNHCLayers(), GetHCCuRadThick(), GetHCScintThick() ) ; - printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; - printf("Layout: phi = (%f, %f), eta = (%f, %f), y = %f\n", - GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ) ; + if (gDebug) { + Info("Init", "geometry of EMCAL named %s is as follows:", name.Data()); + printf( "Tower geometry pre-shower: %d x (%f mm Pb, %f mm Sc) \n", GetNPRLayers(), GetPRPbRadThick(), GetPRScintThick() ) ; + printf( " ECAL : %d x (%f mm Pb, %f mm Sc) \n", GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; + if ( GetNHCLayers() > 0 ) + printf( " HCAL : %d x (%f mm Pb, %f mm Sc) \n", GetNHCLayers(), GetHCCuRadThick(), GetHCScintThick() ) ; + printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; + printf("Layout: phi = (%f, %f), eta = (%f, %f), y = %f\n", + GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ) ; + } } //______________________________________________________________________ @@ -289,11 +291,11 @@ void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi, nindex = index - itowers; ipre = 1 ; } - else if ( IsInECAL(index) ) { // ECAL index + else if ( IsInECA(index) ) { // ECAL index nindex = index ; ipre = 0 ; } - else if ( IsInHCAL(index) ) { // HCAL index + else if ( IsInHCA(index) ) { // HCAL index nindex = index - 2*itowers; ipre = 2 ; } @@ -425,9 +427,9 @@ void AliEMCALGeometry::PosInAlice(const Int_t *relid, Float_t &theta, Float_t &p if (sect == 1) d = GetIP2PRESection() - GetIPDistance() ; else if (sect == 0) - d = GetIP2ECALSection() - GetIPDistance() ; + d = GetIP2ECASection() - GetIPDistance() ; else if (sect == 2) - d = GetIP2HCALSection() - GetIPDistance() ; + d = GetIP2HCASection() - GetIPDistance() ; else Fatal("PosInAlice", "Unexpected tower section!") ; @@ -461,10 +463,10 @@ void AliEMCALGeometry::PosInAlice(const Int_t absid, Float_t &theta, Float_t &ph Float_t d = 0. ; if (IsInPRE(absid)) d = GetIP2PRESection() - GetIPDistance() ; - else if (IsInECAL(absid)) - d = GetIP2ECALSection() - GetIPDistance() ; - else if (IsInHCAL(absid)) - d = GetIP2HCALSection() - GetIPDistance() ; + else if (IsInECA(absid)) + d = GetIP2ECASection() - GetIPDistance() ; + else if (IsInHCA(absid)) + d = GetIP2HCASection() - GetIPDistance() ; else Fatal("PosInAlice", "Unexpected id # %d!", absid) ; @@ -501,11 +503,11 @@ void AliEMCALGeometry::XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Fl theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); if ( ipre == 0 ) - cyl_radius = GetIP2ECALSection() ; + cyl_radius = GetIP2ECASection() ; else if ( ipre == 1 ) cyl_radius = GetIP2PRESection() ; else if ( ipre == 2 ) - cyl_radius = GetIP2HCALSection() ; + cyl_radius = GetIP2HCASection() ; else Fatal("XYZFromIndex", "Unexpected Tower section # %d", ipre) ; @@ -533,12 +535,12 @@ void AliEMCALGeometry::XYZFromIndex(const Int_t absid, TVector3 &v) const { PosInAlice(absid, theta, phi) ; - if ( IsInECAL(absid) ) - cyl_radius = GetIP2ECALSection() ; + if ( IsInECA(absid) ) + cyl_radius = GetIP2ECASection() ; else if ( IsInPRE(absid) ) cyl_radius = GetIP2PRESection() ; - else if ( IsInHCAL(absid) ) - cyl_radius = GetIP2HCALSection() ; + else if ( IsInHCA(absid) ) + cyl_radius = GetIP2HCASection() ; else Fatal("XYZFromIndex", "Unexpected Tower section") ; diff --git a/EMCAL/AliEMCALGeometry.h b/EMCAL/AliEMCALGeometry.h index 554e62a4749..9aa2168bc85 100644 --- a/EMCAL/AliEMCALGeometry.h +++ b/EMCAL/AliEMCALGeometry.h @@ -58,9 +58,9 @@ public: const Float_t GetArm1EtaMin() const { return fArm1EtaMin;} const Float_t GetArm1EtaMax() const { return fArm1EtaMax;} const Float_t GetIPDistance() const { return fIPDistance ; } - const Float_t GetIP2PRESection() const { return (GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ;} - const Float_t GetIP2ECALSection() const { return ( GetIP2PRESection() + GetNPRLayers() * ( GetPRScintThick() + GetPRPbRadThick() ) ) ; } - const Float_t GetIP2HCALSection() const { return ( GetIP2ECALSection() + GetNECLayers() * ( GetECScintThick() + GetECPbRadThick() ) ) ; } + const Float_t GetIP2PRESection() const { return (GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ;} + const Float_t GetIP2ECASection() const { return ( GetIP2PRESection() + GetNPRLayers() * ( GetPRScintThick() + GetPRPbRadThick() ) ) ; } + const Float_t GetIP2HCASection() const { return ( GetIP2ECASection() + GetNECLayers() * ( GetECScintThick() + GetECPbRadThick() ) ) ; } const Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; } const Float_t GetShellThickness() const { return fShellThickness ; } const Float_t GetZLength() const { return fZLength ; } @@ -86,8 +86,8 @@ public: const Float_t GetSummationFraction() const {return fSummationFraction ; } const Bool_t IsInPRE(Int_t index) const { if ( (index > (GetNZ() * GetNPhi()) && (index <= 2 * (GetNZ() * GetNPhi())))) return kTRUE; else return kFALSE ;} - const Bool_t IsInECAL(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;} - const Bool_t IsInHCAL(Int_t index) const { if ( (index > 2*(GetNZ() * GetNPhi()) && (index <= 3 * (GetNZ() * GetNPhi())))) return kTRUE; else return kFALSE ;} ; + const Bool_t IsInECA(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;} + const Bool_t IsInHCA(Int_t index) const { if ( (index > 2*(GetNZ() * GetNPhi()) && (index <= 3 * (GetNZ() * GetNPhi())))) return kTRUE; else return kFALSE ;} ; Float_t AngleFromEta(Float_t eta){ // returns angle in radians for a given // pseudorapidity. diff --git a/EMCAL/AliEMCALGetter.cxx b/EMCAL/AliEMCALGetter.cxx index eac92461088..8c37d6ba55b 100644 --- a/EMCAL/AliEMCALGetter.cxx +++ b/EMCAL/AliEMCALGetter.cxx @@ -14,21 +14,22 @@ **************************************************************************/ /* $Id: */ + /* $Log: 29.05.2001 Yuri Kharlov: Everywhere reading the treese TTree->GetEvent(i) is replaced by reading the branches TBranch->GetEntry(0) */ - /* $Log: 08.2002 Dmitri Peressounko: + */ //_________________________________________________________________________ // A singleton. This class should be used in the analysis stage to get // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, // instead of directly reading them from galice.root file. This container -// ensures, that one reads Digits, made of these particular digits, RecPoints, +// ensures, that one reads Digits, made of these particular digits, RecPoints, // made of these particular RecPoints, TrackSegments and RecParticles. // This becomes non trivial if there are several identical branches, produced with // different set of parameters. @@ -38,456 +39,395 @@ // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) // AliEMCALRecParticle * part = gime->RecParticle(1) ; // ................ -// please->GetEvent(event) ; // reads new event from galice.root +// gime->Event(event) ; // reads new event from galice.root // //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) //*-- Completely redesigned by Dmitri Peressounko March 2001 // //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make -//*-- systematic usage of TFolders without changing the interface -//*-- YS August 2002 : clone PHOS as closely as possible and intoduction -// of new IO (à la PHOS) - +//*-- systematic usage of TFolders without changing the interface ////////////////////////////////////////////////////////////////////////////// - - // --- ROOT system --- +#include "TSystem.h" #include "TFile.h" -#include "TTree.h" +// #include "TTree.h" #include "TROOT.h" -#include "TObjString.h" -#include "TFolder.h" -#include "TParticle.h" +// #include "TObjString.h" +// #include "TFolder.h" +// #include "TParticle.h" // --- Standard library --- -#include - // --- AliRoot header files --- - -#include "AliRun.h" -#include "AliConfig.h" +// #include "AliRun.h" +// #include "AliConfig.h" #include "AliEMCALGetter.h" -#include "AliEMCAL.h" -#include "AliEMCALDigitizer.h" -#include "AliEMCALSDigitizer.h" -#include "AliEMCALClusterizerv1.h" -#include "AliEMCALTrackSegmentMakerv1.h" -#include "AliEMCALTrackSegment.h" -#include "AliEMCALPIDv1.h" -#include "AliEMCALGeometry.h" +#include "AliRunLoader.h" +#include "AliStack.h" +#include "AliEMCALLoader.h" ClassImp(AliEMCALGetter) + +AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; +AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0; +Int_t AliEMCALGetter::fgDebug = 0; - AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; - TFile * AliEMCALGetter::fFile = 0 ; +// TFile * AliEMCALGetter::fgFile = 0 ; //____________________________________________________________________________ - -AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit) +AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption) { - // This is the ctor called by GetInstance and the only one that can be used - - if ( fHeaderFile.Contains("_") ) { - Fatal("AliEMCALGetter","Invalid file name (_ not allowed) %s",fHeaderFile.Data()) ; - } - - //Initialize all data - - fFailed = kFALSE ; - fDebug = 0 ; - fAlice = 0 ; - - fToSplit = toSplit ; - fHeaderFile = headerFile ; - - fPrimaries = new TObjArray(1) ; + // ctor only called by Instance() - fModuleFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); - fPrimariesFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data")); - fHitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); - fSDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); - fDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/Data")); - fRecoFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/RecData")); - //fQAFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); - fTasksFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Tasks")) ; - - //Set titles to branches and create EMCAL specific folders - - SetTitle(branchTitle) ; - - if ( fHeaderFile != "aliroot" ) { // to call the getter without a file - - //open headers file - - fFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - - if(!fFile){ //if file was not opened yet, read gAlice - fFile = TFile::Open(fHeaderFile.Data(), "update") ; - if (!fFile->IsOpen()) { - Error("AliEMCALGetter","Cannot open %s",fHeaderFile.Data()) ; - fFailed = kTRUE ; - return ; - } - } - gAlice = static_cast(fFile->Get("gAlice")) ; - } - - if (!gAlice) { - Error("AliEMCALGetter","Cannot find gAlice in %s",fHeaderFile.Data()) ; - fFailed = kTRUE ; - return ; - } - if (!EMCAL()) { - if (fDebug) - Info("AliEMCALGetter","Posting EMCAL to Folders") ; - - if (gAlice->GetDetector("EMCAL")) { - AliConfig * conf = AliConfig::Instance() ; - conf->Add(static_cast(gAlice->GetDetector("EMCAL"))) ; - conf->Add(static_cast(gAlice->GetDetector("EMCAL"))) ; + AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ; + if (!rl) { + rl = AliRunLoader::Open(headerFile, version, openingOption); + if (!rl) { + Fatal("AliEMCALGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ; + return ; + } + if (rl->GetAliRun() == 0x0) { + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); // should be removed } - else - Error("AliEMCALGetter"," Detector EMCAL not found"); } - - fDebug=0; + fgEmcalLoader = dynamic_cast(rl->GetLoader("EMCALLoader")); + if ( !fgEmcalLoader ) + Error("AliEMCALGetter", "Could not find EMCALLoader") ; + else + fgEmcalLoader->SetTitle(version); + + + // initialize data members + SetDebug(0) ; + //fBTE = 0 ; + fPrimaries = 0 ; + fLoadingStatus = "" ; } //____________________________________________________________________________ - AliEMCALGetter::~AliEMCALGetter() { - if (fPrimaries) { - fPrimaries->Delete() ; - delete fPrimaries ; - } - - TFolder * emcalF = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - TCollection * folderslist = emcalF->GetListOfFolders() ; - TIter next(folderslist) ; - TFolder * folder = 0 ; - - while ( (folder = static_cast(next())) ) - emcalF->Remove(folder) ; + // dtor + delete fgEmcalLoader ; + fgEmcalLoader = 0 ; + //delete fBTE ; + // fBTE = 0 ; + fPrimaries->Delete() ; + delete fPrimaries ; +} - if (fFile) { - fFile->Close() ; - delete fFile ; - fFile = 0 ; +//____________________________________________________________________________ +AliEMCALClusterizer * AliEMCALGetter::Clusterizer() +{ + AliEMCALClusterizer * rv ; + rv = dynamic_cast(EmcalLoader()->Reconstructioner()) ; + if (!rv) { + Event(0, "R") ; + rv = dynamic_cast(EmcalLoader()->Reconstructioner()) ; } - - fgObjGetter = 0 ; + return rv ; } -//____________________________________________________________________________ -void AliEMCALGetter::CloseFile() +//____________________________________________________________________________ +TClonesArray * AliEMCALGetter::Digits() { - delete gAlice ; - gAlice = 0 ; - delete fAlice ; - fAlice = 0 ; + // asks the Loader to return the Digits container + + TClonesArray * rv = 0 ; + rv = EmcalLoader()->Digits() ; + + if( !rv ) { + EmcalLoader()->MakeDigitsArray() ; + rv = EmcalLoader()->Digits() ; + } + return rv ; } //____________________________________________________________________________ +AliEMCALDigitizer * AliEMCALGetter::Digitizer() +{ + AliEMCALDigitizer * rv ; + rv = dynamic_cast(EmcalLoader()->Digitizer()) ; + if (!rv) { + Event(0, "D") ; + rv = dynamic_cast(EmcalLoader()->Digitizer()) ; + } + return rv ; +} -const TFolder * AliEMCALGetter::Folder(const TString what) const { - // returns the EMCAL folder required by what - // what = hits, sdigits, digits +//____________________________________________________________________________ +TObjArray * AliEMCALGetter::PRERecPoints() +{ + // asks the Loader to return the EMC RecPoints container - if ( what == "hits" ) - return dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - else if ( what == "sdigits" ) - return dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - else if ( what == "digits" ) - return dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - else { - Error("GetFolder","%s illegal option (hits, sdigits, digits) ", what.Data()) ; - return 0 ; + TObjArray * rv = 0 ; + + rv = EmcalLoader()->PRERecPoints() ; + if (!rv) { + EmcalLoader()->MakeRecPointsArray() ; + rv = EmcalLoader()->PRERecPoints() ; } + return rv ; } //____________________________________________________________________________ - -AliEMCALGetter * AliEMCALGetter::GetInstance() +TObjArray * AliEMCALGetter::ECARecPoints() { - // Returns the pointer of the unique instance already defined + // asks the Loader to return the EMC RecPoints container - if ( fgObjGetter ) { - return fgObjGetter ; - } - else { - return 0 ; + TObjArray * rv = 0 ; + + rv = EmcalLoader()->ECARecPoints() ; + if (!rv) { + EmcalLoader()->MakeRecPointsArray() ; + rv = EmcalLoader()->ECARecPoints() ; } + return rv ; } //____________________________________________________________________________ - -AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile, - const char* branchTitle, - const Bool_t toSplit) +TObjArray * AliEMCALGetter::HCARecPoints() { - // Creates and returns the pointer of the unique instance - // Must be called only when the environment has changed - - if(!fgObjGetter){ - fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ; - if(fgObjGetter->fFailed) - return 0; - else - return fgObjGetter ; - } - - //First checks, if header file already opened - - if(!fgObjGetter->fFile){ - fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ; - if(fgObjGetter->fFailed) - return 0; - else - return fgObjGetter ; - } + // asks the Loader to return the EMC RecPoints container - if(fgObjGetter->fHeaderFile.CompareTo(headerFile)==0){ //Opened the same header file - if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0)&& //Open the same branch title - (toSplit==fgObjGetter->fToSplit)){ //Nothing should be cleaned - } - else{ //Clean all data and AliEMCAL...zers - if(fgObjGetter->fToSplit) - fgObjGetter->CloseSplitFiles() ; - //fgObjGetter->CleanWhiteBoard() ; - fgObjGetter->fToSplit = toSplit ; - fgObjGetter->SetTitle(branchTitle) ; - } - } - else{ //Close already opened files, clean memory and open new header file - if(gAlice){ //should first delete gAlice, then close file - //Should be in dtor of EMCAL, but if one changes path ... - fgObjGetter->fModuleFolder->Remove(fgObjGetter->fModuleFolder->FindObject("EMCAL")) ; - delete gAlice ; - } - if(fgObjGetter->fFile){ - fgObjGetter->fFile->Close() ; - fgObjGetter->fFile=0; - } - if(fgObjGetter->fToSplit) - fgObjGetter->CloseSplitFiles() ; - fgObjGetter->CleanWhiteBoard() ; - fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ; + TObjArray * rv = 0 ; + + rv = EmcalLoader()->HCARecPoints() ; + if (!rv) { + EmcalLoader()->MakeRecPointsArray() ; + rv = EmcalLoader()->HCARecPoints() ; } - - return fgObjGetter ; - + return rv ; } //____________________________________________________________________________ - -const Bool_t AliEMCALGetter::BranchExists(const TString recName) const +TClonesArray * AliEMCALGetter::TrackSegments() { - //Looks in the tree Tree"name" if branch with current name olready exists - - TString filename("") ; - TString name, dataname, zername; - if(recName == "SDigits"){ - filename=fSDigitsFileName ; - name = "TreeS0" ; - dataname = "EMCAL" ; - zername = "AliEMCALSDigitizer" ; - } - else if(recName == "Digits"){ - filename=fDigitsFileName ; - name = "TreeD0" ; - dataname = "EMCAL" ; - zername = "AliEMCALDigitizer" ; - } - else if(recName =="RecPoints"){ - filename=fRecPointsFileName ; - name = "TreeR0" ; - dataname = "EMCALEmcRP" ; - zername = "AliEMCALClusterizer" ; - } - else if(recName == "TrackSegments"){ - filename=fTrackSegmentsFileName ; - name = "TreeR0" ; - dataname = "EMCALTS" ; - zername = "AliEMCALTrackSegmentMaker" ; - } - else if(recName == "RecParticles"){ - filename= fRecParticlesFileName ; - name = "TreeR0" ; - dataname = "EMCALRP" ; - zername = "AliEMCALPID" ; - } - else - return kFALSE ; - - TFile * file ; - TTree * tree ; - if(fToSplit){ - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - if(!file) - file = TFile::Open(fSDigitsFileName.Data(),"update"); - } - else - file = fFile ; - - tree = (TTree *)file->Get(name.Data()) ; - - if(!tree ) - return kFALSE ; + // asks the Loader to return the TrackSegments container - TObjArray * lob = static_cast(tree->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TString titleName(fBranchTitle); - titleName+=":"; - - while ((branch = (static_cast(next())))) { - TString branchName(branch->GetName() ) ; - TString branchTitle(branch->GetTitle() ) ; - if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){ - Warning("BranchExists", "branch %s with title %s already exits in %s", dataname.Data(), fBranchTitle.Data(), name.Data()); - return kTRUE ; - } - - if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){ - Warning("BranchExists","Branch AliEMCAL... with title %s already exits in %s",branch->GetTitle(), name.Data()); - return kTRUE ; - } + TClonesArray * rv = 0 ; + + rv = EmcalLoader()->TrackSegments() ; + if (!rv) { + EmcalLoader()->MakeTrackSegmentsArray() ; + rv = EmcalLoader()->TrackSegments() ; } + return rv ; +} - //We can't delete three if gAlice points to it... To be redisigned somehow???!!! - - if(!fToSplit){ - if(name.Contains("TreeS")) - if(tree!=gAlice->TreeS()) - tree->Delete(); - if(name.Contains("TreeD")) - if(tree!=gAlice->TreeD()) - tree->Delete(); - if(name.Contains("TreeR")) - if(tree!=gAlice->TreeR()) - tree->Delete(); +//____________________________________________________________________________ +AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker() +{ + AliEMCALTrackSegmentMaker * rv ; + rv = dynamic_cast(EmcalLoader()->TrackSegmentMaker()) ; + if (!rv) { + Event(0, "T") ; + rv = dynamic_cast(EmcalLoader()->TrackSegmentMaker()) ; } - - return kFALSE ; + return rv ; } //____________________________________________________________________________ +TClonesArray * AliEMCALGetter::RecParticles() +{ + // asks the Loader to return the TrackSegments container -void AliEMCALGetter::ListBranches(Int_t event) const + TClonesArray * rv = 0 ; + + rv = EmcalLoader()->RecParticles() ; + if (!rv) { + EmcalLoader()->MakeRecParticlesArray() ; + rv = EmcalLoader()->RecParticles() ; + } + return rv ; +} +//____________________________________________________________________________ +void AliEMCALGetter::Event(const Int_t event, const char* opt) { - TBranch * branch = 0 ; - if (gAlice->GetEvent(event) == -1) - return ; + // Reads the content of all Tree's S, D and R - TTree * t = gAlice->TreeH() ; + if ( event >= MaxEvent() ) { + Error("Event", "%d not found in TreeE !", event) ; + return ; + } - if(t){ - Info("ListBranches"," -> ****** Hits : "); - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); - while ( (branch = static_cast(next())) ) - Info("ListBranches"," %s", branch->GetName()); + // checks if we are dealing with test-beam data +// TBranch * btb = rl->TreeE()->GetBranch("AliEMCALBeamTestEvent") ; +// if(btb){ +// if(!fBTE) +// fBTE = new AliEMCALBeamTestEvent() ; +// btb->SetAddress(&fBTE) ; +// btb->GetEntry(event) ; +// } +// else{ +// if(fBTE){ +// delete fBTE ; +// fBTE = 0 ; +// } +// } - } else - Warning("ListBranches"," -> TreeH not found for event %d",event); + // Loads the type of object(s) requested + + rl->GetEvent(event) ; - t = gAlice->TreeS() ; + if( strstr(opt,"X") || (strcmp(opt,"")==0) ) + ReadPrimaries() ; - if(t){ - Info("ListBranches"," -> ****** SDigits : "); - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; + if(strstr(opt,"H") ) + ReadTreeH(); - while ( (branch = static_cast(next())) ) - Info("ListBranches"," %s %s",branch->GetName(),branch->GetTitle()); - } else - Warning("ListBranches"," -> TreeS not found for event %d",event); + if(strstr(opt,"S") ) + ReadTreeS() ; - t = gAlice->TreeD() ; + if( strstr(opt,"D") ) + ReadTreeD() ; - if(t){ - Info("ListBranches"," -> ****** Digits : "); - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; + if( strstr(opt,"R") ) + ReadTreeR() ; - while ( (branch = static_cast(next())) ) - Info(" %s %s", branch->GetName(), branch->GetTitle()); - } else - Warning("ListBranches"," -> TreeD not found for event %d", event); + if( strstr(opt,"T") ) + ReadTreeT() ; - t = gAlice->TreeR() ; + if( strstr(opt,"P") ) + ReadTreeP() ; - if(t){ - Info("ListBranches"," -> ****** Recon : "); - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; - while ( (branch = static_cast(next())) ) - Info(" %s %s", branch->GetName(), branch->GetTitle()); - } else - Warning("ListBranches"," -> TreeR not found for event %d",event); +// if( strstr(opt,"Q") ) +// ReadTreeQA() ; + } + //____________________________________________________________________________ +Int_t AliEMCALGetter::EventNumber() const + { + // return the current event number + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return static_cast(rl->GetEventNumber()) ; +} -void AliEMCALGetter::NewBranch(TString name, Int_t event) +//____________________________________________________________________________ + TClonesArray * AliEMCALGetter::Hits() { - fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ; - Event(event) ; + // asks the loader to return the Hits container + + TClonesArray * rv = 0 ; + + rv = EmcalLoader()->Hits() ; + if ( !rv ) { + EmcalLoader()->LoadHits("read"); + rv = EmcalLoader()->Hits() ; + } + return rv ; } //____________________________________________________________________________ - -Bool_t AliEMCALGetter::NewFile(TString name) +AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption) { - fHeaderFile = name ; - fFile->Close() ; - fFailed = kFALSE; - - fFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - - if(!fFile) { //if file was not opened yet, read gAlice - fFile = TFile::Open(fHeaderFile.Data(),"update") ; - if (!fFile->IsOpen()) { - Error("NewFile", " -> Cannot open %s", fHeaderFile.Data()); - fFailed = kTRUE ; - return fFailed ; + // Creates and returns the pointer of the unique instance + // Must be called only when the environment has changed + + //::Info("Instance","alirunFileName=%s version=%s openingOption=%s",alirunFileName,version,openingOption); + + if(!fgObjGetter){ // first time the getter is called + fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ; + } + else { // the getter has been called previously + AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle()); + if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name + // check if the file is already open + TFile * galiceFile = dynamic_cast(gROOT->FindObject(rl->GetFileName()) ) ; + + if ( !galiceFile ) + fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ; + + else { // the file is already open check the version name + TString currentVersionName = rl->GetEventFolder()->GetName() ; + TString newVersionName(version) ; + if (currentVersionName == newVersionName) + if(fgDebug) + ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ; + else { + fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ; + } + } } - gAlice = static_cast(fFile->Get("gAlice")) ; - } - - if (!gAlice) { - Error("NewFile"," -> Cannot find gAlice in %s", fHeaderFile.Data()); - fFailed = kTRUE ; - return fFailed ; + else + fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ; } - return fFailed ; + if (!fgObjGetter) + ::Error("Instance", "Failed to create the EMCAL Getter object") ; + else + if (fgDebug) + Print() ; + + return fgObjGetter ; } //____________________________________________________________________________ +AliEMCALGetter * AliEMCALGetter::Instance() +{ + // Returns the pointer of the unique instance already defined + + if(!fgObjGetter) + ::Error("Instance", "Getter not initialized") ; + + return fgObjGetter ; + +} -const AliEMCAL * AliEMCALGetter::EMCAL() +//____________________________________________________________________________ +Int_t AliEMCALGetter::MaxEvent() const { - // returns the EMCAL object + // returns the number of events in the run (from TE) + + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return static_cast(rl->GetNumberOfEvents()) ; +} - AliEMCAL * emcal = dynamic_cast(fModuleFolder->FindObject("EMCAL")) ; +//____________________________________________________________________________ +TParticle * AliEMCALGetter::Primary(Int_t index) const +{ + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return rl->Stack()->Particle(index) ; +} +//____________________________________________________________________________ +AliEMCAL * AliEMCALGetter:: EMCAL() const +{ + // returns the EMCAL object + AliEMCAL * emcal = dynamic_cast(EmcalLoader()->GetModulesFolder()->FindObject("EMCAL")) ; if (!emcal) - if (fDebug) - Warning("EMCAL"," -> EMCAL module not found in Folders" ); + if (fgDebug) + Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ; return emcal ; } + + //____________________________________________________________________________ +AliEMCALPID * AliEMCALGetter::PID() +{ + AliEMCALPID * rv ; + rv = dynamic_cast(EmcalLoader()->PIDTask()) ; + if (!rv) { + Event(0, "P") ; + rv = dynamic_cast(EmcalLoader()->PIDTask()) ; + } + return rv ; +} -AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() +//____________________________________________________________________________ +AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const { + // Returns EMCAL geometry + AliEMCALGeometry * rv = 0 ; if (EMCAL() ) rv = EMCAL()->GetGeometry() ; @@ -495,2370 +435,341 @@ AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() } //____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostPrimaries(void) const -{ - //------- Primaries ---------------------- - // the hierarchy is //Folders/RunMC/Event/Data/Primaries - - TFolder * primariesFolder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; - if ( !primariesFolder ) { - if (fDebug) { - Warning("PostPrimaries", "-> Folder //%s/Primaries/ not found!", fPrimariesFolder->GetName()); - Info("PostPrimaries", "-> Adding Folder //%s/Primaries/",fPrimariesFolder->GetName()); - } - primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ; - } - - TClonesArray *primaries= new TClonesArray("TParticle",1000) ; - primaries->SetName("Primaries") ; - primariesFolder->Add(primaries) ; - - return kTRUE; -} +TClonesArray * AliEMCALGetter::Primaries() +{ + // creates the Primaries container if needed + if ( !fPrimaries ) { + if (fgDebug) + Info("Primaries", "Creating a new TClonesArray for primaries") ; + fPrimaries = new TClonesArray("TParticle", 1000) ; + } + return fPrimaries ; +} //____________________________________________________________________________ +void AliEMCALGetter::Print() +{ + // Print usefull information about the getter + + AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle()); + ::Info( "Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ; +} -TObject** AliEMCALGetter::PrimariesRef(void) const -{ - //------- Primaries ---------------------- - // the hierarchy is //Folders/RunMC/Event/Data/Primaries - - if ( !fPrimariesFolder ) { - Fatal("PrimariesRef", "-> Folder //%s not found!",fPrimariesFolder); - } - - TFolder * primariesFolder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; +//____________________________________________________________________________ +void AliEMCALGetter::ReadPrimaries() +{ + // Read Primaries from Kinematics.root + + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + + // gets kine tree from the root file (Kinematics.root) + if ( ! rl->TreeK() ) // load treeK the first time + rl->LoadKinematics() ; + + fNPrimaries = rl->Stack()->GetNtrack() ; - if ( !primariesFolder ) { - Fatal("PrimariesRef", "-> Folder //%s/Primaries/ not found!",fPrimariesFolder); - } + if (fgDebug) + Info( "ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ; - TObject * p = primariesFolder->FindObject("Primaries") ; - if(!p) { - Fatal("PrimariesRef", "-> %s/Primaries not found !",primariesFolder->GetName()); + // first time creates the container + if ( Primaries() ) + fPrimaries->Clear() ; + + Int_t index = 0 ; + for (index = 0 ; index < fNPrimaries; index++) { + new ((*fPrimaries)[index]) TParticle(*(Primary(index))); } - - return primariesFolder->GetListOfFolders()->GetObjectRef(p) ; } //____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostHits(void) const -{ - //------- Hits ---------------------- - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits - - TFolder * emcalFolder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostHits", "-> Folder //%s/EMCAL/ not found!", fHitsFolder); - Info("PostHits", "-> Adding Folder //%s/EMCAL/",fHitsFolder); - } - emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; - } - - TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ; - hits->SetName("Hits") ; - emcalFolder->Add(hits) ; - - return kTRUE; -} +Int_t AliEMCALGetter::ReadTreeD() +{ + // Read the Digits + + + // gets TreeD from the root file (EMCAL.SDigits.root) + if ( !IsLoaded("D") ) { + EmcalLoader()->LoadDigits("UPDATE") ; + EmcalLoader()->LoadDigitizer("UPDATE") ; + SetLoaded("D") ; + } + return Digits()->GetEntries() ; +} //____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeH() +{ + // Read the Hits + + // gets TreeH from the root file (EMCAL.Hit.root) + if ( !IsLoaded("H") ) { + EmcalLoader()->LoadHits("UPDATE") ; + SetLoaded("H") ; + } + return Hits()->GetEntries() ; +} -TObject ** AliEMCALGetter::HitsRef(void) const -{ - //------- Hits ---------------------- - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits - - if ( !fHitsFolder ) { - Error("HitsRef", "-> Folder //%s not found!",fHitsFolder); - return 0; - } - - TFolder * emcalFolder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - Error("HitsRef", "-> Folder //%s/EMCAL/ not found!",fHitsFolder); - return 0; +//____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeR() +{ + // Read the RecPoints + + + // gets TreeR from the root file (EMCAL.RecPoints.root) + if ( !IsLoaded("R") ) { + EmcalLoader()->LoadRecPoints("UPDATE") ; + EmcalLoader()->LoadClusterizer("UPDATE") ; + SetLoaded("R") ; } - TObject * h = emcalFolder->FindObject("Hits") ; - - if(!h) { - Error("HitsRef", "-> %s/Hits not found !",emcalFolder->GetName()); - return 0 ; - } - else - return emcalFolder->GetListOfFolders()->GetObjectRef(h) ; + return ECARecPoints()->GetEntries() ; } //____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const -{ - //---------- SDigits ------------------------- - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname - // because you can have sdigits from several hit files for mixing - - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostSDigits", "-> Folder //%s/EMCAL/ not found!", fSDigitsFolder); - Info("PostSDigits", "-> Adding Folder //%s/EMCAL/",fHitsFolder); - } - emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - } - - TString subdir(headerFile) ; - subdir.ReplaceAll("/", "_") ; - TFolder * emcalSubFolder = dynamic_cast(emcalFolder->FindObject(subdir)) ; - if ( !emcalSubFolder ) - emcalSubFolder = emcalFolder->AddFolder(subdir, ""); - - TObject * sd = emcalSubFolder->FindObject(name); - - if ( !sd ) { - TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ; - sdigits->SetName(name) ; - emcalSubFolder->Add(sdigits) ; +Int_t AliEMCALGetter::ReadTreeT() +{ + // Read the TrackSegments + + + // gets TreeT from the root file (EMCAL.TrackSegments.root) + if ( !IsLoaded("T") ) { + EmcalLoader()->LoadTracks("UPDATE") ; + EmcalLoader()->LoadTrackSegmentMaker("UPDATE") ; + SetLoaded("T") ; } - return kTRUE; -} - + return TrackSegments()->GetEntries() ; +} //____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeP() +{ + // Read the TrackSegments + + + // gets TreeT from the root file (EMCAL.TrackSegments.root) + if ( !IsLoaded("P") ) { + EmcalLoader()->LoadRecParticles("UPDATE") ; + EmcalLoader()->LoadPID("UPDATE") ; + SetLoaded("P") ; + } -TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const -{ - //------- SDigits ---------------------- - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits + return RecParticles()->GetEntries() ; +} +//____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeS() +{ + // Read the SDigits + + + // gets TreeS from the root file (EMCAL.SDigits.root) + if ( !IsLoaded("S") ) { + EmcalLoader()->LoadSDigits("UPDATE") ; + EmcalLoader()->LoadSDigitizer("UPDATE") ; + SetLoaded("S") ; + } - if ( !fSDigitsFolder ) { - Fatal("SDigitsRef", "-> Folder //%s not found!", fSDigitsFolder); - } + return SDigits()->GetEntries() ; +} - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; +//____________________________________________________________________________ +TClonesArray * AliEMCALGetter::SDigits() +{ + // asks the Loader to return the Digits container - if ( !emcalFolder ) { - Fatal("SDigitsRef", "-> Folder //%s/EMCAL/ not found!", fSDigitsFolder); + TClonesArray * rv = 0 ; + + rv = EmcalLoader()->SDigits() ; + if (!rv) { + EmcalLoader()->MakeSDigitsArray() ; + rv = EmcalLoader()->SDigits() ; } + return rv ; +} - TFolder * emcalSubFolder = 0 ; - - if(file) - emcalSubFolder = dynamic_cast(emcalFolder->FindObject(file)) ; - else - emcalSubFolder = dynamic_cast(emcalFolder->FindObject(fHeaderFile)) ; - - if(!emcalSubFolder) { - Fatal("SDigitsRef", "-> Folder //Folders/RunMC/Event/Data/EMCAL/%s not found!", file); +//____________________________________________________________________________ +AliEMCALSDigitizer * AliEMCALGetter::SDigitizer() +{ + AliEMCALSDigitizer * rv ; + rv = dynamic_cast(EmcalLoader()->SDigitizer()) ; + if (!rv) { + Event(0, "S") ; + rv = dynamic_cast(EmcalLoader()->SDigitizer()) ; } + return rv ; +} + +//____________________________________________________________________________ +TParticle * AliEMCALGetter::Secondary(const TParticle* p, const Int_t index) const +{ + // Return first (index=1) or second (index=2) secondary particle of primary particle p - TObject * dis = emcalSubFolder->FindObject(name) ; + if(index <= 0) + return 0 ; + if(index > 2) + return 0 ; - if(!dis) { - Fatal("SDigitsRef", "-> object %s not found!", name); + if(p) { + Int_t daughterIndex = p->GetDaughter(index-1) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return rl->GetAliRun()->Particle(daughterIndex) ; } - - return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ; + else + return 0 ; } //____________________________________________________________________________ +void AliEMCALGetter::Track(const Int_t itrack) +{ + // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() + + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); -const Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const -{ - //---------- SDigitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; + if( !TreeH() ) // load treeH the first time + rl->LoadHits() ; - if ( !sd ) { - Error("PostSDigitizer", "-> Task //%s/SDigitizer not found!",fTasksFolder); - return kFALSE ; - } + // first time create the container + TClonesArray * hits = Hits() ; + if ( hits ) + hits->Clear() ; - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostSDigitizer", "->//%s/SDigitizer/EMCAL/ not found!",fTasksFolder); - Info("PostSDigitizer", "-> Adding //%s/SDigitizer/EMCAL/", fTasksFolder); - } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - - AliEMCALSDigitizer * emcalsd = dynamic_cast(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); - - if (emcalsd) { - if (fDebug) - Info("PostSDigitizer", "-> Task %s already exists",sdigitizer->GetName()); - emcal->GetListOfTasks()->Remove(emcalsd) ; - } - - emcal->Add(sdigitizer) ; - - return kTRUE; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const -{ - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - - if ( !sd ) { - Fatal("SDigitizerRef", "-> Task //%s/SDigitizer not found!", fTasksFolder); - } - - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - Fatal("SDigitizerRef", "-> //%s/SDigitizer/EMCAL not found!", fTasksFolder); - } - - TTask * task = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; - - return emcal->GetListOfTasks()->GetObjectRef(task) ; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const -{ - //---------- SDigitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - - if ( !sd ) { - Error("PostSDigitizer", "-> Task //%s/SDigitizer not found!", fTasksFolder); - return kFALSE ; - } - - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostSDigitizer", "-> //%s/SDigitizer/EMCAL/ not found!", fTasksFolder); - - Info("PostSDigitizer", "-> Adding //%s/SDigitizer/EMCAL", fTasksFolder); - - } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - - TString sdname(name) ; - sdname.Append(":") ; - sdname.Append(file); - sdname.ReplaceAll("/","_") ; - AliEMCALSDigitizer * emcalsd = dynamic_cast(emcal->GetListOfTasks()->FindObject( sdname )); - - if (!emcalsd) { - emcalsd = new AliEMCALSDigitizer() ; - - //Note, we can not call constructor with parameters: it will call Getter and screw up everething - - emcalsd->SetName(sdname) ; - emcalsd->SetTitle(file) ; - emcal->Add(emcalsd) ; - } - - return kTRUE; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostDigits(const char * name) const -{ - //---------- Digits ------------------------- - // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name - - TFolder * emcalFolder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostDigits", "-> Folder //%s/EMCAL/ not found!", fDigitsFolder); - Info("PostDigits", "-> Adding Folder //%s/EMCAL/", fDigitsFolder); - } - emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; - } - - TObject* dig = emcalFolder->FindObject( name ) ; - - if ( !dig ) { - TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ; - digits->SetName(name) ; - emcalFolder->Add(digits) ; - } - - return kTRUE; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::DigitsRef(const char * name) const -{ - //------- Digits ---------------------- - // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name - - if ( !fDigitsFolder ) { - Fatal("DigitsRef", "-> Folder //%s not found!", fDigitsFolder); - } - - TFolder * emcalFolder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - Fatal("DigitsRef", "-> Folder //%s/EMCAL/ not found!", fDigitsFolder); - } - - TObject * d = emcalFolder->FindObject(name) ; - - if(!d) { - Fatal("DigitsRef", "-> object %s not found!", name); - } - - return emcalFolder->GetListOfFolders()->GetObjectRef(d) ; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const -{ - //---------- Digitizer ------------------------- - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if ( !sd ) { - Error("PostDigitizer", "-> Task //%s/Digitizer not found!", fTasksFolder); - return kFALSE ; - } - - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostDigitizer", "-> //%s/Digitizer/EMCAL not found!", fTasksFolder); - Info("PostDigitizer", "-> Adding //%s/Digitizer/EMCAL", fTasksFolder); - } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - - AliEMCALDigitizer * emcald = dynamic_cast(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; - - if (emcald) { - emcald->Delete() ; - emcal->GetListOfTasks()->Remove(emcald) ; - } - - emcal->Add(digitizer) ; - - return kTRUE; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostDigitizer(const char * name) const -{ - //---------- Digitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname - - TTask * d = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if ( !d ) { - - Error("PostDigitizer", "-> Task //%s/Digitizer not found!", fTasksFolder); - return kFALSE ; - } - - TTask * emcal = dynamic_cast(d->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostDigitizer", "-> //%s/Digitizer/EMCAL not found!", fTasksFolder); - - Info("PostDigitizer", "-> Adding //%s/Digitizer/EMCAL", fTasksFolder); - } - emcal = new TTask("EMCAL", "") ; - d->Add(emcal) ; -} - - AliEMCALDigitizer * emcald = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; - - if (!emcald) { - emcald = new AliEMCALDigitizer() ; - emcald->SetName(fDigitsTitle) ; - emcald->SetTitle(fHeaderFile) ; - emcal->Add(emcald) ; - } - - return kTRUE; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::DigitizerRef(const char * name) const -{ - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if ( !sd ) { - Fatal("DigitizerRef", "-> Task //%s/Digitizer not found!", fTasksFolder->GetName()); - } - - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - Fatal("DigitizerRef", "-> //%s/Digitizer/EMCAL", fTasksFolder->GetName()); - } - - TTask * task = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; - - return emcal->GetListOfTasks()->GetObjectRef(task) ; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostRecPoints(const char * name) const -{ - // -------------- RecPoints ------------------------------------------- - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostRecPoints", "-> Folder //%s/EMCAL/ not found!", fRecoFolder); - Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/", fRecoFolder); - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - // Pre Shower RecPoints - - TFolder * emcalRPoPREFolder = dynamic_cast(emcalFolder->FindObject("PRERecPoints")) ; - - if ( !emcalRPoPREFolder ) { - if (fDebug) { - Warning("PostRecPoints", "-> Folder //%s/EMCAL/PRERecPoints/ not found!", fRecoFolder); - Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/PRERecPoints/", fRecoFolder); - } - emcalRPoPREFolder = emcalFolder->AddFolder("PRERecPoints", "PRE RecPoints from EMCAL") ; - } - - TObject * rpPRE = emcalRPoPREFolder->FindObject( name ) ; - - if ( !rpPRE ) { - TObjArray * aPRErp = new TObjArray(100) ; - aPRErp->SetName(name) ; - emcalRPoPREFolder->Add(aPRErp) ; - } - - // EC RecPoints - - TFolder * emcalRPoECFolder = dynamic_cast(emcalFolder->FindObject("ECRecPoints")) ; - - if ( !emcalRPoECFolder ) { - if (fDebug) { - - Warning("PostRecPoints", "-> Folder //%s/EMCAL/ECRecPoints/ not found!", fRecoFolder); - Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/ECRecPoints not found!", fRecoFolder); - } - emcalRPoECFolder = emcalFolder->AddFolder("ECRecPoints", "EC RecPoints from EMCAL") ; - } - - TObject * rpEC = emcalFolder->FindObject( name ) ; - - if ( !rpEC ) { - TObjArray * aECrp = new TObjArray(100) ; - aECrp->SetName(name) ; - emcalRPoECFolder->Add(aECrp) ; - } - - // HC RecPoints - - TFolder * emcalRPoHCFolder = dynamic_cast(emcalFolder->FindObject("HCRecPoints")) ; - - if ( !emcalRPoHCFolder ) { - if (fDebug) { - - Warning("PostRecPoints", "-> Folder //%s/EMCAL/HCRecPoints/ not found!", fRecoFolder); - Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/HCRecPoints not found!", fRecoFolder); - } - emcalRPoHCFolder = emcalFolder->AddFolder("HCRecPoints", "HC RecPoints from EMCAL") ; - } - - TObject * rpHC = emcalFolder->FindObject( name ) ; - - if ( !rpHC ) { - TObjArray * aHCrp = new TObjArray(100) ; - aHCrp->SetName(name) ; - emcalRPoHCFolder->Add(aHCrp) ; - } - - return kTRUE; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::ECRecPointsRef(const char * name) const -{ - // -------------- RecPoints ------------------------------------------- - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/ECRecPoints/name - - if ( !fRecoFolder ) { - Fatal("ECRecPointsRef", "-> Folder //%s not found!", fRecoFolder); - } - - TFolder * towerFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/ECRecPoints")) ; - - if ( !towerFolder ) { - Fatal("ECRecPointsRef", "-> Folder //%s/EMCAL/ECRecPoints/ not found!", fRecoFolder); - } - - TObject * trp = towerFolder->FindObject(name ) ; - - if ( !trp ) { - Fatal("ECRecPointsRef", "-> Object %s not found!", name); - } - - return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::HCRecPointsRef(const char * name) const -{ - // -------------- RecPoints ------------------------------------------- - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/HCRecPoints/name - - if ( !fRecoFolder ) { - Fatal("HCRecPointsRef", "-> Folder //%s not found!", fRecoFolder); - } - - TFolder * towerFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/HCRecPoints")) ; - - if ( !towerFolder ) { - Fatal("HCRecPointsRef", "-> Folder //%s/EMCAL/HCRecPoints/ not found!", fRecoFolder); - } - - TObject * trp = towerFolder->FindObject(name ) ; - - if ( !trp ) { - Fatal("HCRecPointsRef", "-> Object %s not found!", name); - } - - return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::PRERecPointsRef(const char * name) const -{ - // -------------- RecPoints ------------------------------------------- - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PRERecPoints/name - - if ( !fRecoFolder ) { - Fatal("PRERecPointsRef", "-> Folder //%s not found!", fRecoFolder); - } - - TFolder * folderPRE = dynamic_cast(fRecoFolder->FindObject("EMCAL/PRERecPoints")) ; - - if ( !folderPRE ) { - Fatal("PRERecPointsRef", "-> Folder //%s/EMCAL/PRERecPoints/", fRecoFolder); - } - - - - TObject * prp = folderPRE->FindObject(name ) ; - - if ( !prp ) { - Fatal("PRERecPointsRef", "-> Object %s not found!", name); - } - - return folderPRE->GetListOfFolders()->GetObjectRef(prp) ; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizer * clu) const -{ - // ------------------ AliEMCALClusterizer ------------------------ - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostClusterizer", "-> Task //%s/Reconstructioner not found!", fTasksFolder); - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostClusterizer", "-> //%s/ReconstructionerEMCAL not found!", fTasksFolder); - Info("PostClusterizer", "-> Adding //%s/Reconstructioner/EMCAL", fTasksFolder); - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALClusterizerv1 * emcalcl = dynamic_cast(emcal->GetListOfTasks()->FindObject(clu->GetName())) ; - - if (emcalcl) { - if (fDebug) - Info("PostClusterizer", "-> Task %s already exists", clu->GetName()); - emcalcl->Delete() ; - emcal->GetListOfTasks()->Remove(emcalcl) ; - } - emcal->Add(clu) ; - - return kTRUE; -} - -//____________________________________________________________________________ - -TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const -{ - // ------------------ AliEMCALClusterizer ------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("ClusterizerRef", "-> Task //%s/Reconstructioner not found!", fTasksFolder->GetName()); - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - Fatal("ClusterizerRef", "-> //%s/Reconstructioner/EMCAL", fTasksFolder->GetName()); - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * clu = 0 ; - TString cluname(name) ; - cluname+=":clu-" ; - - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(cluname)){ - clu = task ; - break ; - } - } - - if(!clu) { - Fatal("ClusterizerRef", "-> task %s not found!", task->GetName()); - } - - return l->GetObjectRef(clu) ; -} - -//____________________________________________________________________________ - -const Bool_t AliEMCALGetter::PostClusterizer(const char * name) const -{ - // ------------------ AliEMCALClusterizer ------------------------ - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostClusterizer", "-> Task //%s/Reconstructioner not found!", fTasksFolder->GetName()); - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - - if ( !emcal ) { - if (fDebug) { - Warning("PostClusterizer", "-> //%s/Reconstructioner/EMCAL not found!", fTasksFolder); - Info("PostClusterizer", "-> Adding //%s/Reconstructioner/EMCAL", fTasksFolder); - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TString clun(name) ; - clun+=":clu" ; - TTask * task ; - - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - - if(taskname.BeginsWith(clun)) - return kTRUE ; - } - - AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ; - - clun+="-v1" ; - emcalcl->SetName(clun) ; - emcalcl->SetTitle(fHeaderFile) ; - emcal->Add(emcalcl) ; - - return kTRUE; -} - -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostTrackSegments", "-> Folder //%s/EMCAL/ not found", fRecoFolder->GetName()) ; - Info("PostTrackSegments", "-> Adding Folder //%s/EMCAL", fRecoFolder->GetName()) ; - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - TFolder * emcalTSFolder = dynamic_cast(emcalFolder->FindObject("TrackSegments")) ; - if ( !emcalTSFolder ) { - if (fDebug) { - Warning("PostTrackSegments", "-> Folder //%s/EMCAL/TrackSegments/ not found!", fRecoFolder->GetName() ) ; - Info("PostTrackSegments", "-> Adding Folder //%s/EMCAL/TrackSegments/", fRecoFolder->GetName()) ; - } - emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ; - } - - TObject * tss = emcalTSFolder->FindObject( name ) ; - if (!tss) { - TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; - ts->SetName(name) ; - emcalTSFolder->Add(ts) ; - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliEMCALGetter::TrackSegmentsRef(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - if ( !fRecoFolder ) { - Fatal("TrackSegmentsRef", "Folder //%s not found !", fRecoFolder->GetName() ) ; - } - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; - if ( !emcalFolder ) { - Fatal("TrackSegmentsRef", "Folder //%s/EMCAL/TrackSegments/ not found !", fRecoFolder->GetName() ) ; - } - - TObject * tss = emcalFolder->FindObject(name) ; - if (!tss) { - Fatal("TrackSegmentsRef", "object %s not found !", name) ; - } - return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; -} - -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const -{ //------------Track Segment Maker ------------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder) ; - Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder) ; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALTrackSegmentMaker * emcalts = - dynamic_cast(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ; - if (emcalts) { - emcalts->Delete() ; - emcal->GetListOfTasks()->Remove(emcalts) ; - } - emcal->Add(tsmaker) ; - return kTRUE; - -} -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const -{ //------------Track Segment Maker ------------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder->GetName() ) ; - Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder->GetName()) ; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TString tsn(name); - tsn+=":tsm" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(tsn)) - return kTRUE ; - } - - AliEMCALTrackSegmentMakerv1 * emcalts = new AliEMCALTrackSegmentMakerv1() ; - tsn+="-v1" ; - emcalts->SetName(tsn) ; - emcalts->SetTitle(fHeaderFile) ; - emcal->Add(emcalts) ; - return kTRUE; - -} - -//____________________________________________________________________________ -TObject** AliEMCALGetter::TSMakerRef(const char * name) const -{ //------------Track Segment Maker ------------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("TSMakerRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - Fatal("TSMakerRef", "//%s/Reconstructioner/EMCAL not found !", fTasksFolder->GetName() ) ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * tsm = 0 ; - TString tsmname(name) ; - tsmname+=":tsm" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(tsmname)){ - tsm = task ; - break ; - } - } - - if(!tsm) { - Fatal("TSMakerRef", "Task //%s/Reconstructioner/EMCAL/TrackSegmentMarker/%s not found !", fTasksFolder->GetName(), name) ; - } - - return l->GetObjectRef(tsm) ; - -} - -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostRecParticles(const char * name) const -{ // -------------------- RecParticles ------------------------ - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/RecParticles/name - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - Warning("PostRecParticles", "-> Folder //%s/EMCAL/ not found!", fRecoFolder->GetName()) ; - Info("PostRecParticles", "-> Adding Folder //%s/EMCAL/", fRecoFolder->GetName()) ; - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - TFolder * emcalRPaFolder = dynamic_cast(emcalFolder->FindObject("RecParticles")) ; - if ( !emcalRPaFolder ) { - if (fDebug) { - Warning("PostRecParticles", "-> Folder //%s/EMCAL/RecParticles/ not found!", fRecoFolder->GetName()) ; - Info("PostRecParticles", "-> Adding Folder //%s/EMCAL/RecParticles/", fRecoFolder->GetName()) ; - } - emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ; - } - - TObject * rps = emcalRPaFolder->FindObject( name ) ; - if ( !rps ) { - TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; - rp->SetName(name) ; - emcalRPaFolder->Add(rp) ; - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliEMCALGetter::RecParticlesRef(const char * name) const -{ // ---------------RecParticles ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - if ( !fRecoFolder ) { - Fatal("RecParticlesRef", "Folder//%s not found !", fRecoFolder->GetName() ) ; - } - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - if ( !emcalFolder ) { - Fatal("RecParticlesRef", "Folder //%s/EMCAL/RecParticles/ not found !", fRecoFolder->GetName() ) ; - } - - TObject * tss = emcalFolder->FindObject(name ) ; - if (!tss) { - Fatal("RecParticlesRef", "object %s not found !", name) ; - } - return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; -} - -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const -{ // ------------AliEMCAL PID ----------------------------- - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - Warning("PostPID", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder) ; - Info("PostPID", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder) ; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALPID * emcalpid = dynamic_cast(emcal->GetListOfTasks()->FindObject(pid->GetName())) ; - if (emcalpid) { - if (fDebug) - Info("PostPID", "-> Task %s qlready exists", pid->GetName()) ; - emcal->GetListOfTasks()->Remove(emcalpid) ; - } - - emcal->Add(pid) ; - return kTRUE; -} - -//____________________________________________________________________________ -const Bool_t AliEMCALGetter::PostPID(const char * name) const -{ - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - Warning("PostPID", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder->GetName()) ; - Info("PostPID", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder->GetName()) ; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TString pidname(name) ; - pidname+=":pid" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)) - return kTRUE ; - } - - AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ; - pidname+="-v1" ; - emcalpid->SetName(pidname) ; - emcalpid->SetTitle(fHeaderFile) ; - emcal->Add(emcalpid) ; - - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliEMCALGetter::PIDRef(const char * name) const -{ //------------PID ------------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("PIDRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - Fatal("PIDRef", "//%s/Reconstructioner/EMCAL not found !", fTasksFolder->GetName() ) ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * pid = 0 ; - TString pidname(name) ; - pidname+=":pid" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)){ - pid = task ; - break ; - } - } - - if(!pid) { - Fatal("PIDRef", "Task //%s/Reconstructioner/EMCAL/PID/%s not found !", fTasksFolder->GetName(), name) ; - } - - return l->GetObjectRef(pid) ; -} - -//____________________________________________________________________________ -TTree * AliEMCALGetter::TreeK(TString filename) -{ - // returns TreeK from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - - if (!file || !file->IsOpen()) // file not yet open - file = TFile::Open(filename.Data(), "read") ; - - if(filename != fHeaderFile ){ - fAlice = dynamic_cast(file->Get("gAlice")) ; - } - - TString treeName("TreeK") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - - if (!tree && fDebug) - Warning("TreeK", "-> %s not found in %s", treeName.Data(),filename.Data()); - - return tree ; -} - -//____________________________________________________________________________ - -TTree * AliEMCALGetter::TreeH(TString filename) -{ - // returns TreeH from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - - TString treeName("TreeH") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - - if (!tree && fDebug) - Warning("TreeH", "-> %s not found in %s", treeName.Data(), filename.Data()); - return tree ; -} - -//____________________________________________________________________________ - -TTree * AliEMCALGetter::TreeS(TString filename) -{ - // returns TreeS from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - - TString treeName("TreeS") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - - if (!tree && fDebug) - Warning("TreeS", "-> %s not found in %s", treeName.Data(), filename.Data()); - return tree ; -} - -//____________________________________________________________________________ - -TTree * AliEMCALGetter::TreeD(TString filename) -{ - // returns TreeD from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - - TString treeName("TreeD") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - - if (!tree && fDebug) - Warning("TreeD", "-> %s not found in %s", treeName.Data(), filename.Data()); - return tree ; -} - -//____________________________________________________________________________ - -const TParticle * AliEMCALGetter::Primary(Int_t index) const -{ - // Return primary particle numbered by - - if(index < 0) - return 0 ; - - TParticle * p = 0 ; - if (fAlice) - p = fAlice->Particle(index) ; - else - p = gAlice->Particle(index) ; - - return p ; -} - -//____________________________________________________________________________ - -const TParticle * AliEMCALGetter::Secondary(TParticle* p, Int_t index) const -{ - // Return first (index=1) or second (index=2) secondary particle of primary particle p - - if(index <= 0) - return 0 ; - if(index > 2) - return 0 ; - - if(p) { - Int_t daughterIndex = p->GetDaughter(index-1) ; - return gAlice->Particle(daughterIndex) ; - } - else - return 0 ; -} - -//____________________________________________________________________________ - -Int_t AliEMCALGetter::ReadTreeD(const Int_t event) -{ - // Read the digit tree gAlice->TreeD() - - TTree * treeD ; - if(fToSplit){ - TFile * file = static_cast(gROOT->GetFile(fDigitsFileName)); - if(!file) - file = TFile::Open(fDigitsFileName) ; - - // Get Digits Tree header from file - - TString treeName("TreeD") ; - treeName += event ; - treeD = dynamic_cast(file->Get(treeName.Data())); - - if(!treeD){ // TreeD not found in header file - if (fDebug) - Warning("ReadTreeD", "-> Cannot find TreeD in %s", fDigitsFileName.Data()); - return 1; - } - } - else - treeD = gAlice->TreeD() ; - - TObjArray * lob = static_cast(treeD->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * digitsbranch = 0 ; - TBranch * digitizerbranch = 0 ; - - Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalfound || !digitizerfound) ) { - if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitsbranch = branch ; - emcalfound = kTRUE ; - } - else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitizerbranch = branch ; - digitizerfound = kTRUE ; - } - } - - if ( !emcalfound || !digitizerfound ) { - if (fDebug) - Warning("ReadTreeD", "-> Cannot find Digits and/or Digitizer with name %s", fDigitsTitle.Data()); - return 2; - } - - //read digits - - if(!Digits(fDigitsTitle) ) - PostDigits(fDigitsTitle); - digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; - digitsbranch->GetEntry(0) ; - - // read the Digitizer - - RemoveTask("D", fDigitsTitle) ; // I do not understand why I need that - if(!Digitizer(fDigitsTitle)) - PostDigitizer(fDigitsTitle) ; - digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; - digitizerbranch->GetEntry(0) ; - - lob->Delete(); - - if(gAlice->TreeD()!=treeD) - treeD->Delete(); - - return 0 ; -} - -//____________________________________________________________________________ - -Int_t AliEMCALGetter::ReadTreeH() -{ - // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() - - TTree * treeH = gAlice->TreeH() ; - - if(!treeH) {// TreeH not found in header file - if (fDebug) - Warning("ReadTreeH", "-> Cannot find TreeH in %s", fHeaderFile.Data()); - - TString searchFileName("EMCAL.HITS") ; - if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){ - searchFileName+="." ; - searchFileName += fBranchTitle ; - } - - searchFileName+=".root" ; - - if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits - if (fDebug) - Info("ReadTreeH", "-> TreeH found in %s", searchFileName.Data()); - } else { - Error("ReadTreeH", "-> TreeH not found "); - return 1; - } - } - - TBranch * hitsbranch = static_cast(gAlice->TreeH()->GetBranch("EMCAL")) ; - - if ( !hitsbranch ) { - if (fDebug) - Warning("ReadTreeH", "-> Cannot find branch EMCAL"); - return 2; - } - - if(!Hits()) - PostHits() ; - - if (hitsbranch->GetEntries() > 1 ) { - (dynamic_cast (*HitsRef()))->Clear() ; - TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ; - TClonesArray * hits = dynamic_cast(*HitsRef()) ; - hitsbranch->SetAddress(&tempo) ; - - Int_t index = 0 ; - Int_t i = 0 ; - - for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { - hitsbranch->GetEntry(i) ; - Int_t j = 0 ; - for ( j = 0 ; j < tempo->GetEntries() ; j++) { - const AliEMCALHit * hit = static_cast(tempo->At(j)) ; - new((*hits)[index]) AliEMCALHit( *hit ) ; - index++ ; - } - } - delete tempo ; - } - else { - (dynamic_cast (*HitsRef()))->Clear() ; - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(0) ; - } - return 0 ; -} - -//____________________________________________________________________________ - -void AliEMCALGetter::Track(const Int_t itrack) -{ - // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() - if(gAlice->TreeH()== 0){ - Error("ReadTreeH", "-> Cannot read TreeH "); - return ; - } - - TBranch * hitsbranch = dynamic_cast(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; - - if ( !hitsbranch ) { - if (fDebug) - Warning("ReadTreeH", "-> Cannot find branch EMCAL"); - return ; - } - - if(!Hits()) - PostHits() ; - - (dynamic_cast (*HitsRef()))->Clear() ; - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(itrack) ; -} - -//____________________________________________________________________________ - -void AliEMCALGetter::ReadTreeQA() -{ - if (fDebug) - Warning("ReadTreeQA", "-> %s not implemented", ClassName()); -} - - - -//____________________________________________________________________________ - -Int_t AliEMCALGetter::ReadTreeR(const Int_t event) - -{ - // Read the reconstrunction tree gAlice->TreeR() - // A particularity has been introduced here : - // if gime->Event(ievent,"R") is called branches with the current title are read, the current title - // being for example give in AliEMCALPID(fileName, title) - // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any - // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given) - // from a given set of TrackSegments (with a given name) - // This is why any is NOT used to read the branch of RecParticles - // any migh have become obsolete : to be checked - // See AliEMCALPIDv1 - - //first - clean if necessary - if(ECALRecPoints(fRecPointsTitle)){ - ECALRecPoints(fRecPointsTitle)->Delete() ; - PRERecPoints(fRecPointsTitle)->Delete() ; - HCALRecPoints(fRecPointsTitle)->Delete() ; - } - //clear TrackSegments - if(TrackSegments(fTrackSegmentsTitle)) - TrackSegments(fTrackSegmentsTitle)->Clear() ; - - TTree * treeR ; - - if(fToSplit){ - TFile * file = static_cast(gROOT->GetFile(fRecPointsFileName)); - if(!file) - file = TFile::Open(fRecPointsFileName) ; - // Get Digits Tree header from file - - TString treeName("TreeR") ; - treeName += event ; - treeR = dynamic_cast(file->Get(treeName.Data())); - - if(!treeR){ // TreeR not found in header file - if (fDebug) - Warning("ReadTreeR", "-> Cannot find TreeR in %s", fRecPointsFileName.Data()); - return 1; - } - } - else - treeR = gAlice->TreeR() ; - - // RecPoints - - TObjArray * lob = static_cast(treeR->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * branchPRE = 0 ; - TBranch * branchEC = 0 ; - TBranch * branchHC = 0 ; - TBranch * clusterizerbranch = 0 ; - - Bool_t emcalPRERPfound = kFALSE, emcalECRPfound = kFALSE, emcalHCRPfound = kFALSE, clusterizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalPRERPfound || !emcalECRPfound || !emcalHCRPfound || !clusterizerfound) ) { - if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) { - if ( strcmp(branch->GetName(), "EMCALPRERP")==0) { - branchPRE = branch ; - emcalPRERPfound = kTRUE ; - } - else if ( strcmp(branch->GetName(), "EMCALECRP")==0) { - branchEC = branch ; - emcalECRPfound = kTRUE ; - } - else if ( strcmp(branch->GetName(), "EMCALHCRP")==0) { - branchHC = branch ; - emcalHCRPfound = kTRUE ; - } - else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){ - clusterizerbranch = branch ; - clusterizerfound = kTRUE ; - } - } - } - - if ( !emcalPRERPfound || !emcalECRPfound || !emcalHCRPfound || !clusterizerfound) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find RecPoints and/or Clusterizer with name %s", fRecPointsTitle.Data()); - } - else { - if(!ECALRecPoints(fRecPointsTitle) ) - PostRecPoints(fRecPointsTitle) ; - branchEC->SetAddress(ECRecPointsRef(fRecPointsTitle)) ; - branchEC->GetEntry(0) ; - - branchPRE->SetAddress(PRERecPointsRef(fRecPointsTitle)) ; - branchPRE->GetEntry(0) ; - - branchHC->SetAddress(HCRecPointsRef(fRecPointsTitle)) ; - branchHC->GetEntry(0) ; - - if(!Clusterizer(fRecPointsTitle) ) - PostClusterizer(fRecPointsTitle) ; - - clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; - clusterizerbranch->GetEntry(0) ; - } - - //------------------- TrackSegments --------------------- - next.Reset() ; - TBranch * tsbranch = 0 ; - TBranch * tsmakerbranch = 0 ; - Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ; - while ( (branch = static_cast(next())) && (!emcaltsfound || !tsmakerfound) ) { - if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) { - if ( strcmp(branch->GetName(), "EMCALTS")==0){ - tsbranch = branch ; - emcaltsfound = kTRUE ; - } - else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) { - tsmakerbranch = branch ; - tsmakerfound = kTRUE ; - } - } - } - - if ( !emcaltsfound || !tsmakerfound ) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find TrackSegments and/or TrackSegmentMaker with name %s", fTrackSegmentsTitle.Data() ) ; - } else { - // Read and Post the TrackSegments - if(!TrackSegments(fTrackSegmentsTitle)) - PostTrackSegments(fTrackSegmentsTitle) ; - tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; - tsbranch->GetEntry(0) ; - - // Read and Post the TrackSegment Maker - if(!TrackSegmentMaker(fTrackSegmentsTitle)) - PostTrackSegmentMaker(fTrackSegmentsTitle) ; - tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; - tsmakerbranch->GetEntry(0) ; - } - //------------ RecParticles ---------------------------- - next.Reset() ; - TBranch * rpabranch = 0 ; - TBranch * pidbranch = 0 ; - Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalrpafound || !pidfound) ) - if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { - if ( strcmp(branch->GetName(), "EMCALRP")==0) { - rpabranch = branch ; - emcalrpafound = kTRUE ; - } - else if (strcmp(branch->GetName(), "AliEMCALPID")==0) { - pidbranch = branch ; - pidfound = kTRUE ; - } - } - - if ( !emcalrpafound || !pidfound ) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find RecParticles and/or PID with name %s", fRecParticlesTitle.Data() ) ; - } else { - // Read and Post the RecParticles - if(!RecParticles(fRecParticlesTitle)) - PostRecParticles(fRecParticlesTitle) ; - rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; - rpabranch->GetEntry(0) ; - // Read and Post the PID - if(!PID(fRecParticlesTitle)) - PostPID(fRecParticlesTitle) ; - pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; - pidbranch->GetEntry(0) ; - } - - if(gAlice->TreeR()!=treeR) - treeR->Delete(); - return 0 ; -} - -//____________________________________________________________________________ - -Int_t AliEMCALGetter::ReadTreeS(const Int_t event) -{ - // Reads the SDigits treeS from all files - // Files, which should be opened are listed in emcalF - // So, first get list of files - - TFolder * emcalF = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - - if (!emcalF) - emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - - TCollection * folderslist = emcalF->GetListOfFolders() ; - - // Now iterate over the list of files and read TreeS into Whiteboard - - TIter next(folderslist) ; - TFolder * folder = 0 ; - TFile * file; - TTree * treeS = 0; - - while ( (folder = static_cast(next())) ) { - TString fileName("") ; - if(fToSplit) - fileName = folder->GetTitle() ; - else - fileName = folder->GetName() ; - - fileName.ReplaceAll("_","/") ; - file = static_cast(gROOT->GetFile(fileName)); - - if(!file) - file = TFile::Open(fileName) ; - - // Get SDigits Tree header from file - - TString treeName("TreeS") ; - treeName += event ; - treeS = dynamic_cast(file->Get(treeName.Data())); - - if(!treeS){ // TreeS not found in header file - if (fDebug) - Warning("ReadTreeS", "-> Cannot find TreeS in %s", fileName.Data()); - return 1; - } - - //set address of the SDigits and SDigitizer - - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = static_cast(treeS->GetListOfBranches()) ; - TIter next(lob) ; - - Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalfound || !sdigitizerfound) ) { - if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - emcalfound = kTRUE ; - sdigitsBranch = branch ; - } - else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && - (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; - } - } - if ( !emcalfound || !sdigitizerfound ) { - if (fDebug) - Warning("ReadSDigits", "-> Digits and/or Digitizer branch with name %s not found", GetName()); - return 2; - } - - if ( !folder->FindObject(fSDigitsTitle) ) - PostSDigits(fSDigitsTitle,folder->GetName()) ; - - ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ; - - sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(fSDigitsTitle) ; - sdname+=":" ; - sdname+=folder->GetName() ; - - if(!SDigitizer(sdname) ) - PostSDigitizer(fSDigitsTitle,folder->GetName()) ; - - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - - if(gAlice->TreeS()!=treeS) - treeS->Delete(); - } - return 0 ; -} - -//____________________________________________________________________________ - -void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input) -{ - // Read the summable digits fron treeS() - - TString filename("mergefile") ; - filename+= input ; - - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - } - - TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ; - - //set address of the SDigits and SDigitizer - - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; - TIter next(lob) ; - - Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) { - if ( strcmp(branch->GetName(), "EMCAL")==0) { - emcalfound = kTRUE ; - sdigitsBranch = branch ; - } - else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; - } - } - - if ( !emcalfound || !sdigitizerfound ) { - if (fDebug) - Warning("ReadTreeS", "-> Digits and/or Digitizer branch not found"); - return ; - } - - if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) - PostSDigits(sdigitsBranch->GetTitle(),filename) ; - - sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(sdigitsBranch->GetTitle()) ; - sdname+=":" ; - sdname+=filename ; - - if(!SDigitizer(sdigitsBranch->GetTitle()) ) - PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; - - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - - if(gAlice->TreeS()!=treeS) - treeS->Delete(); -} + TBranch * emcalbranch = dynamic_cast(TreeH()->GetBranch("EMCAL")) ; + emcalbranch->SetAddress(&hits) ; + emcalbranch->GetEntry(itrack) ; +} //____________________________________________________________________________ - -void AliEMCALGetter::ReadPrimaries() +TTree * AliEMCALGetter::TreeD() const { - - // Reads specific branches of primaries - - TClonesArray * ar = 0 ; - - if(! (ar = Primaries()) ) { - PostPrimaries() ; - ar = Primaries() ; - } - - ar->Delete() ; - - if (TreeK(fHeaderFile)) { // treeK found in header file - if (fDebug) - Info("ReadPrimaries", "-> TreeK found in %s", fHeaderFile.Data()); - fNPrimaries = gAlice->GetNtrack() ; - fAlice = 0 ; + TTree * rv = 0 ; + rv = EmcalLoader()->TreeD() ; + if ( !rv ) { + EmcalLoader()->MakeTree("D"); + rv = EmcalLoader()->TreeD() ; } - else { // treeK not found in header file - Error("ReadPrimaries", "-> TreeK not found "); - return ; - } - - Int_t index = 0 ; - - for (index = 0 ; index < fNPrimaries; index++) { - new ((*ar)[index]) TParticle(*(Primary(index))); - } + + return rv ; } //____________________________________________________________________________ - -void AliEMCALGetter::Event(const Int_t event, const char* opt) +TTree * AliEMCALGetter::TreeH() const { - // Reads the content of all Tree's S, D and R - - if (event >= gAlice->TreeE()->GetEntries() ) { - Error("Event", "-> %d not found in TreeE!", event); - return ; - } - - Bool_t any = kFALSE ; - - if (strstr(opt,"A") ) // do not check the title of the branches - any = kTRUE; - - gAlice->GetEvent(event) ; - - if( strstr(opt,"R") ) - ReadTreeR(event) ; - - if( strstr(opt,"D") ) - ReadTreeD(event) ; - - if(strstr(opt,"S") ) - ReadTreeS(event) ; - - if(strstr(opt,"H") ) - ReadTreeH() ; - - if( strstr(opt,"Q") ) - ReadTreeQA() ; - - if( strstr(opt,"P") ) - ReadPrimaries() ; + TTree * rv = 0 ; + rv = EmcalLoader()->TreeH() ; + if ( !rv ) { + EmcalLoader()->MakeTree("H"); + rv = EmcalLoader()->TreeH() ; + } + + return rv ; } //____________________________________________________________________________ - -TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const +TTree * AliEMCALGetter::TreeR() const { - // get the object named "what" from the folder - // folders are named like //Folders - - if ( file.IsNull() ) - file = fHeaderFile ; - - TFolder * folder = 0 ; - TObject * emcalO = 0 ; - - if ( what.CompareTo("Primaries") == 0 ) { - folder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; - if (folder) - emcalO = dynamic_cast(folder->FindObject("Primaries")) ; - else - return 0 ; - } - else if ( what.CompareTo("Hits") == 0 ) { - folder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if (folder) - emcalO = dynamic_cast(folder->FindObject("Hits")) ; - } - else if ( what.CompareTo("SDigits") == 0 ) { - file.ReplaceAll("/","_") ; - TString path = "EMCAL/" + file ; - folder = dynamic_cast(fSDigitsFolder->FindObject(path.Data())) ; - if (folder) { - if (name.IsNull()) - name = fSDigitsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("Digits") == 0 ){ - folder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - if (folder) { - if (name.IsNull()) - name = fDigitsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("PRERecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/PRERecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("ECALRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/ECRecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("HCALRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/HCRecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("TrackSegments") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; - if (folder) { - if (name.IsNull()) - name = fTrackSegmentsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("RecParticles") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - if (folder) { - if (name.IsNull()) - name = fRecParticlesTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - if (!emcalO) { - if(fDebug) - Warning("ReturnO", "-> Object %s not found in %s", what.Data(), folder->GetName()); - return 0 ; - } - - return emcalO ; + TTree * rv = 0 ; + rv = EmcalLoader()->TreeR() ; + if ( !rv ) { + EmcalLoader()->MakeTree("R"); + rv = EmcalLoader()->TreeR() ; + } + + return rv ; } //____________________________________________________________________________ - -const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const +TTree * AliEMCALGetter::TreeT() const { - // get the TTask named "what" from the folder - // folders are named like //Folders/Tasks/what/EMCAL/name - - TString search(what) ; - if ( what.CompareTo("Clusterizer") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("TrackSegmentMaker") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("PID") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("QATasks") == 0 ) - search = "QA" ; - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject(search)) ; - - if (!tasks) { - Error("AliReturnT", "-> Task %s not found!", what.Data()); - return 0 ; - } - - TTask * emcalT = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - - if (!emcalT) { - Error("ReturnT", "-> Task %s/EMCAL not found!", what.Data()); - return 0 ; - } - - TList * list = emcalT->GetListOfTasks() ; - - if (what.CompareTo("SDigitizer") == 0) { - if ( name.IsNull() ) - name = fSDigitsTitle ; - } - else if (what.CompareTo("Digitizer") == 0){ - if ( name.IsNull() ) - name = fDigitsTitle ; - } - else if (what.CompareTo("Clusterizer") == 0){ - if ( name.IsNull() ) - name = fRecPointsTitle ; - name.Append(":clu") ; - } - else if (what.CompareTo("TrackSegmentMaker") == 0){ - if ( name.IsNull() ) - name = fTrackSegmentsTitle ; - name.Append(":tsm") ; - } - else if (what.CompareTo("PID") == 0){ - if ( name.IsNull() ) - name = fRecParticlesTitle ; - name.Append(":pid") ; - } - TIter it(list) ; - TTask * task = 0 ; - - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(name)){ - return task ;} - } + TTree * rv = 0 ; + rv = EmcalLoader()->TreeT() ; + if ( !rv ) { + EmcalLoader()->MakeTree("T"); + rv = EmcalLoader()->TreeT() ; + } - if(fDebug) - Warning("ReturnT", "-> Task %s/%s not found!", search.Data(), name.Data()); - return 0 ; + return rv ; } - //____________________________________________________________________________ - -void AliEMCALGetter::RemoveTask(TString opt, TString name) const - +TTree * AliEMCALGetter::TreeP() const { - // remove a task from the folder - // path is fTasksFolder/SDigitizer/EMCAL/name - - TTask * task = 0 ; - TTask * emcal = 0 ; - TList * lofTasks = 0 ; - - if (opt == "S") { // SDigitizer - task = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if (!task) - return ; + TTree * rv = 0 ; + rv = EmcalLoader()->TreeP() ; + if ( !rv ) { + EmcalLoader()->MakeTree("P"); + rv = EmcalLoader()->TreeP() ; } - else if (opt == "D") { // Digitizer - task = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if (!task) - return ; - } - else if (opt == "C" || opt == "T" ) { // Clusterizer, TrackSegmentMaker - task = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - if (!task) - return ; - } - else { - Warning("RemoveTask", "-> Unknown option %s"); - return ; - } - - emcal = dynamic_cast(task->GetListOfTasks()->FindObject("EMCAL")) ; - - if (!emcal) - return ; - - lofTasks = emcal->GetListOfTasks() ; - - if (!lofTasks) - return ; - - TObject * obj = lofTasks->FindObject(name) ; - if (obj) - - lofTasks->Remove(obj) ; + + return rv ; } //____________________________________________________________________________ - -void AliEMCALGetter::RemoveObjects(TString opt, TString name) const +TTree * AliEMCALGetter::TreeS() const { - // remove SDigits from the folder - // path is fSDigitsFolder/fHeaderFileName/name - - TFolder * emcal = 0 ; - TFolder * emcalmain = 0 ; - - if (opt == "H") { // Hits - emcal = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if (!emcal) - return ; - name = "Hits" ; - } - else if ( opt == "S") { // SDigits - emcalmain = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if (!emcalmain) - return ; - emcal = dynamic_cast(emcalmain->FindObject(fHeaderFile)) ; - if (!emcal) - return ; - } - else if (opt == "D") { // Digits - emcal = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - if (!emcal) - return ; - } - else if (opt == "RT") { // Tower RecPoints - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; - if (!emcal) - return ; - } - else if (opt == "RP") { // Preshower RecPoints - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ; - if (!emcal) - return ; - } - else if (opt == "T") { // TrackSegments - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; - if (!emcal) - return ; - } - else if (opt == "P") { // RecParticles - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - if (!emcal) - return ; - } - else { - Warning("RemoveObjects", "-> Unknown option %s", opt.Data()); - return ; - } - - TObjArray * ar = dynamic_cast(emcal->FindObject(name)) ; - - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - - if (opt == "S") - emcalmain->Remove(emcal) ; + TTree * rv = 0 ; + rv = EmcalLoader()->TreeS() ; + if ( !rv ) { + EmcalLoader()->MakeTree("S"); + rv = EmcalLoader()->TreeS() ; + } + + return rv ; } //____________________________________________________________________________ - -void AliEMCALGetter::RemoveSDigits() const +Bool_t AliEMCALGetter::VersionExists(TString & opt) const { - TFolder * emcal= dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - - if (!emcal) - return ; - - emcal->SetOwner() ; - emcal->Clear() ; -} - -//____________________________________________________________________________ - -void AliEMCALGetter::CleanWhiteBoard(void){ - - TFolder * emcalmain = 0 ; - TFolder * emcal ; - TObjArray * ar ; - TList * lofTasks = 0 ; - TTask * task = 0 ; - TTask * emcalt = 0 ; - - // Hits - - emcal = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - - if (emcal){ - TObjArray * ar = dynamic_cast(emcal->FindObject("Hits")) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - // SDigits - - emcalmain = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - - if (emcalmain){ - emcal = dynamic_cast(emcalmain->FindObject(fHeaderFile)) ; - if (emcal) { - ar = dynamic_cast(emcal->FindObject(fSDigitsTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - emcalmain->Remove(emcal) ; - } - - // Digits - - emcal = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - - if (emcal){ - ar = dynamic_cast(emcal->FindObject(fDigitsTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - // TowerRecPoints - - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; - - if (emcal){ - ar = dynamic_cast(emcal->FindObject(fRecPointsTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } + // checks if the version with the present name already exists in the same directory - // PreShowerRecPoints - - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ; - - if (emcal){ - ar = dynamic_cast(emcal->FindObject(fRecPointsTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - // TrackSegments - - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; + Bool_t rv = kFALSE ; + + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + TString version( rl->GetEventFolder()->GetName() ) ; - if (emcal) { - ar = dynamic_cast(emcal->FindObject(fTrackSegmentsTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; + opt.ToLower() ; + + if ( opt == "sdigits") { + // add the version name to the root file name + TString fileName( EmcalLoader()->GetSDigitsFileName() ) ; + if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } + EmcalLoader()->SetSDigitsFileName(fileName) ; } - // RecParticles - - emcal = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - - if (emcal){ - ar = dynamic_cast(emcal->FindObject(fRecParticlesTitle)) ; - if (ar) { - emcal->Remove(ar) ; - ar->Delete() ; - delete ar ; + if ( opt == "digits") { + // add the version name to the root file name + TString fileName( EmcalLoader()->GetDigitsFileName() ) ; + if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } + EmcalLoader()->SetDigitsFileName(fileName) ; } - //---- Now Tasks ----------- - - TObject * obj ; - TString sdname(fSDigitsTitle); - - // Digitizer - - task = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if (task){ - emcalt = dynamic_cast(task->GetListOfTasks()->FindObject("EMCAL")) ; - if (emcalt){ - lofTasks = emcalt->GetListOfTasks() ; - if (lofTasks){ - obj = lofTasks->FindObject(sdname.Data()) ; - if (obj) - lofTasks->Remove(obj) ; - } - } - } - - sdname.Append(":") ; - - // Clusterizer, TrackSegmentMaker, PID - - task = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if (task){ - emcalt = dynamic_cast(task->GetListOfTasks()->FindObject("EMCAL")) ; - if (emcalt){ - lofTasks = emcalt->GetListOfTasks() ; - TIter next(lofTasks); - while((obj=next())){ - TString oname(obj->GetName()) ; - if (oname.BeginsWith(sdname)){ - lofTasks->Remove(obj) ; - } - } - } - } - - // SDigitizer - - sdname.Append(fHeaderFile) ; - task = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; + return rv ; - if (task) { - emcalt = dynamic_cast(task->GetListOfTasks()->FindObject("EMCAL")) ; - if (emcalt){ - lofTasks = emcalt->GetListOfTasks() ; - if (lofTasks){ - obj = lofTasks->FindObject(sdname.Data()) ; - if (obj) - lofTasks->Remove(obj) ; - } - } - } } //____________________________________________________________________________ - -void AliEMCALGetter::SetTitle(const char * branchTitle ) - +UShort_t AliEMCALGetter::EventPattern(void) const { - fBranchTitle = branchTitle ; - fSDigitsTitle = branchTitle ; - fDigitsTitle = branchTitle ; - fRecPointsTitle = branchTitle ; - fRecParticlesTitle = branchTitle ; - fTrackSegmentsTitle = branchTitle ; - - if(fToSplit){ - - //First - extract full path if necessary - - TString sFileName(fHeaderFile) ; - Ssiz_t islash = sFileName.Last('/') ; - - if(islash(fHitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) - emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; - - emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) - emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - - //Make folder for SDigits - - TString subdir(fHeaderFile) ; - subdir.ReplaceAll("/","_") ; - - emcalFolder->AddFolder(subdir, fSDigitsFileName.Data()); - emcalFolder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) - emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; - - emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; + // Return the pattern (trigger bit register) of the beam-test event +// if(fBTE) +// return fBTE->GetPattern() ; +// else + return 0 ; } - //____________________________________________________________________________ - -void AliEMCALGetter::CloseSplitFiles(void){ - - TFile * file ; - file = static_cast(gROOT->GetFile(fSDigitsFileName.Data() ) ) ; - - if(file) - file->Close() ; - - file = static_cast(gROOT->GetFile(fDigitsFileName.Data() ) ) ; - - if(file) - file->Close() ; - - file = static_cast(gROOT->GetFile(fRecPointsFileName.Data() ) ) ; - - if(file) - file->Close() ; - - file = static_cast(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ; - - if(file) - file->Close() ; - - file = static_cast(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ; - - if(file) - file->Close() ; +Float_t AliEMCALGetter::BeamEnergy(void) const +{ + // Return the beam energy of the beam-test event +// if(fBTE) +// return fBTE->GetBeamEnergy() ; +// else + return 0 ; } - - - - - - diff --git a/EMCAL/AliEMCALGetter.h b/EMCAL/AliEMCALGetter.h index eb2f38bf099..affa9232668 100644 --- a/EMCAL/AliEMCALGetter.h +++ b/EMCAL/AliEMCALGetter.h @@ -2,8 +2,10 @@ #define ALIEMCALGETTER_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ + /* $Id$ */ -//________________________________________________________________________ + +//_________________________________________________________________________ // A singleton that returns various objects // Should be used on the analysis stage to avoid confusing between different // branches of reconstruction tree: e.g. reading RecPoints and TS made from @@ -13,240 +15,226 @@ //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) // -// Modif: -// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction -// of new IO (à la PHOS) - + // --- ROOT system --- -#include "TClonesArray.h" -#include "TFolder.h" -#include "TTree.h" -#include "TFile.h" -class TString ; -class TParticle ; -class TTask ; +#include "TObject.h" +#include "TClonesArray.h" +// #include "TFolder.h" +// #include "TTree.h" +// #include "TFile.h" +// class TString ; + class TParticle ; +// class TTask ; // --- Standard library --- -#include // --- AliRoot header files --- -#include "AliRun.h" -#include "AliEMCAL.h" -#include "AliEMCALHit.h" -#include "AliEMCALDigit.h" -#include "AliEMCALTowerRecPoint.h" +#include "AliConfig.h" + +// #include "AliRun.h" +class AliEMCAL ; +#include "AliEMCALHit.h" +// #include "AliEMCALDigit.h" +// #include "AliEMCALRecPoint.h" +// #include "AliEMCALRecPoint.h" +// #include "AliEMCALTrackSegment.h" +// #include "AliEMCALRecParticle.h" class AliEMCALGeometry ; -#include "AliEMCALDigitizer.h" -#include "AliEMCALSDigitizer.h" -class AliEMCALClusterizer ; -#include "AliEMCALTrackSegment.h" -class AliEMCALTrackSegmentMaker ; -#include "AliEMCALRecParticle.h" -class AliEMCALPID ; +#include "AliEMCALDigitizer.h" +#include "AliEMCALSDigitizer.h" +// class AliEMCALClusterizer ; +// class AliEMCALTrackSegmentMaker ; +// class AliEMCALPID ; +// //class AliEMCALCalibrationDB ; +// class AliEMCALConTableDB ; +class AliEMCALBeamTestEvent ; + +#include "AliEMCALLoader.h" class AliEMCALGetter : public TObject { - public: - - AliEMCALGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public - Fatal("ctor", "singleton: default ctor not callable") ; + public: + AliEMCALGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public + Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ; } AliEMCALGetter(const AliEMCALGetter & obj) { // cpy ctor requested by Coding Convention - // but not yet needed - Fatal("cpy ctor", "not implemented") ; + Fatal("cpy ctor", "not implemented") ; } AliEMCALGetter & operator = (const AliEMCALGetter & ) { // assignement operator requested by coding convention, but not needed - Fatal("operator =", "not implemented") ; + Fatal("operator =", "not implemented") ; return *this ; } virtual ~AliEMCALGetter() ; - //=========== Instantiators ================ - static AliEMCALGetter * GetInstance(const char* headerFile, - const char* branchTitle = "Default", - const Bool_t toSplit = kFALSE ) ; - static AliEMCALGetter * GetInstance() ; - - //=========== General information about run ============== - const Int_t MaxEvent() const { return static_cast(gAlice->TreeE()->GetEntries()) ; } - const Int_t EventNumber() const { return static_cast(gAlice->GetEvNumber()) ; } - const Bool_t BranchExists(const TString recName) const ; - - //========== EMCALGeometry and EMCAL ============= - const AliEMCAL * EMCAL() ; - AliEMCALGeometry * EMCALGeometry() ; - - //========== Methods to read somethig from file ========== + //=========== Instantiators ================ + static AliEMCALGetter * Instance(const char* headerFile, + const char* version = AliConfig::fgkDefaultEventFolderName, + Option_t * openingOption = "READ" ) ; + static AliEMCALGetter * Instance() ; + + static void Print() ; + +// //=========== General information about run ============== + Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; } + void SetLoaded(const TString tree) { fLoadingStatus += tree ; } + + Int_t MaxEvent() const ; + Int_t EventNumber() const ; + Bool_t VersionExists(TString & opt) const ; + UShort_t EventPattern(void) const ; + Float_t BeamEnergy(void) const ; + +// //========== EMCALGeometry and EMCAL ============= + AliEMCAL * EMCAL() const ; + AliEMCALGeometry * EMCALGeometry() const ; + +// //========== Methods to read something from file ========== void Event(const Int_t event, const char * opt = "HSDRP") ; void Track(const Int_t itrack) ; - void ReadTreeS(TTree * treeS,Int_t input) ; //Method to be used when - //digitizing is under the conytrol of AliRunDigitizer, - //which opens all files etc. - //-----------------now getter's data-------------------------------------- + +// //-----------------now getter's data-------------------------------------- +// // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } +// // void ReadCalibrationDB(const char * name, const char * filename) ; //=========== Primaries ============ - TTree * TreeK(TString filename="") ; - TClonesArray * Primaries(void) const { return dynamic_cast(ReturnO("Primaries")) ; } - const TParticle * Primary(Int_t index) const; - const Int_t NPrimaries()const { return fNPrimaries; } - const TParticle * Secondary(TParticle * p, Int_t index=1) const ; - - //=========== Hits ================= - TTree * TreeH(TString filename="") ; - const TClonesArray * Hits(void) { return dynamic_cast(ReturnO("Hits")) ; } - const AliEMCALHit * Hit(Int_t index) { return dynamic_cast(Hits()->At(index) );} - +// TTree * TreeK(TString filename="") ; + TClonesArray * Primaries(void) ; + TParticle * Primary(Int_t index) const ; + Int_t NPrimaries()const { return fNPrimaries; } + TParticle * Secondary(const TParticle * p, const Int_t index=1) const ; + +// //=========== Hits ================= +// TTree * TreeH(TString filename="") ; + TClonesArray * Hits(void) ; + AliEMCALHit * Hit(const Int_t index) { return dynamic_cast(Hits()->At(index) );} + TTree * TreeH() const ; + //=========== SDigits ============== - TTree * TreeS(TString filename="") ; - TClonesArray * SDigits(const char * name = 0, const char * file=0) { - return dynamic_cast(ReturnO("SDigits", name, file)) ; } - const AliEMCALDigit * SDigit(Int_t index) { return static_cast(SDigits()->At(index)) ;} - const AliEMCALSDigitizer * SDigitizer(const char * name =0) const { - return (const AliEMCALSDigitizer*)(ReturnT("SDigitizer", name)) ; // here static or dynamic cast does not work ! why ? - } - + TClonesArray * SDigits() ; + AliEMCALDigit * SDigit(const Int_t index) { return static_cast(SDigits()->At(index)) ;} + TTree * TreeS() const ; + AliEMCALSDigitizer * SDigitizer() ; + + TString GetSDigitsFileName() { return EmcalLoader()->GetSDigitsFileName() ; } + Int_t LoadSDigits(Option_t* opt="") { return EmcalLoader()->LoadSDigits(opt) ; } + Int_t LoadSDigitizer(Option_t* opt=""){ return EmcalLoader()->LoadSDigitizer(opt) ; } + Int_t WriteSDigits(Option_t* opt="") { return EmcalLoader()->WriteSDigits(opt) ; } + Int_t WriteSDigitizer(Option_t* opt=""){ + return EmcalLoader()->WriteSDigitizer(opt) ; } + //========== Digits ================ - TTree * TreeD(TString filename="") ; - TClonesArray * Digits(const char * name = 0)const { - return dynamic_cast(ReturnO("Digits", name)) ; } - const AliEMCALDigit * Digit(Int_t index) { return static_cast(Digits()->At(index)) ;} - const AliEMCALDigitizer * Digitizer(const char * name =0) const { - return (const AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; } - + TClonesArray * Digits() ; + AliEMCALDigit * Digit(const Int_t index) { return static_cast(Digits()->At(index)) ;} + TTree * TreeD() const ; + AliEMCALDigitizer * Digitizer() ; + TString GetDigitsFileName() { return EmcalLoader()->GetDigitsFileName() ; } + Int_t LoadDigits(Option_t* opt="") { return EmcalLoader()->LoadDigits(opt) ; } + Int_t LoadDigitizer(Option_t* opt=""){ + return EmcalLoader()->LoadDigitizer(opt) ; } + Int_t WriteDigits(Option_t* opt="") { return EmcalLoader()->WriteDigits(opt) ; } + Int_t WriteDigitizer(Option_t* opt=""){ + return EmcalLoader()->WriteDigitizer(opt) ; } + //========== RecPoints ============= - TObjArray * PRERecPoints(const char * name = 0) const { - return (dynamic_cast(ReturnO("PRERecPoints", name))) ; } - const AliEMCALRecPoint * PRERecPoint(Int_t index) { return static_cast(PRERecPoints()->At(index)) ;} - TObjArray * ECALRecPoints(const char * name = 0) const { - return (dynamic_cast(ReturnO("ECALRecPoints", name))) ; } - const AliEMCALTowerRecPoint * ECALRecPoint(Int_t index) { return static_cast(ECALRecPoints()->At(index)) ;} - TObjArray * HCALRecPoints(const char * name = 0) const { - return (dynamic_cast(ReturnO("HCALRecPoints", name))) ; } - const AliEMCALTowerRecPoint * HCALRecPoint(Int_t index) { return static_cast(HCALRecPoints()->At(index)) ;} - - const AliEMCALClusterizer * Clusterizer (const char * name =0) const { - return (const AliEMCALClusterizer*)(ReturnT("Clusterizer", name)) ;// here static or dynamic cast does not work ! why ? - } - - //========== TrackSegments ============= - TClonesArray * TrackSegments(const char * name = 0) const { - return static_cast(ReturnO("TrackSegments", name)) ; } - const AliEMCALTrackSegment * TrackSegment(Int_t index) { return static_cast(TrackSegments()->At(index)) ;} - - const AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const { - return (const AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;// here static or dynamic cast does not work ! why ? - } - + TObjArray * PRERecPoints() ; + AliEMCALRecPoint * PRERecPoint(const Int_t index) { return static_cast(PRERecPoints()->At(index)) ;} + TObjArray * ECARecPoints() ; + AliEMCALTowerRecPoint * ECARecPoint(const Int_t index) { return static_cast(ECARecPoints()->At(index)) ;} + TObjArray * HCARecPoints() ; + AliEMCALTowerRecPoint * HCARecPoint(const Int_t index) { return static_cast(HCARecPoints()->At(index)) ;} + TTree * TreeR() const ; + AliEMCALClusterizer * Clusterizer() ; + TString GetRecPointsFileName() { return EmcalLoader()->GetRecPointsFileName() ; } + Int_t LoadRecPoints(Option_t* opt="") { return EmcalLoader()->LoadRecPoints(opt) ; } + Int_t LoadClusterizer(Option_t* opt=""){ + return EmcalLoader()->LoadClusterizer(opt) ; } + Int_t WriteRecPoints(Option_t* opt="") { return EmcalLoader()->WriteRecPoints(opt) ; } + Int_t WriteClusterizer(Option_t* opt=""){ + return EmcalLoader()->WriteClusterizer(opt) ; } + + //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { + TClonesArray * TrackSegments() ; + AliEMCALTrackSegment * TrackSegments(const Int_t index) { return static_cast(TrackSegments()->At(index)) ;} + TTree * TreeT() const ; + AliEMCALTrackSegmentMaker * TrackSegmentMaker() ; + TString GetTracksFileName() { return EmcalLoader()->GetTracksFileName() ; } + Int_t LoadTracks(Option_t* opt="") { return EmcalLoader()->LoadTracks(opt) ; } + Int_t LoadTrackSegementMaker(Option_t* opt=""){ + return EmcalLoader()->LoadTrackSegmentMaker(opt) ; } + Int_t WriteTracks(Option_t* opt="") { return EmcalLoader()->WriteTracks(opt) ; } + Int_t WriteTrackSegmentMaker(Option_t* opt=""){ + return EmcalLoader()->WriteTracker(opt) ; } //========== RecParticles =========== - TClonesArray * RecParticles(const char * name = 0) { - return static_cast(ReturnO("RecParticles", name)) ; } - const AliEMCALPID * PID(const char * name =0) const { - return (const AliEMCALPID*)(ReturnT("PID", name)) ; } // here static or dynamic cast does not work ! why ? - - //-----------------Auxiliary methods: cleaners----------------- - void RemoveTask(TString opt, TString name) const ; - void RemoveObjects(TString opt, TString name) const ; - void RemoveSDigits() const ; - - //-----------------Auxiliary methods: miscellana----------------- - void CloseFile() ; - const TFolder * Folder(const TString what) const ; - const Bool_t HasFailed(void) const {return fFailed ;} - void ListBranches(Int_t event=0) const ; - void NewBranch(TString name, Int_t event = 0) ; - Bool_t NewFile(TString name) ; - TFolder * SDigitsFolder() { return dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; } - void SetDebug(Int_t level) {fDebug = level;} // Set debug level - void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; } - - //------------Auxiliary methods: Posters-------------------- - const Bool_t PostPrimaries(void ) const ; - const Bool_t PostHits(void ) const ; - const Bool_t PostSDigits( const char * name, const char * file = 0) const ; - const Bool_t PostDigits( const char * name ) const ; - const Bool_t PostRecPoints( const char * name ) const ; - const Bool_t PostTrackSegments(const char * name) const ; - const Bool_t PostRecParticles( const char * name) const ; - const Bool_t PostClusterizer( const char * name) const ; - const Bool_t PostClusterizer(AliEMCALClusterizer * clu) const ; - const Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ; - const Bool_t PostSDigitizer ( const char * name, const char * file ) const ; - const Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ; - const Bool_t PostDigitizer ( const char * name) const ; - const Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ; - const Bool_t PostTrackSegmentMaker(const char * name ) const ; - const Bool_t PostPID (AliEMCALPID * pid) const ; - const Bool_t PostPID (const char * name ) const ; + TClonesArray * RecParticles() ; + AliEMCALRecParticle * RecPaticles(const Int_t index) { return static_cast(RecParticles()->At(index)) ;} + TTree * TreeP() const ; + AliEMCALPID * PID() ; + TString GetRecParticlesFileName() { return EmcalLoader()->GetRecParticlesFileName() ; } + Int_t LoadRecParticles(Option_t* opt="") { return EmcalLoader()->LoadRecParticles(opt) ; } + Int_t LoadPID(Option_t* opt=""){ + return EmcalLoader()->LoadPID(opt) ; } + Int_t WriteRecParticles(Option_t* opt="") { return EmcalLoader()->WriteRecParticles(opt) ; } + Int_t WritePID(Option_t* opt=""){ + return EmcalLoader()->WritePID(opt) ; } + + + void SetDebug(Int_t level) {fgDebug = level;} // Set debug level + void PostClusterizer(AliEMCALClusterizer * clu) + const{EmcalLoader()->PostClusterizer(clu) ; } + void PostPID(AliEMCALPID * pid) + const{EmcalLoader()->PostPID(pid) ; } + void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr) + const{EmcalLoader()->PostTrackSegmentMaker(tr) ; } + void PostSDigitizer (AliEMCALSDigitizer * sdigitizer) + const {EmcalLoader()->PostSDigitizer(sdigitizer);} + void PostDigitizer (AliEMCALDigitizer * digitizer) + const {EmcalLoader()->PostDigitizer(dynamic_cast(digitizer));} + + TString Version() const { return EmcalLoader()->GetTitle() ; } + AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader ; } + private: + + AliEMCALGetter(const char* headerFile, + const char* version = AliConfig::fgkDefaultEventFolderName, + Option_t * openingOption = "READ") ; - AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Bool_t toSplit = kFALSE) ; - TObject * ReturnO(TString what, TString name=0, TString file=0) const ; - const TTask * ReturnT(TString what,TString name=0) const ; - void DefineBranchTitles(char* branch, char* branchTitle) ; - Int_t ReadTreeD(const Int_t event) ; + Int_t ReadTreeD(void) ; Int_t ReadTreeH(void) ; - Int_t ReadTreeR(const Int_t event) ; - Int_t ReadTreeS(const Int_t event) ; - void ReadTreeQA(void) ; + Int_t ReadTreeR(void) ; + Int_t ReadTreeT(void) ; + Int_t ReadTreeS(void) ; + Int_t ReadTreeP(void) ; + + void ReadPrimaries(void) ; - void CleanWhiteBoard(void) ; - void CloseSplitFiles(void) ; - void SetTitle(const char * title) ; - - TObject ** PrimariesRef(void) const ; - TObject ** HitsRef(void) const ; - TObject ** SDigitsRef(const char * name, const char * file = 0 ) const; - TObject ** DigitsRef (const char * name) const ; - TObject ** ECRecPointsRef (const char * name) const ; - TObject ** HCRecPointsRef (const char * name) const ; - TObject ** PRERecPointsRef (const char * name) const ; - TObject ** TrackSegmentsRef(const char * name) const ; - TObject ** RecParticlesRef (const char * name) const ; - TObject ** SDigitizerRef (const char * name) const ; - TObject ** DigitizerRef (const char * name) const ; - TObject ** ClusterizerRef(const char * name) const ; - TObject ** TSMakerRef (const char * name) const ; - TObject ** PIDRef (const char * name) const ; - - private: - - static TFile * fFile ; //! - Bool_t fToSplit ; //! Do we work in the split mode - TString fHeaderFile ; //! File in which gAlice lives - TString fBranchTitle ; //! - TString fTrackSegmentsTitle ;//! - TString fTrackSegmentsFileName ;//! - TString fRecPointsTitle ; //! - TString fRecPointsFileName ; //! - TString fRecParticlesTitle ; //! - TString fRecParticlesFileName ; //! - TString fDigitsTitle ; //!TDirectory tempo(gDirectory) - TString fDigitsFileName ; //! TDirectory tempo(gDirectory) - TString fSDigitsTitle ; //! - TString fSDigitsFileName ; //! - Bool_t fFailed ; //! true if file is not opened and/or galice not found - Int_t fDebug ; // Debug level - AliRun * fAlice ; //! needed to read TreeK if in an other file than fHeaderFile - Int_t fNPrimaries ; //! # of primaries - TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing - TFolder * fModuleFolder ; //!Folder that contains the modules - TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles - TFolder * fHitsFolder ; //!Folder that contains the Hits - TFolder * fSDigitsFolder ; //!Folder that contains the SDigits - TFolder * fDigitsFolder ; //!Folder that contains the Digits - TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles) - TFolder * fQAFolder ; //!Folder that contains the QA objects - TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner) - + +private: + +// static TFile * fgFile; //! + +// AliEMCALBeamTestEvent * fBTE ; //! Header if BeamTest Event + + static Int_t fgDebug ; //! Debug level + + TString fLoadingStatus ; //! tells which trees are loaded + Int_t fNPrimaries ; //! # of primaries + TClonesArray * fPrimaries ; //! list of lists of primaries + +// AliEMCALCalibrationDB * fcdb ; //! + + static AliEMCALLoader * fgEmcalLoader ; static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton + + enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; + ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index }; #endif // AliEMCALGETTER_H - diff --git a/EMCAL/AliEMCALHadronCorrectionv0.cxx b/EMCAL/AliEMCALHadronCorrectionv0.cxx index af9b2af918c..4e9995aeb4b 100644 --- a/EMCAL/AliEMCALHadronCorrectionv0.cxx +++ b/EMCAL/AliEMCALHadronCorrectionv0.cxx @@ -16,6 +16,12 @@ /* $Log$ +Revision 1.2.4.2 2003/07/07 14:13:31 schutz +NewIO + +Revision 1.4 2002/10/14 14:55:35 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.2.6.2 2002/07/24 10:06:16 alibrary Updating VirtualMC diff --git a/EMCAL/AliEMCALJet.cxx b/EMCAL/AliEMCALJet.cxx index 83f89f9fbf8..00b9a4c1652 100644 --- a/EMCAL/AliEMCALJet.cxx +++ b/EMCAL/AliEMCALJet.cxx @@ -16,6 +16,12 @@ /* $Log$ +Revision 1.2.4.2 2003/07/07 14:13:31 schutz +NewIO + +Revision 1.4 2002/10/14 14:55:35 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.2.6.2 2002/07/24 10:06:16 alibrary Updating VirtualMC diff --git a/EMCAL/AliEMCALJetFinder.cxx b/EMCAL/AliEMCALJetFinder.cxx index c818f1231fc..3ecb130d638 100644 --- a/EMCAL/AliEMCALJetFinder.cxx +++ b/EMCAL/AliEMCALJetFinder.cxx @@ -15,6 +15,16 @@ /* $Log$ +Revision 1.19.2.5 2003/07/08 16:43:48 schutz +NewIO and remove AliEMCALReconstructionner + +Revision 1.19.2.4 2003/07/07 14:13:31 schutz +NewIO + + +Revision 1.40 2003/01/30 17:29:02 hristov +No default arguments in the implementation file + Revision 1.39 2003/01/29 00:34:51 pavlinov fixed bug in FillFromHits @@ -184,6 +194,7 @@ Revision 1.3 2002/01/18 05:07:56 morsch #include "AliMagFCM.h" #include "AliRun.h" #include "AliGenerator.h" +#include "AliEMCALGetter.h" // Interface to FORTRAN #include "Ecommon.h" @@ -352,9 +363,11 @@ void AliEMCALJetFinder::Init() // // // Geometry - AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); - AliEMCALGeometry* geom = - AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), ""); + //AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + // AliEMCALGeometry* geom = + // AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), ""); + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + AliEMCALGeometry* geom = gime->EMCALGeometry() ; // SetSamplingFraction(geom->GetSampling()); @@ -675,43 +688,52 @@ void AliEMCALJetFinder::WriteJets() } // I/O + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; if (!fOutFileName) { // // output written to input file // - AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL"); - TTree* pK = gAlice->TreeK(); - file = (pK->GetCurrentFile())->GetName(); + AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL"); + TTree* pK = gAlice->TreeK(); + file = (pK->GetCurrentFile())->GetName(); + TBranch * jetBranch ; if (fDebug > 1) printf("Make Branch - TreeR address %p %p\n",gAlice->TreeR(), pEMCAL); - if (fJets && gAlice->TreeR()) { - pEMCAL->MakeBranchInTree(gAlice->TreeR(), - "EMCALJets", - &fJets, - kBufferSize, - file); + //if (fJets && gAlice->TreeR()) { + if (fJets && gime->TreeR()) { + // pEMCAL->MakeBranchInTree(gAlice->TreeR(), + jetBranch = gime->TreeR()->Branch("EMCALJets", &fJets, kBufferSize, 0) ; + //pEMCAL->MakeBranchInTree(gime->TreeR(), + // "EMCALJets", + // &fJets, + // kBufferSize, + // file); + + //Int_t nev = gAlice->GetHeader()->GetEvent(); + //gAlice->TreeR()->Fill(); + jetBranch->Fill(); + //char hname[30]; + //sprintf(hname,"TreeR%d", nev); + //gAlice->TreeR()->Write(hname); + //gAlice->TreeR()->Reset(); + gime->WriteRecPoints("OVERWRITE"); } - Int_t nev = gAlice->GetHeader()->GetEvent(); - gAlice->TreeR()->Fill(); - char hname[30]; - sprintf(hname,"TreeR%d", nev); - gAlice->TreeR()->Write(hname); - gAlice->TreeR()->Reset(); } else { // // Output written to user specified output file // - TTree* pK = gAlice->TreeK(); - fInFile = pK->GetCurrentFile(); - - fOutFile->cd(); - char hname[30]; - sprintf(hname,"TreeR%d", fEvent); - TTree* treeJ = new TTree(hname, "EMCALJets"); - treeJ->Branch("EMCALJets", &fJets, kBufferSize); - treeJ->Fill(); - treeJ->Write(hname); - fInFile->cd(); + //TTree* pK = gAlice->TreeK(); + TTree* pK = gAlice->TreeK(); + fInFile = pK->GetCurrentFile(); + + fOutFile->cd(); + char hname[30]; + sprintf(hname,"TreeR%d", fEvent); + TTree* treeJ = new TTree(hname, "EMCALJets"); + treeJ->Branch("EMCALJets", &fJets, kBufferSize); + treeJ->Fill(); + treeJ->Write(hname); + fInFile->cd(); } ResetJets(); } @@ -1084,7 +1106,8 @@ void AliEMCALJetFinder::FillFromHits(Int_t flag) // // Access hit information AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); - TTree *treeH = gAlice->TreeH(); + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + TTree *treeH = gime->TreeH(); Int_t ntracks = (Int_t) treeH->GetEntries(); // // Loop over tracks @@ -1183,10 +1206,10 @@ void AliEMCALJetFinder::FillFromDigits(Int_t flag) // Get digitizer parameters Float_t preADCped = digr->GetPREpedestal(); Float_t preADCcha = digr->GetPREchannel(); - Float_t ecADCped = digr->GetECpedestal(); - Float_t ecADCcha = digr->GetECchannel(); - Float_t hcADCped = digr->GetHCpedestal(); - Float_t hcADCcha = digr->GetHCchannel(); + Float_t ecADCped = digr->GetECApedestal(); + Float_t ecADCcha = digr->GetECAchannel(); + Float_t hcADCped = digr->GetHCApedestal(); + Float_t hcADCcha = digr->GetHCAchannel(); AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); AliEMCALGeometry* geom = @@ -1210,11 +1233,11 @@ void AliEMCALJetFinder::FillFromDigits(Int_t flag) pedestal = preADCped; channel = preADCcha; } - else if (geom->IsInECAL(sdg->GetId())) { + else if (geom->IsInECA(sdg->GetId())) { pedestal = ecADCped; channel = ecADCcha; } - else if (geom->IsInHCAL(sdg->GetId())) { + else if (geom->IsInHCA(sdg->GetId())) { pedestal = hcADCped; channel = hcADCcha; } @@ -1457,8 +1480,10 @@ void AliEMCALJetFinder::BuildTrackFlagTable() { fTrackList[i] = 0; } - TTree *treeH = gAlice->TreeH(); - Int_t ntracks = (Int_t) treeH->GetEntries(); + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + // TTree *treeH = gAlice->TreeH(); + TTree *treeH = gime->TreeH(); + Int_t ntracks = (Int_t) treeH->GetEntries(); // // Loop over tracks // diff --git a/EMCAL/AliEMCALLink.cxx b/EMCAL/AliEMCALLink.cxx index 11041658ca5..97903feb28a 100644 --- a/EMCAL/AliEMCALLink.cxx +++ b/EMCAL/AliEMCALLink.cxx @@ -29,14 +29,14 @@ ClassImp(AliEMCALLink) //____________________________________________________________________________ - AliEMCALLink::AliEMCALLink(Float_t prod, Int_t ec, Int_t rp, unsigned int what) + AliEMCALLink::AliEMCALLink(Float_t prod, Int_t eca, Int_t rp, unsigned int what) { // ctor if (gDebug == 2 ) - Info("ctor", "prod = %f, ec=%d , rp=%d, what=%d", prod, ec, rp, what) ; + Info("ctor", "prod = %f, ec=%d , rp=%d, what=%d", prod, eca, rp, what) ; fProd = prod ; - fECALN = ec ; + fECAN = eca ; fOtherN = rp ; fWhat = what ; } diff --git a/EMCAL/AliEMCALLink.h b/EMCAL/AliEMCALLink.h index a3d6a489f0f..3092df204bf 100644 --- a/EMCAL/AliEMCALLink.h +++ b/EMCAL/AliEMCALLink.h @@ -30,18 +30,18 @@ public: // dtor } Int_t Compare(const TObject * obj) const ; - const Int_t GetECAL(void) const { return fECALN ; } - const Int_t GetOther(void) const { return fOtherN ; } + const Int_t GetECA(void) const { return fECAN ; } + const Int_t GetOther(void) const { return fOtherN ; } const Float_t GetProd(void) const { return fProd ; } - const Bool_t IsLinkToPRE(void) const {if (fWhat) return kFALSE; else return kTRUE;} - const Bool_t IsLinkToHCAL(void) const {if (fWhat) return kTRUE; else return kFALSE;} - Bool_t IsSortable() const{ return kTRUE; } + const Bool_t IsLinkToPRE(void) const {if (fWhat) return kFALSE; else return kTRUE;} + const Bool_t IsLinkToHCA(void) const {if (fWhat) return kTRUE; else return kFALSE;} + Bool_t IsSortable() const{ return kTRUE; } private: - Int_t fECALN ; // ECAL index - Int_t fOtherN ; // index of the linked recpoint - Float_t fProd ; // Scalar produc of the direction of the 2 recpoints + Int_t fECAN ; // ECAL index + Int_t fOtherN ; // index of the linked recpoint + Float_t fProd ; // Scalar produc of the direction of the 2 recpoints unsigned int fWhat ; // PRE (=0) or HCAL (=1) ClassDef(AliEMCALLink,1) // Auxilliary algorithm class used by AliEMCALTrackSegmentMaker diff --git a/EMCAL/AliEMCALLoader.cxx b/EMCAL/AliEMCALLoader.cxx new file mode 100644 index 00000000000..fe6bb996c86 --- /dev/null +++ b/EMCAL/AliEMCALLoader.cxx @@ -0,0 +1,1021 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* $Id: */ + +/* $Log: + 29.05.2001 Yuri Kharlov: + Everywhere reading the treese TTree->GetEvent(i) + is replaced by reading the branches TBranch->GetEntry(0) +*/ + +//_________________________________________________________________________ +// A singleton. This class should be used in the analysis stage to get +// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, +// instead of directly reading them from galice.root file. This container +// ensures, that one reads Digits, made of these particular digits, RecPoints, +// made of these particular RecPoints, TrackSegments and RecParticles. +// This becomes non trivial if there are several identical branches, produced with +// different set of parameters. +// +// An example of how to use (see also class AliEMCALAnalyser): +// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) +// AliEMCALRecParticle * part = gime->RecParticle(1) ; +// ................ +// please->GetEvent(event) ; // reads new event from galice.root +// +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) +//*-- Completely redesigned by Dmitri Peressounko March 2001 +// +//*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make +//*-- systematic usage of TFolders without changing the interface +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +#include "TFile.h" +#include "TTree.h" +#include "TROOT.h" +#include "TObjString.h" +#include "TFolder.h" +#include "TParticle.h" + +// --- Standard library --- +#include + +// --- AliRoot header files --- + +#include "AliRun.h" +#include "AliConfig.h" +#include "AliDataLoader.h" +#include "AliEMCALLoader.h" +#include "AliEMCAL.h" +#include "AliEMCALDigitizer.h" +#include "AliEMCALSDigitizer.h" +#include "AliEMCALClusterizer.h" +#include "AliEMCALClusterizerv1.h" +#include "AliEMCALTrackSegmentMaker.h" +#include "AliEMCALTrackSegmentMakerv1.h" +#include "AliEMCALTrackSegment.h" +#include "AliEMCALPID.h" +#include "AliEMCALPIDv1.h" +#include "AliEMCALGeometry.h" +//#include "AliEMCALCalibrationDB.h" + +ClassImp(AliEMCALLoader) + + +const TString AliEMCALLoader::fgkHitsName("HITS");//Name for TClonesArray with hits from one event +const TString AliEMCALLoader::fgkSDigitsName("SDIGITS");//Name for TClonesArray +const TString AliEMCALLoader::fgkDigitsName("DIGITS");//Name for TClonesArray +const TString AliEMCALLoader::fgkPRERecPointsName("PRERECPOINTS");//Name for TClonesArray +const TString AliEMCALLoader::fgkECARecPointsName("ECARECPOINTS");//Name for TClonesArray +const TString AliEMCALLoader::fgkHCARecPointsName("HCARECPOINTS");//Name for TClonesArray +const TString AliEMCALLoader::fgkTracksName("TRACKS");//Name for TClonesArray +const TString AliEMCALLoader::fgkRecParticlesName("RECPARTICLES");//Name for TClonesArray + +const TString AliEMCALLoader::fgkPRERecPointsBranchName("EMCALPRERP");//Name for branch with PreShower Reconstructed Points +const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points +const TString AliEMCALLoader::fgkHCARecPointsBranchName("EMCALHCARP");//Name for branch with HCA Reconstructed Points +const TString AliEMCALLoader::fgkTrackSegmentsBranchName("EMCALTS");//Name for branch with TrackSegments +const TString AliEMCALLoader::fgkRecParticlesBranchName("EMCALRP");//Name for branch with Reconstructed Particles +//____________________________________________________________________________ +AliEMCALLoader::AliEMCALLoader() + { + fDebug = 0; + fRecParticlesLoaded = kFALSE; + } +//____________________________________________________________________________ +AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername): + AliLoader(detname,eventfoldername) +{ + fDebug=0; + fRecParticlesLoaded = kFALSE; +} +//____________________________________________________________________________ + +AliEMCALLoader::~AliEMCALLoader() +{ + //remove and delete arrays + Clean(fgkHitsName); + Clean(fgkSDigitsName); + Clean(fgkDigitsName); + Clean(fgkPRERecPointsName); + Clean(fgkECARecPointsName); + Clean(fgkHCARecPointsName); + Clean(fgkTracksName); + Clean(fgkRecParticlesName); +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanFolders() + { + CleanRecParticles(); + AliLoader::CleanFolders(); + } +//____________________________________________________________________________ + +Int_t AliEMCALLoader::SetEvent() +{ +//Cleans loaded stuff and and sets Files and Directories +// do not post any data to folder/tasks + + + Int_t retval = AliLoader::SetEvent(); + if (retval) + { + Error("SetEvent","AliLoader::SetEvent returned error"); + return retval; + } + + + if (Hits()) Hits()->Clear(); + if (SDigits()) SDigits()->Clear(); + if (Digits()) Digits()->Clear(); + if (PRERecPoints()) PRERecPoints()->Clear(); + if (ECARecPoints()) ECARecPoints()->Clear(); + if (HCARecPoints()) HCARecPoints()->Clear(); + if (TrackSegments()) TrackSegments()->Clear(); + if (RecParticles()) RecParticles()->Clear(); + + return 0; +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::GetEvent() +{ +//Overloads GetEvent method called by AliRunLoader::GetEvent(Int_t) method +//to add Rec Particles specific for EMCAL + +//First call the original method to get whatever from std. setup is needed + Int_t retval; + + retval = AliLoader::GetEvent(); + if (retval) + { + Error("GetEvent","AliLoader::GetEvent returned error"); + return retval; + } + + if (GetHitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadHits(); + if (GetSDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadSDigits(); + if (GetDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadDigits(); + if (GetRecPointsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecPoints(); + if (GetTracksDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadTracks(); + if (GetRecParticlesDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecParticles(); + + +//Now, check if RecPart were loaded + return 0; +} +//____________________________________________________________________________ + + +//____________________________________________________________________________ +const AliEMCAL * AliEMCALLoader::EMCAL() +{ + // returns the EMCAL object + AliEMCAL * emcal = dynamic_cast(GetModulesFolder()->FindObject(fDetectorName)); + if ( emcal == 0x0) + if (fDebug) + cout << "WARNING: AliEMCALLoader::EMCAL -> EMCAL module not found in Folders" << endl ; + return emcal ; +} + +//____________________________________________________________________________ +const AliEMCALGeometry * AliEMCALLoader::EMCALGeometry() +{ + AliEMCALGeometry * rv = 0 ; + if (EMCAL() ) + rv = EMCAL()->GetGeometry(); + return rv ; +} + + +//____________________________________________________________________________ +Int_t AliEMCALLoader::LoadHits(Option_t* opt) +{ +//------- Hits ---------------------- +//Overload (extends) LoadHits implemented in AliLoader +// + Int_t res; + + //First call the AliLoader's method to send the TreeH to folder + res = AliLoader::LoadHits(opt); + + if (res) + {//oops, error + Error("LoadHits","AliLoader::LoadHits returned error"); + return res; + } + + //read the data from tree in folder and send it to folder + res = ReadHits(); + return 0; +} + + +//____________________________________________________________________________ +Int_t AliEMCALLoader::LoadSDigits(Option_t* opt) +{ //---------- SDigits ------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + res = AliLoader::LoadSDigits(opt); + if (res) + {//oops, error + Error("PostSDigits","AliLoader::LoadSDigits returned error"); + return res; + } + return ReadSDigits(); + +} +//____________________________________________________________________________ +Int_t AliEMCALLoader::LoadDigits(Option_t* opt) +{ + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + res = AliLoader::LoadDigits(opt); + if (res) + {//oops, error + Error("LoadDigits","AliLoader::LoadDigits returned error"); + return res; + } + return ReadDigits(); +} +//____________________________________________________________________________ +Int_t AliEMCALLoader::LoadRecPoints(Option_t* opt) +{ // -------------- RecPoints ------------------------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeR to folder + res = AliLoader::LoadRecPoints(opt); + if (res) + {//oops, error + Error("LoadRecPoints","AliLoader::LoadRecPoints returned error"); + return res; + } + + TFolder * emcalFolder = GetDetectorDataFolder(); + if ( emcalFolder == 0x0 ) + { + Error("LoadRecPoints","Can not get detector data folder"); + return 1; + } + return ReadRecPoints(); +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::LoadTracks(Option_t* opt) +{ + //Loads Tracks: Open File, Reads Tree and posts, Read Data and Posts + if (GetDebug()) Info("LoadTracks","opt = %s",opt); + if (fTracksLoaded) + { + Warning("LoadTracks","Tracks are already loaded"); + return 0; + } + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + if (GetTracksDataLoader()->GetBaseLoader(0)->IsLoaded() == kFALSE) + {//tracks can be loaded by LoadRecPoints + res = AliLoader::LoadTracks(opt); + if (res) + {//oops, error + Error("LoadTracks","AliLoader::LoadTracks returned error"); + return res; + } + } + res = ReadTracks(); + if (res) + { + Error("LoadTracks","Error occured while reading Tracks"); + return res; + } + + fTracksLoaded = kTRUE; + return 0; +} + +//____________________________________________________________________________ +Int_t AliEMCALLoader::LoadRecParticles(Option_t* opt) +{ // -------------- RecPoints ------------------------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + res = AliLoader::LoadRecParticles(opt); + if (res) + {//oops, error + Error("LoadRecParticles","AliLoader::LoadRecParticles returned error"); + return res; + } + + TFolder * emcalFolder = GetDetectorDataFolder(); + if ( emcalFolder == 0x0 ) + { + Error("PostDigits","Can not get detector data folder"); + return 1; + } + return ReadRecParticles(); +} + +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostHits() +{ + Int_t reval = AliLoader::PostHits(); + if (reval) + { + Error("PostHits","AliLoader:: returned error"); + return reval; + } + return ReadHits(); +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostSDigits() +{ + Int_t reval = AliLoader::PostSDigits(); + if (reval) + { + Error("PostSDigits","AliLoader::PostSDigits returned error"); + return reval; + } + return ReadSDigits(); +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostDigits() +{ + Int_t reval = AliLoader::PostDigits(); + if (reval) + { + Error("PostDigits","AliLoader::PostDigits returned error"); + return reval; + } + return ReadDigits(); +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostRecPoints() +{ + Int_t reval = AliLoader::PostRecPoints(); + if (reval) + { + Error("PostRecPoints","AliLoader::PostRecPoints returned error"); + return reval; + } + return ReadRecPoints(); +} + +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostRecParticles() +{ + Int_t reval = AliLoader::PostRecParticles(); + if (reval) + { + Error("PostRecParticles","AliLoader::PostRecParticles returned error"); + return reval; + } + return ReadRecParticles(); +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::PostTracks() +{ + Int_t reval = AliLoader::PostTracks(); + if (reval) + { + Error("PostTracks","AliLoader::PostTracks returned error"); + return reval; + } + return ReadTracks(); +} +//____________________________________________________________________________ + + + +//____________________________________________________________________________ +Int_t AliEMCALLoader::ReadHits() +{ +// If there is no Clones Array in folder creates it and sends to folder +// then tries to read +// Reads the first entry of EMCAL branch in hit tree TreeH() +// Reads data from TreeH and stores it in TClonesArray that sits in DetectorDataFolder +// + TObject** hitref = HitsRef(); + if(hitref == 0x0) + { + MakeHitsArray(); + hitref = HitsRef(); + } + + TClonesArray* hits = dynamic_cast(*hitref); + + TTree* treeh = TreeH(); + + if(treeh == 0) + { + Error("ReadHits"," Cannot read TreeH from folder"); + return 1; + } + + TBranch * hitsbranch = treeh->GetBranch(fDetectorName); + if (hitsbranch == 0) + { + Error("ReadHits"," Cannot find branch EMCAL"); + return 1; + } + + if (GetDebug()) Info("ReadHits","Reading Hits"); + + if (hitsbranch->GetEntries() > 1) + { + TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000); + + hitsbranch->SetAddress(&tempo); + Int_t index = 0 ; + Int_t i = 0 ; + for (i = 0 ; i < hitsbranch->GetEntries(); i++) + { + hitsbranch->GetEntry(i) ; + Int_t j = 0 ; + for ( j = 0 ; j < tempo->GetEntries() ; j++) + { + AliEMCALHit* hit = (AliEMCALHit*)tempo->At(j); + new((*hits)[index]) AliEMCALHit( *hit ) ; + index++ ; + } + } + delete tempo; + } + else + { + hitsbranch->SetAddress(hitref); + hitsbranch->GetEntry(0) ; + } + + return 0; +} +//____________________________________________________________________________ +Int_t AliEMCALLoader::ReadSDigits() +{ +// Read the summable digits tree TreeS(): +// Check if TClones is in folder +// if not create and add to folder +// connect to tree if available +// Read the data + + TObject** sdref = SDigitsRef(); + if(sdref == 0x0) + { + MakeSDigitsArray(); + sdref = SDigitsRef(); + } + + TTree * treeS = TreeS(); + if(treeS==0) + { + //May happen if file is truncated or new in LoadSDigits + //Error("ReadSDigits","There is no SDigit Tree"); + return 0; + } + + TBranch * branch = treeS->GetBranch(fDetectorName); + if (branch == 0) + {//easy, maybe just a new tree + //Error("ReadSDigits"," Cannot find branch EMCAL"); + return 0; + } + + branch->SetAddress(SDigitsRef()); + branch->GetEntry(0); + return 0; +} + +//____________________________________________________________________________ +Int_t AliEMCALLoader::ReadDigits() +{ +// Read the summable digits tree TreeS(): +// Check if TClones is in folder +// if not create and add to folder +// connect to tree if available +// Read the data + + TObject** dref = DigitsRef(); + if(dref == 0x0) + {//if there is not array in folder, create it and put it there + MakeDigitsArray(); + dref = DigitsRef(); + } + + TTree * treeD = TreeD(); + if(treeD==0) + { + //May happen if file is truncated or new in LoadSDigits + //Error("ReadDigits","There is no Digit Tree"); + return 0; + } + + TBranch * branch = treeD->GetBranch(fDetectorName); + if (branch == 0) + {//easy, maybe just a new tree + //Error("ReadDigits"," Cannot find branch ",fDetectorName.Data()); + return 0; + } + + branch->SetAddress(dref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} +//____________________________________________________________________________ + +void AliEMCALLoader::UnloadRecParticles() +{ + fRecParticlesLoaded = kFALSE; + CleanRecParticles(); + if (fTracksLoaded == kFALSE) UnloadTracks(); +} +//____________________________________________________________________________ + +void AliEMCALLoader::UnloadTracks() +{ + CleanTracks();//free the memory + //in case RecPart are loaded we can not onload tree and close the file + if (fRecParticlesLoaded == kFALSE) AliLoader::UnloadTracks(); + fTracksLoaded = kFALSE;//mark that nobody needs them +} +//____________________________________________________________________________ + +void AliEMCALLoader::Track(Int_t itrack) +{ +// Read the first entry of EMCAL branch in hit tree gAlice->TreeH() + if(TreeH()== 0) + { + if (LoadHits()) + { + Error("Track","Can not load hits."); + return; + } + } + + TBranch * hitsbranch = dynamic_cast(TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; + if ( !hitsbranch ) { + if (fDebug) + cout << "WARNING: AliEMCALLoader::ReadTreeH -> Cannot find branch EMCAL" << endl ; + return ; + } + if(!Hits()) PostHits(); + + hitsbranch->SetAddress(HitsRef()); + hitsbranch->GetEntry(itrack); + +} +//____________________________________________________________________________ +void AliEMCALLoader::ReadTreeQA() +{ + // Read the digit tree gAlice->TreeQA() + // so far only EMCAL knows about this Tree + + if(EMCAL()->TreeQA()== 0){ + cerr << "ERROR: AliEMCALLoader::ReadTreeQA: can not read TreeQA " << endl ; + return ; + } + + TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL"); + if (!qabranch) { + if (fDebug) + cout << "WARNING: AliEMCALLoader::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ; + return ; + } + +// if(!Alarms()) PostQA(); + + qabranch->SetAddress(AlarmsRef()) ; + + qabranch->GetEntry(0) ; + +} + + +//____________________________________________________________________________ +Int_t AliEMCALLoader::ReadRecPoints() +{ +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to array + + MakeRecPointsArray(); + + TObjArray * pre = 0x0 ; + TObjArray * eca = 0x0 ; + TObjArray * hca = 0x0 ; + + TTree * treeR = TreeR(); + + if(treeR==0) + { + //May happen if file is truncated or new in LoadSDigits + return 0; + } + + Int_t retval = 0; + TBranch * prebranch = treeR->GetBranch(fgkPRERecPointsBranchName); + + if (prebranch == 0x0) + { + Error("ReadRecPoints","Can not get branch with PRE Rec. Points named %s",fgkPRERecPointsBranchName.Data()); + retval = 1; + } + else + { + prebranch->SetAddress(&pre) ; + prebranch->GetEntry(0) ; + } + TBranch * ecabranch = treeR->GetBranch(fgkECARecPointsBranchName); + if (ecabranch == 0x0) + { + Error("ReadRecPoints","Can not get branch with ECA Rec. Points named %s",fgkECARecPointsBranchName.Data()); + retval = 2; + } + else + { + ecabranch->SetAddress(&eca); + ecabranch->GetEntry(0) ; + } + TBranch * hcabranch = treeR->GetBranch(fgkHCARecPointsBranchName); + if (hcabranch == 0x0) + { + Error("ReadRecPoints","Can not get branch with HCA Rec. Points named %s",fgkHCARecPointsBranchName.Data()); + retval = 2; + } + else + { + hcabranch->SetAddress(&hca); + hcabranch->GetEntry(0) ; + } + + Int_t ii ; + Int_t maxpre = pre->GetEntries() ; + for ( ii= 0 ; ii < maxpre ; ii++ ) + PRERecPoints()->Add(pre->At(ii)) ; + + Int_t maxeca = eca->GetEntries() ; + for ( ii= 0 ; ii < maxeca ; ii++ ) + ECARecPoints()->Add(eca->At(ii)) ; + + Int_t maxhca = hca->GetEntries() ; + for ( ii= 0 ; ii < maxhca ; ii++ ) + HCARecPoints()->Add(hca->At(ii)) ; + + return retval; +} + +//____________________________________________________________________________ +Int_t AliEMCALLoader::ReadTracks() +{ +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to arry + + TObject** trkref = TracksRef(); + if ( trkref == 0x0 ) + {//Create and post array + MakeTrackSegmentsArray(); + trkref = TracksRef(); + } + + TTree * treeT = TreeT(); + if(treeT==0) + { + //May happen if file is truncated or new in LoadSDigits, or the file is in update mode, + //but tracking was not performed yet for a current event + //Error("ReadTracks","There is no Tree with Tracks"); + return 0; + } + + TBranch * branch = treeT->GetBranch(fgkTrackSegmentsBranchName); + if (branch == 0) + {//easy, maybe just a new tree + Error("ReadTracks"," Cannot find branch named %s",fgkTrackSegmentsBranchName.Data()); + return 0; + } + + branch->SetAddress(trkref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} +//____________________________________________________________________________ + +Int_t AliEMCALLoader::ReadRecParticles() +{ +//Reads Reconstructed Particles from file +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to arry + + TObject** recpartref = RecParticlesRef(); + + if ( recpartref == 0x0 ) + {//Create and post array + MakeRecParticlesArray(); + recpartref = RecParticlesRef(); + } + + TTree * treeP = TreeP(); + if(treeP==0) + { + //May happen if file is truncated or new in LoadSDigits, + //or the file is in update mode, + //but tracking was not performed yet for a current event + // Error("ReadRecParticles","There is no Tree with Tracks and Reconstructed Particles"); + return 0; + } + + TBranch * branch = treeP->GetBranch(fgkRecParticlesBranchName); + if (branch == 0) + {//easy, maybe just a new tree + Error("ReadRecParticles"," Cannot find branch %s",fgkRecParticlesBranchName.Data()); + return 0; + } + + branch->SetAddress(recpartref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} + + +AliEMCALGeometry* AliEMCALLoader::GetEMCALGeometry() +{ +//returns EMCAL geometry from gAlice +//static Method used by some classes where it is not convienient to pass eventfoldername + if (gAlice == 0x0) + return 0x0; + AliEMCAL* emcal=dynamic_cast(gAlice->GetDetector("EMCAL")); + if (emcal == 0x0) + return 0x0; + return emcal->GetGeometry(); +} +/***************************************************************************************/ + +AliEMCALLoader* AliEMCALLoader::GetEMCALLoader(const char* eventfoldername) +{ + AliRunLoader* rn = AliRunLoader::GetRunLoader(eventfoldername); + if (rn == 0x0) + { + cerr<<"Error: : " + << "Can not find Run Loader in folder "<(rn->GetLoader("EMCALLoader")); +} +/***************************************************************************************/ + +Bool_t AliEMCALLoader::BranchExists(const TString& recName) + { + if (fBranchTitle.IsNull()) return kFALSE; + TString dataname, zername ; + TTree* tree; + if(recName == "SDigits") { + tree = TreeS(); + dataname = GetDetectorName(); + zername = "AliEMCALSDigitizer" ; + } + else if(recName == "Digits"){ + tree = TreeD(); + dataname = GetDetectorName(); + zername = "AliEMCALDigitizer" ; + } + else if(recName == "PRERecPoints"){ + tree = TreeR(); + dataname = fgkPRERecPointsBranchName; + zername = "AliEMCALClusterizer" ; + } + else if(recName == "ECARecPoints"){ + tree = TreeR(); + dataname = fgkECARecPointsBranchName; + zername = "AliEMCALClusterizer" ; + } + else if(recName == "HCARecPoints"){ + tree = TreeR(); + dataname = fgkHCARecPointsBranchName; + zername = "AliEMCALClusterizer" ; + } + else if(recName == "TrackSegments"){ + tree = TreeT(); + dataname = fgkTrackSegmentsBranchName; + zername = "AliEMCALTrackSegmentMaker"; + } + else if(recName == "RecParticles"){ + tree = TreeP(); + dataname = fgkRecParticlesBranchName; + zername = "AliEMCALPID"; + } + else + return kFALSE ; + + + if(!tree ) + return kFALSE ; + + TObjArray * lob = static_cast(tree->GetListOfBranches()) ; + TIter next(lob) ; + TBranch * branch = 0 ; + TString titleName(fBranchTitle); + titleName+=":"; + + while ((branch = (static_cast(next())))) { + TString branchName(branch->GetName() ) ; + TString branchTitle(branch->GetTitle() ) ; + if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){ + Warning("BranchExists","branch %s with title %s ",dataname.Data(),fBranchTitle.Data()); + return kTRUE ; + } + if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){ + Warning("BranchExists","branch AliEMCAL... with title %s ",branch->GetTitle()); + return kTRUE ; + } + } + return kFALSE ; + + } + +void AliEMCALLoader::SetBranchTitle(const TString& btitle) + { + if (btitle.CompareTo(fBranchTitle) == 0) return; + fBranchTitle = btitle; + ReloadAll(); + } +//____________________________________________________________________________ + +void AliEMCALLoader::CleanHits() +{ + AliLoader::CleanHits(); + //Clear an array + TClonesArray* hits = Hits(); + if (hits) hits->Clear(); +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanSDigits() +{ + AliLoader::CleanSDigits(); + TClonesArray* sdigits = SDigits(); + if (sdigits) sdigits->Clear(); + +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanDigits() +{ + AliLoader::CleanDigits(); + TClonesArray* digits = Digits(); + if (digits) digits->Clear(); +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanRecPoints() +{ + AliLoader::CleanRecPoints(); + TObjArray* recpoints = PRERecPoints(); + if (recpoints) recpoints->Clear(); + recpoints = ECARecPoints(); + if (recpoints) recpoints->Clear(); + recpoints = HCARecPoints(); + if (recpoints) recpoints->Clear(); +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanTracks() +{ +//Cleans Tracks stuff + + AliLoader::CleanTracks();//tree + + //and clear the array + TClonesArray* tracks = TrackSegments(); + if (tracks) tracks->Clear(); + +} +//____________________________________________________________________________ + +void AliEMCALLoader::CleanRecParticles() + { + + TClonesArray *recpar = RecParticles(); + if (recpar) recpar->Clear(); + + + } +//____________________________________________________________________________ + +// void AliEMCALLoader::ReadCalibrationDB(const char * database,const char * filename) +// { + +// if(fcdb && (strcmp(database,fcdb->GetTitle())==0)) +// return ; + +// TFile * file = gROOT->GetFile(filename) ; +// if(!file) +// file = TFile::Open(filename); +// if(!file){ +// Error ("ReadCalibrationDB", "Cannot open file %s", filename) ; +// return ; +// } +// if(fcdb) +// fcdb->Delete() ; +// fcdb = dynamic_cast(file->Get("AliEMCALCalibrationDB")) ; +// if(!fcdb) +// Error ("ReadCalibrationDB", "No database %s in file %s", database, filename) ; +// } +//____________________________________________________________________________ + +// AliEMCALSDigitizer* AliEMCALLoader::EMCALSDigitizer() +// { +// //return EMCAL SDigitizer +// return dynamic_cast(SDigitizer()) ; +// } + +//____________________________________________________________________________ +void AliEMCALLoader::MakeHitsArray() +{ + if (Hits()) return; + TClonesArray* hits = new TClonesArray("AliEMCALHit",1000); + hits->SetName(fgkHitsName); + GetDetectorDataFolder()->Add(hits); +} + +//____________________________________________________________________________ +void AliEMCALLoader::MakeSDigitsArray() +{ + if ( SDigits()) return; + TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",1); + sdigits->SetName(fgkSDigitsName); + GetDetectorDataFolder()->Add(sdigits); +} + +//____________________________________________________________________________ +void AliEMCALLoader::MakeDigitsArray() +{ + if ( Digits()) return; + TClonesArray* digits = new TClonesArray("AliEMCALDigit",1); + digits->SetName(fgkDigitsName); + GetDetectorDataFolder()->Add(digits); + +} + +//____________________________________________________________________________ +void AliEMCALLoader::MakeRecPointsArray() +{ + if ( PRERecPoints() == 0x0) { + if (GetDebug()>9) + Info("MakeRecPointsArray","Making array for PRE"); + TObjArray* pre = new TObjArray(100) ; + pre->SetName(fgkPRERecPointsName) ; + GetDetectorDataFolder()->Add(pre); + } + if ( ECARecPoints() == 0x0) { + if (GetDebug()>9) + Info("MakeRecPointsArray","Making array for ECA"); + TObjArray* eca = new TObjArray(100) ; + eca->SetName(fgkECARecPointsName) ; + GetDetectorDataFolder()->Add(eca); + } + if ( HCARecPoints() == 0x0) { + if (GetDebug()>9) + Info("MakeRecPointsArray","Making array for HCA"); + TObjArray* hca = new TObjArray(100) ; + hca->SetName(fgkHCARecPointsName) ; + GetDetectorDataFolder()->Add(hca); + } +} + +//____________________________________________________________________________ +void AliEMCALLoader::MakeTrackSegmentsArray() +{ + if ( TrackSegments()) return; + TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; + ts->SetName(fgkTracksName); + GetDetectorDataFolder()->Add(ts); + +} + +//____________________________________________________________________________ +void AliEMCALLoader::MakeRecParticlesArray() +{ + if ( RecParticles()) return; + TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; + rp->SetName(fgkRecParticlesName); + GetDetectorDataFolder()->Add(rp); +} diff --git a/EMCAL/AliEMCALLoader.h b/EMCAL/AliEMCALLoader.h new file mode 100644 index 00000000000..0600f65528f --- /dev/null +++ b/EMCAL/AliEMCALLoader.h @@ -0,0 +1,365 @@ +#ifndef ALIEMCALLOADER_H +#define ALIEMCALLOADER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// A singleton that returns various objects +// Should be used on the analysis stage to avoid confusing between different +// branches of reconstruction tree: e.g. reading RecPoints and TS made from +// another set of RecPoints. +// +// The objects are retrived from folders. +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) +// + + +// --- ROOT system --- +#include "TClonesArray.h" +#include "TFolder.h" +#include "TTree.h" +class TString ; +class TParticle ; +class TTask ; + +// --- Standard library --- +#include +#include + +// --- AliRoot header files --- + +#include "AliRun.h" +#include "AliLoader.h" +#include "AliRunLoader.h" +#include "AliEMCAL.h" +#include "AliEMCALHit.h" +#include "AliEMCALDigit.h" +#include "AliEMCALTowerRecPoint.h" +#include "AliEMCALTrackSegment.h" +#include "AliEMCALRecParticle.h" +class AliEMCALGeometry ; +#include "AliEMCALDigitizer.h" +#include "AliEMCALSDigitizer.h" +#include "AliEMCALClusterizer.h" +#include "AliEMCALTrackSegmentMaker.h" +#include "AliEMCALPID.h" +class AliEMCALCalibrationDB ; + + +// + +class AliEMCALLoader : public AliLoader { + + public: + + AliEMCALLoader(); + AliEMCALLoader(const AliEMCALLoader & obj){} + AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername); + + virtual ~AliEMCALLoader() ; + + // assignement operator requested by coding convention, but not needed + AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;} + + Int_t GetEvent();//extends the method on EMCAL RecPart posting + Int_t SetEvent();//extends the method on EMCAL RecPart posting + + Bool_t BranchExists(const TString& recName); + Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree + Int_t LoadSDigits(Option_t* opt=""); + Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree + Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree + Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree + Int_t LoadRecParticles(Option_t* opt=""); + + void UnloadRecParticles(); + void UnloadTracks(); + + Int_t PostHits(); //Posts the + Int_t PostSDigits(); + Int_t PostDigits(); + Int_t PostRecPoints(); + Int_t PostTracks(); + Int_t PostRecParticles(); + + void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean + + void CleanHits(); + void CleanSDigits(); + void CleanDigits(); + void CleanRecPoints(); + void CleanTracks(); + void CleanRecParticles(); + +//up to now it is only here -> no definition about global/incremental tracking/PID + +// Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles +// Int_t WritePID(Option_t* opt="");//writes the task for PID to file +// Bool_t PostPID (AliEMCALPID * pid) const {return kTRUE;} +// Bool_t PostQA (void) const ; //it was empty anyway + +/*******************************************************************/ +/*******************************************************************/ +/*******************************************************************/ + + TObject** HitsRef(){return GetDetectorDataRef(Hits());} + TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());} + TObject** DigitsRef(){return GetDetectorDataRef(Digits());} + TObject** PRERecPointsRef(){return GetDetectorDataRef(PRERecPoints());} + TObject** ECARecPointsRef(){return GetDetectorDataRef(ECARecPoints());} + TObject** HCARecPointsRef(){return GetDetectorDataRef(HCARecPoints());} + TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());} + TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());} + TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());} + void Track(Int_t itrack) ; + + static AliEMCALGeometry* GetEMCALGeometry(); + static AliEMCALLoader* GetEMCALLoader(const char* eventfoldername); + + //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. + Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();} + Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();} + + const AliEMCAL * EMCAL(); + const AliEMCALGeometry *EMCALGeometry() ; + // Alarms + // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); } + TObjArray * Alarms(); + + /*********************************************/ + /************ TClonesArrays ***********/ + /*********************************************/ + /**** H i t s ****/ + TClonesArray* Hits(void); + const AliEMCALHit* Hit(Int_t index); + void MakeHitsArray(); + /**** S D i g i t s ****/ + TClonesArray* SDigits(); + const AliEMCALDigit* SDigit(Int_t index); + void MakeSDigitsArray(); + /**** D i g i t s ****/ + TClonesArray* Digits(); + const AliEMCALDigit * Digit(Int_t index); + void MakeDigitsArray(); + /**** R e c P o i n t s ****/ + TObjArray * PRERecPoints(); + TObjArray * ECARecPoints(); + TObjArray * HCARecPoints(); + const AliEMCALRecPoint * PRERecPoint(Int_t index) ; + const AliEMCALTowerRecPoint * ECARecPoint(Int_t index) ; + const AliEMCALTowerRecPoint * HCARecPoint(Int_t index) ; + void MakeRecPointsArray(); + /**** T r a c k S e g m e n t s ****/ + TClonesArray * TrackSegments(); + const AliEMCALTrackSegment * TrackSegment(Int_t index); + void MakeTrackSegmentsArray(); + /**** R e c P a r t ic l e s ****/ + TClonesArray * RecParticles() ; + const AliEMCALRecParticle * RecParticle(Int_t index); + void MakeRecParticlesArray(); + + /*********************************************/ + /************ T A S K S **************/ + /*********************************************/ + // + // AliEMCALSDigitizer* EMCALSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName); + //AliEMCALDigitizer* EMCALDigitizer() { return dynamic_cast(Digitizer()) ;} + + AliEMCALClusterizer* Clusterizer () {return dynamic_cast(Reconstructioner()) ;} + Int_t PostClusterizer(TTask* clust){return PostReconstructioner(clust);} + Int_t LoadClusterizer(Option_t * opt="") {return LoadReconstructioner(opt);} + Int_t WriteClusterizer(Option_t * opt="") {return WriteReconstructioner(opt);} + + AliEMCALPID * PID (){return dynamic_cast(PIDTask()) ;} + Int_t PostPID(TTask* pid){return PostPIDTask(pid);} + Int_t LoadPID(Option_t * opt="") {return LoadPIDTask(opt);} + Int_t WritePID(Option_t * opt="") {return WritePIDTask(opt);} + + + AliEMCALTrackSegmentMaker * TrackSegmentMaker () { return dynamic_cast(Tracker()) ;} + Int_t PostTrackSegmentMaker(TTask* segmaker){return PostTracker(segmaker);} + Int_t LoadTrackSegmentMaker(Option_t * opt="") {return LoadTracker(opt);} + Int_t WriteTrackSegmentMaker(Option_t * opt="") {return WriteTracker(opt);} + + + void SetDebug(Int_t level) {fDebug = level;} // Set debug level + void SetBranchTitle(const TString& btitle); + + AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } + //void ReadCalibrationDB(const char * name, const char * filename); + +protected: + TString fBranchTitle; //Title of the branch + Bool_t fRecParticlesLoaded; //Flag signing if Reconstructed Particles are loaded + Bool_t fTracksLoaded; //Flag signing if Tracks are loaded + TString fRecParticlesFileOption; //Loading Option for Reconstructed Particles + AliEMCALCalibrationDB * fcdb ; //! + +private: + + Int_t ReadHits(); + Int_t ReadDigits(); + Int_t ReadSDigits(); + Int_t ReadRecPoints(); + Int_t ReadTracks(); + Int_t ReadRecParticles(); + + void ReadTreeQA() ; + Int_t fDebug ; // Debug level + + public: + + static const TString fgkHitsName;//Name for TClonesArray with hits from one event + static const TString fgkSDigitsName;//Name for TClonesArray + static const TString fgkDigitsName;//Name for TClonesArray + static const TString fgkPRERecPointsName;//Name for TClonesArray + static const TString fgkECARecPointsName;//Name for TClonesArray + static const TString fgkHCARecPointsName;//Name for TClonesArray + static const TString fgkTracksName;//Name for TClonesArray + static const TString fgkRecParticlesName;//Name for TClonesArray + + static const TString fgkPRERecPointsBranchName;//Name for branch + static const TString fgkECARecPointsBranchName;//Name for branch + static const TString fgkHCARecPointsBranchName;//Name for branch + static const TString fgkTrackSegmentsBranchName;//Name for branch + static const TString fgkRecParticlesBranchName;//Name for branch + + ClassDef(AliEMCALLoader,2) // Algorithm class that provides methods to retrieve objects from a list knowing the index + +}; + +/******************************************************************************/ +/**************** I N L I N E S ****************************************/ +/******************************************************************************/ + +inline TClonesArray* AliEMCALLoader::Hits() +{ + return (TClonesArray*)GetDetectorData(fgkHitsName); +} +/******************************************************************************/ + +inline const AliEMCALHit* AliEMCALLoader::Hit(Int_t index) +{ + const TClonesArray* tcarr = Hits(); + if (tcarr) + return (const AliEMCALHit*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray* AliEMCALLoader::SDigits() +{ + return dynamic_cast(GetDetectorData(fgkSDigitsName)); +} +/******************************************************************************/ + +inline const AliEMCALDigit* AliEMCALLoader::SDigit(Int_t index) +{ + const TClonesArray* tcarr = SDigits(); + if (tcarr) + return (const AliEMCALDigit*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray* AliEMCALLoader::Digits() +{ + return dynamic_cast(GetDetectorData(fgkDigitsName)); +} +/******************************************************************************/ + +inline const AliEMCALDigit* AliEMCALLoader::Digit(Int_t index) +{ + const TClonesArray* tcarr = Digits(); + if (tcarr) + return (const AliEMCALDigit*) tcarr->At(index); + return 0x0; +} + +/******************************************************************************/ + +inline TObjArray * AliEMCALLoader::PRERecPoints() +{ + return dynamic_cast(GetDetectorData(fgkPRERecPointsName)); +} +/******************************************************************************/ + +inline const AliEMCALRecPoint * AliEMCALLoader::PRERecPoint(Int_t index) +{ + TObjArray* tcarr = PRERecPoints(); + if (tcarr) + return dynamic_cast(tcarr->At(index)); + return 0x0; +} + +/******************************************************************************/ + +inline TObjArray * AliEMCALLoader::ECARecPoints() +{ + return dynamic_cast(GetDetectorData(fgkECARecPointsName)); +} + +/******************************************************************************/ + +inline const AliEMCALTowerRecPoint * AliEMCALLoader::ECARecPoint(Int_t index) +{ + TObjArray* tcarr = ECARecPoints(); + if (tcarr) + return dynamic_cast(tcarr->At(index)); + return 0x0; +} + +/******************************************************************************/ + +inline TObjArray * AliEMCALLoader::HCARecPoints() +{ + return dynamic_cast(GetDetectorData(fgkHCARecPointsName)); +} + +/******************************************************************************/ + +inline const AliEMCALTowerRecPoint * AliEMCALLoader::HCARecPoint(Int_t index) +{ + TObjArray* tcarr = HCARecPoints(); + if (tcarr) + return dynamic_cast(tcarr->At(index)); + return 0x0; +} + +/******************************************************************************/ + +inline TClonesArray * AliEMCALLoader::TrackSegments() +{ + return dynamic_cast(GetDetectorData(fgkTracksName)); +} +/******************************************************************************/ + +inline const AliEMCALTrackSegment * AliEMCALLoader::TrackSegment(Int_t index) +{ + const TClonesArray* tcarr = TrackSegments(); + if (tcarr) + return (const AliEMCALTrackSegment*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray * AliEMCALLoader::RecParticles() +{ + return dynamic_cast(GetDetectorData(fgkRecParticlesName)); +} +/******************************************************************************/ + +inline const AliEMCALRecParticle* AliEMCALLoader::RecParticle(Int_t index) +{ + TClonesArray* tcarr = RecParticles(); + if (tcarr) + return (const AliEMCALRecParticle*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ +inline TObjArray * AliEMCALLoader::Alarms() +{ return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));} + +#endif // AliEMCALLOADER_H diff --git a/EMCAL/AliEMCALPID.cxx b/EMCAL/AliEMCALPID.cxx index 64e4c0f50bd..05732b7e806 100644 --- a/EMCAL/AliEMCALPID.cxx +++ b/EMCAL/AliEMCALPID.cxx @@ -33,13 +33,9 @@ #include "TTree.h" // --- Standard library --- -#include - // --- AliRoot header files --- -#include "AliRun.h" #include "AliEMCALPID.h" -#include "AliHeader.h" ClassImp(AliEMCALPID) @@ -47,18 +43,16 @@ ClassImp(AliEMCALPID) AliEMCALPID::AliEMCALPID():TTask("","") { // ctor - fSplitFile= 0 ; - + fEventFolderName = "" ; } //____________________________________________________________________________ -AliEMCALPID::AliEMCALPID(const char* headerFile, const char * name, const Bool_t toSplit):TTask(name, headerFile) +AliEMCALPID::AliEMCALPID(const TString alirunFileName, const TString eventFolderName) +:TTask("EMCAL"+AliConfig::fgkPIDTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - fToSplit = toSplit ; - fSplitFile= 0 ; } //____________________________________________________________________________ @@ -66,5 +60,4 @@ AliEMCALPID::~AliEMCALPID() { // dtor - fSplitFile = 0 ; } diff --git a/EMCAL/AliEMCALPID.h b/EMCAL/AliEMCALPID.h index d35f0ad917b..73dc413b503 100644 --- a/EMCAL/AliEMCALPID.h +++ b/EMCAL/AliEMCALPID.h @@ -14,6 +14,8 @@ // --- ROOT system --- #include "TTask.h" +#include "AliConfig.h" + class TFormula ; class TClonesArray ; @@ -30,13 +32,15 @@ class AliEMCALPID : public TTask { public: AliEMCALPID() ; // ctor - AliEMCALPID(const char* headerFile,const char * name, const Bool_t toSplit) ; + AliEMCALPID(const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliEMCALPID(const AliEMCALPID & pid) {;} virtual ~AliEMCALPID() ; // dtor virtual void Exec(Option_t * option) { Warning("Exec", "not defined" ) ; } virtual const Int_t GetRecParticlesInRun() const { Warning("GetRecParticlesInRun", "not defined" ) ; return 0 ;} virtual void Print(Option_t * option) const { Warning("Print", "not defined" ) ;} - virtual void SetCpvtoEmcDistanceCut(Float_t Cluster_En, TString Eff_Pur,Float_t cut ) { Warning("SetCpvtoEmcDistanceCut", "not defined" ) ;} + void SetEventFolderName(TString name) { fEventFolderName = name ; } + virtual void SetPREtoECADistanceCut(Float_t Cluster_En, TString Eff_Pur,Float_t cut ) { Warning("SetCpvtoEmcDistanceCut", "not defined" ) ;} virtual void SetTimeGate(Float_t Cluster_En, TString Eff_Pur, Float_t gate) { Warning("SetTimeGate", "not defined" ) ; } virtual const char * Version() const { Warning("Version", "not defined" ) ; return 0 ; } virtual void WriteRecParticles(Int_t event) { Warning("WriteRecParticles", "not defined" ) ; } @@ -45,10 +49,9 @@ private: virtual void Init() { Warning("Init", "not defined" ) ; } protected: - - TFile * fSplitFile ; //! file in which RecParticles will eventually be stored - Bool_t fToSplit ; //! do we in the split mode - ClassDef(AliEMCALPID,1) // Particle Identifier algorithm (base class) + TString fEventFolderName ; // event folder name + + ClassDef(AliEMCALPID,2) // Particle Identifier algorithm (base class) } ; diff --git a/EMCAL/AliEMCALPIDv1.cxx b/EMCAL/AliEMCALPIDv1.cxx index 7184d7b1c78..0cb24a25f2b 100644 --- a/EMCAL/AliEMCALPIDv1.cxx +++ b/EMCAL/AliEMCALPIDv1.cxx @@ -29,16 +29,12 @@ #include "TFolder.h" #include "TSystem.h" #include "TBenchmark.h" - #include "TSystem.h" - -// --- Standard library --- - -#include - -// --- AliRoot header files --- - -#include "AliRun.h" + + // --- Standard library --- + + // --- AliRoot header files --- + #include "AliGenerator.h" #include "AliEMCAL.h" #include "AliEMCALPIDv1.h" @@ -48,27 +44,34 @@ #include "AliEMCALRecParticle.h" #include "AliEMCALGeometry.h" #include "AliEMCALGetter.h" - -ClassImp( AliEMCALPIDv1) + + ClassImp( AliEMCALPIDv1) //____________________________________________________________________________ AliEMCALPIDv1::AliEMCALPIDv1():AliEMCALPID() { // default ctor - + InitParameters() ; fDefaultInit = kTRUE ; + +} +//____________________________________________________________________________ +AliEMCALPIDv1::AliEMCALPIDv1(const AliEMCALPIDv1 & pid ):AliEMCALPID(pid) +{ + // ctor + InitParameters() ; + Init() ; + } //____________________________________________________________________________ -AliEMCALPIDv1::AliEMCALPIDv1(const char * headerFile,const char * name, const Bool_t toSplit) -:AliEMCALPID(headerFile, name,toSplit) +AliEMCALPIDv1::AliEMCALPIDv1(const TString alirunFileName, const TString eventFolderName):AliEMCALPID(alirunFileName, eventFolderName) { //ctor with the indication on where to look for the track segments InitParameters() ; - Init() ; fDefaultInit = kFALSE ; @@ -78,18 +81,13 @@ AliEMCALPIDv1::AliEMCALPIDv1(const char * headerFile,const char * name, const Bo AliEMCALPIDv1::~AliEMCALPIDv1() { // dtor - - if (!fDefaultInit) { - fSplitFile = 0 ; - } } //____________________________________________________________________________ const TString AliEMCALPIDv1::BranchName() const { - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + + return GetName() ; } //____________________________________________________________________________ @@ -98,42 +96,11 @@ void AliEMCALPIDv1::Init() // Make all memory allocations that are not possible in default constructor // Add the PID task to the list of EMCAL tasks - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname(GetName()) ; - branchname.Remove(branchname.Index(Version())-1) ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(),branchname.Data(),fToSplit ) ; - // gime->SetRecParticlesTitle(BranchName()) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !" ) ; - return ; - } + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data()) ; - fSplitFile = 0 ; - if(fToSplit){ - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } - - gime->PostPID(this) ; - gime->PostRecParticles(branchname) ; - + if ( !gime->PID() ) + gime->PostPID(this) ; } //____________________________________________________________________________ @@ -143,13 +110,6 @@ void AliEMCALPIDv1::InitParameters() fRecParticlesInRun = 0 ; fNEvent = 0 ; fRecParticlesInRun = 0 ; - TString pidName( GetName()) ; - if (pidName.IsNull() ) - pidName = "Default" ; - pidName.Append(":") ; - pidName.Append(Version()) ; - SetName(pidName) ; - fPi0Analysis = kFALSE ; } //____________________________________________________________________________ @@ -157,10 +117,7 @@ void AliEMCALPIDv1::InitParameters() void AliEMCALPIDv1::Exec(Option_t * option) { //Steering method - - if( strcmp(GetName(), "")== 0 ) - Init() ; - + if(strstr(option,"tim")) gBenchmark->Start("EMCALPID"); @@ -168,34 +125,32 @@ void AliEMCALPIDv1::Exec(Option_t * option) Print("") ; return ; } - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - if(gime->BranchExists("RecParticles") ) - return ; - Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ - gime->Event(ievent,"R") ; - - MakeRecParticles() ; - - WriteRecParticles(ievent); - - if(strstr(option,"deb")) - PrintRecParticles(option) ; - - //increment the total number of rec particles per run - fRecParticlesInRun += gime->RecParticles(BranchName())->GetEntriesFast() ; - + gime->Event(ievent,"TR") ; + if(gime->TrackSegments() && //Skip events, where no track segments made + gime->TrackSegments()->GetEntriesFast()) { + MakeRecParticles() ; + WriteRecParticles(ievent); + if(strstr(option,"deb")) + PrintRecParticles(option) ; + //increment the total number of rec particles per run + fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; + } } - if(strstr(option,"tim")){ gBenchmark->Stop("EMCALPID"); Info("Exec", "took %f seconds for PID %f seconds per event", gBenchmark->GetCpuTime("EMCALPID"), gBenchmark->GetCpuTime("EMCALPID")/nevents) ; } + + Unload(); } //____________________________________________________________________________ @@ -203,12 +158,12 @@ void AliEMCALPIDv1::MakeRecParticles(){ // Makes a RecParticle out of a TrackSegment - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TObjArray * aECRecPoints = gime->ECALRecPoints() ; - TObjArray * aPRRecPoints = gime->PRERecPoints() ; - TObjArray * aHCRecPoints = gime->HCALRecPoints() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + TObjArray * aECARecPoints = gime->ECARecPoints() ; + TObjArray * aPRERecPoints = gime->PRERecPoints() ; + TObjArray * aHCARecPoints = gime->HCARecPoints() ; TClonesArray * trackSegments = gime->TrackSegments() ; - if ( !aECRecPoints || !aPRRecPoints || !aHCRecPoints || !trackSegments ) { + if ( !aECARecPoints || !aPRERecPoints || !aHCARecPoints || !trackSegments ) { Fatal("MakeRecParticles", "RecPoints or TrackSegments not found !") ; } TClonesArray * recParticles = gime->RecParticles() ; @@ -225,30 +180,30 @@ void AliEMCALPIDv1::MakeRecParticles(){ rp->SetTrackSegment(index) ; rp->SetIndexInList(index) ; - AliEMCALTowerRecPoint * ecal = 0 ; - if(ts->GetECIndex()>=0) - ecal = dynamic_cast(aECRecPoints->At(ts->GetECIndex())) ; + AliEMCALTowerRecPoint * eca = 0 ; + if(ts->GetECAIndex()>=0) + eca = dynamic_cast(aECARecPoints->At(ts->GetECAIndex())) ; - AliEMCALTowerRecPoint * pre = 0 ; + AliEMCALTowerRecPoint * pre = 0 ; if(ts->GetPREIndex()>=0) - pre = dynamic_cast(aPRRecPoints->At(ts->GetPREIndex())) ; + pre = dynamic_cast(aPRERecPoints->At(ts->GetPREIndex())) ; - AliEMCALTowerRecPoint * hcal = 0 ; - if(ts->GetHCIndex()>=0) - hcal = dynamic_cast(aHCRecPoints->At(ts->GetHCIndex())) ; + AliEMCALTowerRecPoint * hca = 0 ; + if(ts->GetHCAIndex()>=0) + hca = dynamic_cast(aHCARecPoints->At(ts->GetHCAIndex())) ; // Now set type (reconstructed) of the particle // Choose the cluster energy range - if (!ecal) { - Fatal("MakeRecParticles", "-> emcal(%d) = %d", ts->GetECIndex(), ecal ) ; + if (!eca) { + Fatal("MakeRecParticles", "-> emcal(%d) = %d", ts->GetECAIndex(), eca ) ; } - Float_t e = ecal->GetEnergy() ; + Float_t e = eca->GetEnergy() ; Float_t lambda[2] ; - ecal->GetElipsAxis(lambda) ; + eca->GetElipsAxis(lambda) ; if((lambda[0]>0.01) && (lambda[1]>0.01)){ // Looking PCA. Define and calculate the data (X), @@ -260,16 +215,16 @@ void AliEMCALPIDv1::MakeRecParticles(){ if((lambda[0]+lambda[1])!=0) Spher=fabs(lambda[0]-lambda[1])/(lambda[0]+lambda[1]); - Emaxdtotal=ecal->GetMaximalEnergy()/ecal->GetEnergy(); + Emaxdtotal=eca->GetMaximalEnergy()/eca->GetEnergy(); } // Float_t time = ecal->GetTime() ; //Set momentum, energy and other parameters - Float_t encal = e; + Float_t enca = e; TVector3 dir(0., 0., 0.) ; - dir.SetMag(encal) ; - rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),encal) ; + dir.SetMag(enca) ; + rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),enca) ; rp->SetCalcMass(0); rp->Name(); //If photon sets the particle pdg name to gamma rp->SetProductionVertex(0,0,0,0); @@ -288,65 +243,10 @@ void AliEMCALPIDv1:: Print() { // Print the parameters used for the particle type identification - TString message ; - message = "\n=============== AliEMCALPID1 ================\n" ; - message += "Making PID\n"; - message += " Pricipal analysis file from 0.5 to 100 %s\n" ; - message += " Name of parameters file %s\n" ; - message += " Matrix of Parameters: 9x4\n" ; - message += " RCPV 2x3 rows x and z, columns function cut parameters\n" ; - message += " TOF 1x3 [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]\n" ; - message += " PCA 5x4 [5 ellipse parametres and 4 parametres to calculate them: A/Sqrt(E) + B* E + C * E^2 + D]\n" ; - message += " Energy Calibration 1x3 [3 parametres to calibrate energy: A + B* E + C * E^2]\n" ; - Info("Print", message.Data(), fFileName.Data(), fFileNamePar.Data() ) ; -} - -//____________________________________________________________________________ -void AliEMCALPIDv1::WriteRecParticles(Int_t event) -{ - - AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ; - - TClonesArray * recParticles = gime->RecParticles() ; - recParticles->Expand(recParticles->GetEntriesFast() ) ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - char name[10] ; - sprintf(name,"%s%d", "TreeR",event) ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - - if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; - } - - //First rp - Int_t bufferSize = 32000 ; - TBranch * rpBranch = treeR->Branch("EMCALRP",&recParticles,bufferSize); - rpBranch->SetTitle(BranchName()); - - - //second, pid - Int_t splitlevel = 0 ; - AliEMCALPIDv1 * pid = this ; - TBranch * pidBranch = treeR->Branch("AliEMCALPID","AliEMCALPIDv1",&pid,bufferSize,splitlevel); - pidBranch->SetTitle(BranchName()); - - rpBranch->Fill() ; - pidBranch->Fill() ; - - treeR->AutoSave() ; //Write(0,kOverwrite) ; - if(gAlice->TreeR()!=treeR){ - treeR->Delete(); - } + Info("Print", "=============== AliEMCALPID1 ================") ; + printf("Making PID\n"); + printf(" Pricipal analysis file from 0.5 to 100 %s\n", fFileName.Data() ) ; + printf(" Name of parameters file %s\n", fFileNamePar.Data() ) ; } //____________________________________________________________________________ @@ -354,9 +254,9 @@ void AliEMCALPIDv1::PrintRecParticles(Option_t * option) { // Print table of reconstructed particles - AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter *gime = AliEMCALGetter::Instance() ; - TClonesArray * recParticles = gime->RecParticles(BranchName()) ; + TClonesArray * recParticles = gime->RecParticles() ; TString message ; message = "\nevent " ; @@ -382,5 +282,36 @@ void AliEMCALPIDv1::PrintRecParticles(Option_t * option) Info("Print", message.Data() ) ; } +//____________________________________________________________________________ +void AliEMCALPIDv1::Unload() +{ + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + gime->EmcalLoader()->UnloadRecPoints() ; + gime->EmcalLoader()->UnloadTracks() ; + gime->EmcalLoader()->UnloadRecParticles() ; +} + +//____________________________________________________________________________ +void AliEMCALPIDv1::WriteRecParticles(Int_t event) +{ + + AliEMCALGetter *gime = AliEMCALGetter::Instance() ; + + TClonesArray * recParticles = gime->RecParticles() ; + recParticles->Expand(recParticles->GetEntriesFast() ) ; + TTree * treeP = gime->TreeP() ; + + + //First rp + Int_t bufferSize = 32000 ; + TBranch * rpBranch = treeP->Branch("EMCALRP",&recParticles,bufferSize); + rpBranch->SetTitle(BranchName()); + + rpBranch->Fill() ; + + gime->WriteRecParticles("OVERWRITE"); + gime->WritePID("OVERWRITE"); + +} diff --git a/EMCAL/AliEMCALPIDv1.h b/EMCAL/AliEMCALPIDv1.h index fc89e4451c4..6859f1d2540 100644 --- a/EMCAL/AliEMCALPIDv1.h +++ b/EMCAL/AliEMCALPIDv1.h @@ -15,7 +15,7 @@ // --- ROOT system --- //class TFormula ; class TVector3 ; -class TMatrixD ; +class TMatrix ; class TPrincipal ; // --- Standard library --- @@ -31,13 +31,13 @@ class AliEMCALPIDv1 : public AliEMCALPID { public: AliEMCALPIDv1() ; // ctor - AliEMCALPIDv1(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ; - + AliEMCALPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliEMCALPIDv1(const AliEMCALPIDv1 & pid) ; // cpy ctor + virtual ~AliEMCALPIDv1() ; // dtor virtual void Exec(Option_t * option) ; - // virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;} - // virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); } + virtual const Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;} virtual void Print(Option_t * option) const {} @@ -58,19 +58,18 @@ class AliEMCALPIDv1 : public AliEMCALPID { void MakeRecParticles(void ) ; void PrintRecParticles(Option_t * option) ; virtual void WriteRecParticles(Int_t event) ; - - + void Unload(); private: - Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) - TString fFileName ; // File that contains the Principal file for analysis - TString fFileNamePar ;// File that contains the parameters for analysis - Int_t fNEvent ; //! current event number - Bool_t fPi0Analysis; //! Pi0 analysis on or off - Int_t fRecParticlesInRun ; //! Total number of recparticles in one run + Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) + Int_t fNEvent ; //! current event number + TString fFileName ; // File that contains the Principal file for analysis + TString fFileNamePar ; // File that contains the parameters for analysis + Bool_t fPi0Analysis; //! Pi0 analysis on or off + Int_t fRecParticlesInRun ; //! Total number of recparticles in one run - ClassDef( AliEMCALPIDv1,6) // Particle identifier implementation version 1 + ClassDef( AliEMCALPIDv1,7) // Particle identifier implementation version 1 }; diff --git a/EMCAL/AliEMCALParton.cxx b/EMCAL/AliEMCALParton.cxx index b265ea9060e..9207c405063 100644 --- a/EMCAL/AliEMCALParton.cxx +++ b/EMCAL/AliEMCALParton.cxx @@ -16,6 +16,12 @@ /* $Id: */ /* $Log$ + Revision 1.5.4.1 2003/07/08 17:16:50 schutz + NewIO + + Revision 1.5 2003/03/17 17:29:54 hristov + Using Riostream.h instead of iostream.h + Revision 1.4 2003/03/17 14:26:06 morsch Updates by M. Horner and J. Klay diff --git a/EMCAL/AliEMCALRecParticle.cxx b/EMCAL/AliEMCALRecParticle.cxx index b181c43fa07..bb7aa8f7316 100644 --- a/EMCAL/AliEMCALRecParticle.cxx +++ b/EMCAL/AliEMCALRecParticle.cxx @@ -29,7 +29,6 @@ // --- AliRoot header files --- -#include "AliHeader.h" #include "AliEMCALRecParticle.h" #include "AliEMCALGetter.h" #include "TParticle.h" @@ -72,20 +71,17 @@ ClassImp(AliEMCALRecParticle) //____________________________________________________________________________ const Int_t AliEMCALRecParticle::GetNPrimaries() const { - AliHeader *h = gAlice->GetHeader(); - return h->GetNprimary(); - // return gAlice->GetNtrack(); + return -1; } //____________________________________________________________________________ const Int_t AliEMCALRecParticle::GetNPrimariesToRecParticles() const { - Int_t rv = 0 ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - Int_t emcRPindex = ( dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex())) )->GetECIndex(); - (dynamic_cast(gime->ECALRecPoints()->At(emcRPindex)))->GetPrimaries(rv) ; - return rv ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + Int_t ecaRPindex = dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex()))->GetECAIndex(); + dynamic_cast(gime->ECARecPoints()->At(ecaRPindex))->GetPrimaries(rv) ; + return rv ; } //____________________________________________________________________________ @@ -93,27 +89,18 @@ const TParticle * AliEMCALRecParticle::GetPrimary(Int_t index) const { if ( index > GetNPrimariesToRecParticles() ) { if (fDebug) - Warning("GetPrimary", "%d is larger that the number of primaries %d", index, GetNPrimaries()) ; - } else { - Int_t dummy ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - Int_t emcRPindex = ( dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex())) )->GetECIndex(); - Int_t *list = static_cast(gime->ECALRecPoints()->At(emcRPindex))->GetPrimaries(dummy) ; - Int_t primaryindex ; - if(index4999999){ - if (fDebug) - printf("No method to extract primaries from background!\n") ; - return 0 ; - } - return gime->Primary(primaryindex) ; + Warning("GetPrimary", "AliEMCALRecParticle::GetPrimary -> %d is larger that the number of primaries %d", + index, GetNPrimaries()) ; + return 0 ; } + else { + Int_t dummy ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + + Int_t ecaRPindex = dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex()))->GetECAIndex(); + Int_t primaryindex = dynamic_cast(gime->ECARecPoints()->At(ecaRPindex))->GetPrimaries(dummy)[index] ; + return gime->Primary(primaryindex) ; + } return 0 ; } diff --git a/EMCAL/AliEMCALRecPoint.cxx b/EMCAL/AliEMCALRecPoint.cxx index 0ef89886e39..88ef2a9052d 100644 --- a/EMCAL/AliEMCALRecPoint.cxx +++ b/EMCAL/AliEMCALRecPoint.cxx @@ -25,7 +25,6 @@ #include "TClonesArray.h" // --- Standard library --- -#include // --- AliRoot header files --- @@ -46,7 +45,7 @@ AliEMCALRecPoint::AliEMCALRecPoint() fMaxTrack = 0 ; fTheta = fPhi = 0. ; fEMCALArm = 0; - fPRESection = fECALSection = fHCALSection = kFALSE ; + fPRESection = fECASection = fHCASection = kFALSE ; } //____________________________________________________________________________ @@ -109,8 +108,7 @@ void AliEMCALRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) case kButton1Down:{ AliEMCALDigit * digit ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - AliEMCALGeometry * emcalgeom = const_cast(gime->EMCALGeometry()); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry() ; Int_t iDigit; Int_t relid[4] ; @@ -169,7 +167,8 @@ break; } } //____________________________________________________________________________ -void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) { +void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) +{ //evaluates (if necessary) all RecPoint data members EvalPrimaries(digits) ; @@ -184,8 +183,7 @@ void AliEMCALRecPoint::EvalEMCALArm(AliEMCALDigit * digit) if( fEMCALArm == 0){ Int_t relid[4] ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - AliEMCALGeometry * emcalgeom = const_cast(gime->EMCALGeometry()); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ; fEMCALArm = relid[0]; @@ -247,14 +245,14 @@ void AliEMCALRecPoint::GetGlobalPosition(TVector3 & gpos) const { // returns the position of the cluster in the global reference system of ALICE - AliEMCALGeometry * emcalgeom = AliEMCALGetter::GetInstance()->EMCALGeometry(); + AliEMCALGeometry * emcalgeom = AliEMCALGetter::Instance()->EMCALGeometry(); gpos.SetX(fPhi) ; - if ( IsInECAL() ) - gpos.SetY(emcalgeom->GetIP2ECALSection()) ; + if ( IsInECA() ) + gpos.SetY(emcalgeom->GetIP2ECASection()) ; else if ( IsInPRE() ) gpos.SetY(emcalgeom->GetIP2PRESection()) ; - else if ( IsInHCAL() ) - gpos.SetY(emcalgeom->GetIP2HCALSection()) ; + else if ( IsInHCA() ) + gpos.SetY(emcalgeom->GetIP2HCASection()) ; else Fatal("GetGlobalPosition", "Unexpected tower section") ; gpos.SetZ(fTheta) ; diff --git a/EMCAL/AliEMCALRecPoint.h b/EMCAL/AliEMCALRecPoint.h index b8fb75150b1..5db556d5c7b 100644 --- a/EMCAL/AliEMCALRecPoint.h +++ b/EMCAL/AliEMCALRecPoint.h @@ -59,8 +59,8 @@ class AliEMCALRecPoint : public AliRecPoint { virtual Int_t * GetPrimaries(Int_t & number) const {number = fMulTrack ; return fTracksList ; } virtual Bool_t IsEmc(void)const { return kTRUE ; } - const Bool_t IsInECAL(void) const { return fECALSection ; } - const Bool_t IsInHCAL(void) const { return fHCALSection ; } + const Bool_t IsInECA(void) const { return fECASection ; } + const Bool_t IsInHCA(void) const { return fHCASection ; } const Bool_t IsInPRE(void) const { return fPRESection ; } virtual Bool_t IsSortable() const { // tells that this is a sortable object @@ -71,8 +71,8 @@ class AliEMCALRecPoint : public AliRecPoint { // Print prototype } - void SetECAL() { fECALSection = kTRUE ; } - void SetHCAL() { fHCALSection = kTRUE ; } + void SetECA() { fECASection = kTRUE ; } + void SetHCA() { fHCASection = kTRUE ; } void SetPRE() { fPRESection = kTRUE ; } AliEMCALRecPoint & operator = (const AliEMCALRecPoint & ) { // assignement operator requested by coding convention but not needed @@ -85,8 +85,8 @@ protected: Int_t fEMCALArm ; // EMCAM Arm number Float_t fTheta ; // theta angle in Alice Float_t fPhi ; // phi angle in Alice - Bool_t fECALSection ; // tells if the recpoint is in ECAL section - Bool_t fHCALSection ; // tells if the recpoint is in HCAL section + Bool_t fECASection ; // tells if the recpoint is in ECAL section + Bool_t fHCASection ; // tells if the recpoint is in HCAL section Bool_t fPRESection ; // tells if the recpoint is in PRE section ClassDef(AliEMCALRecPoint,2) // RecPoint for EMCAL (Base Class) diff --git a/EMCAL/AliEMCALSDigitizer.cxx b/EMCAL/AliEMCALSDigitizer.cxx index 1c56cf8c3ef..7652203ee53 100644 --- a/EMCAL/AliEMCALSDigitizer.cxx +++ b/EMCAL/AliEMCALSDigitizer.cxx @@ -50,55 +50,57 @@ // --- ROOT system --- #include "TFile.h" -#include "TTask.h" -#include "TTree.h" -#include "TSystem.h" #include "TROOT.h" -#include "TFolder.h" #include "TBenchmark.h" -#include "TGeometry.h" // --- Standard library --- // --- AliRoot header files --- #include "AliRun.h" -#include "AliHeader.h" #include "AliEMCALDigit.h" -#include "AliEMCALGeometry.h" #include "AliEMCALGetter.h" #include "AliEMCALHit.h" #include "AliEMCALSDigitizer.h" +#include "AliEMCALGeometry.h" ClassImp(AliEMCALSDigitizer) //____________________________________________________________________________ - AliEMCALSDigitizer::AliEMCALSDigitizer():TTask("AliEMCALSDigitizer","") + AliEMCALSDigitizer::AliEMCALSDigitizer():TTask("","") { // ctor InitParameters() ; - fSplitFile = 0 ; - fToSplit = kFALSE ; fDefaultInit = kTRUE ; } //____________________________________________________________________________ -AliEMCALSDigitizer::AliEMCALSDigitizer(const char* headerFile, const char *sDigitsTitle, const Bool_t toSplit): -TTask(sDigitsTitle, headerFile) +AliEMCALSDigitizer::AliEMCALSDigitizer(const char * alirunFileName, const char * eventFolderName): + TTask("EMCAL"+AliConfig::fgkSDigitizerTaskName, alirunFileName), + fEventFolderName(eventFolderName) { // ctor - fToSplit = toSplit ; Init(); InitParameters() ; fDefaultInit = kFALSE ; } + //____________________________________________________________________________ -AliEMCALSDigitizer::~AliEMCALSDigitizer() -{ - // dtor - fSplitFile = 0 ; +AliEMCALSDigitizer::AliEMCALSDigitizer(const AliEMCALSDigitizer & sd) { + //cpy ctor + + fA = sd.fA ; + fB = sd.fB ; + fPREPrimThreshold = sd.fPREPrimThreshold ; + fECPrimThreshold = sd.fECPrimThreshold ; + fHCPrimThreshold = sd.fHCPrimThreshold ; + fSDigitsInRun = sd.fSDigitsInRun ; + SetName(sd.GetName()) ; + SetTitle(sd.GetTitle()) ; + fEventFolderName = sd.fEventFolderName; } + //____________________________________________________________________________ void AliEMCALSDigitizer::Init(){ // Initialization: open root-file, allocate arrays for hits and sdigits, @@ -108,49 +110,23 @@ void AliEMCALSDigitizer::Init(){ //============================================================= YS // The initialisation is now done by the getter - if( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; + fInit = kTRUE ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), fToSplit) ; + AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data()); if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !" ) ; + Fatal("Init", "Could not obtain the Getter objectfor file %s and event %s !", GetTitle(), fEventFolderName.Data()) ; return ; } - gime->PostSDigits( GetName(), GetTitle() ) ; - - fSplitFile = 0 ; - - if(fToSplit){ - // construct the name of the file as /path/EMCAL.SDigits.root - // First - extract full path if necessary - TString sDigitsFileName(GetTitle()) ; - Ssiz_t islash = sDigitsFileName.Last('/') ; - if(islash(gROOT->GetFile(sDigitsFileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(sDigitsFileName.Data(),"update") ; + TString opt("SDigits") ; + if(gime->VersionExists(opt) ) { + Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ; + fInit = kFALSE ; } - - TString sdname(GetName() ); - sdname.Append(":") ; - sdname.Append(GetTitle() ) ; - SetName(sdname) ; - gime->PostSDigitizer(this) ; - + + gime->PostSDigitizer(this); + gime->EmcalLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + } //____________________________________________________________________________ @@ -159,7 +135,7 @@ void AliEMCALSDigitizer::InitParameters() fA = 0; fB = 10000000.; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; const AliEMCALGeometry * geom = gime->EMCALGeometry() ; if (geom->GetSampling() == 0.) { Error("InitParameters", "Sampling factor not set !") ; @@ -179,9 +155,6 @@ void AliEMCALSDigitizer::InitParameters() void AliEMCALSDigitizer::Exec(Option_t *option) { // Collects all hits in the section (PRE/ECAL/HCAL) of the same tower into digit - - if( strcmp(GetName(), "") == 0 ) - Init() ; if (strstr(option, "print") ) { Print("") ; @@ -191,28 +164,31 @@ void AliEMCALSDigitizer::Exec(Option_t *option) if(strstr(option,"tim")) gBenchmark->Start("EMCALSDigitizer"); - //Check, if this branch already exits - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - if(gime->BranchExists("SDigits") ) - return; - - TString sdname(GetName()) ; - sdname.Remove(sdname.Index(GetTitle())-1) ; - + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + + //switch off reloading of this task while getting event + if (!fInit) { // to prevent overwrite existing file + Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ; + return ; + } + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ + gime->Event(ievent,"H") ; - const TClonesArray * hits = gime->Hits() ; - TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; + + TTree * treeS = gime->TreeS(); + TClonesArray * hits = gime->Hits() ; + TClonesArray * sdigits = gime->SDigits() ; sdigits->Clear(); Int_t nSdigits = 0 ; - //Now make SDigits from hits, for EMCAL it is the same, so just copy - Int_t nPrim = static_cast((gAlice->TreeH())->GetEntries()) ; + Int_t nPrim = static_cast((gime->TreeH())->GetEntries()) ; // Attention nPrim is the number of primaries tracked by Geant // and this number could be different to the number of Primaries in TreeK; Int_t iprim ; + for ( iprim = 0 ; iprim < nPrim ; iprim++ ) { //=========== Get the EMCAL branch from Hits Tree for the Primary iprim gime->Track(iprim) ; @@ -225,13 +201,8 @@ void AliEMCALSDigitizer::Exec(Option_t *option) // Assign primary number only if deposited energy is significant - const AliEMCALGeometry * geom = gime->EMCALGeometry() ; + AliEMCALGeometry * geom = gime->EMCALGeometry() ; - if (gDebug) { - Info("Exec", "id = %d energy = %f thresholdPRE = %f thresholdEC = %f thresholdHC = %f \n", - hit->GetId(), hit->GetEnergy(), fPREPrimThreshold, fECPrimThreshold, fHCPrimThreshold) ; - Info("Exec", "where PRE/ECAL/HCAL %d, %d, %d", geom->IsInPRE(hit->GetId()), geom->IsInECAL(hit->GetId()), geom->IsInHCAL(hit->GetId()) ) ; - } if( geom->IsInPRE(hit->GetId()) ) if( hit->GetEnergy() > fPREPrimThreshold ) curSDigit = new AliEMCALDigit( hit->GetPrimary(), @@ -242,7 +213,7 @@ void AliEMCALSDigitizer::Exec(Option_t *option) -1 , hit->GetId(), Digitize(hit->GetEnergy()), hit->GetTime() ) ; - else if( geom->IsInECAL(hit->GetId()) ) + else if( geom->IsInECA(hit->GetId()) ) if( hit->GetEnergy() > fECPrimThreshold ) curSDigit = new AliEMCALDigit( hit->GetPrimary(), hit->GetIparent(), hit->GetId(), @@ -252,7 +223,7 @@ void AliEMCALSDigitizer::Exec(Option_t *option) -1 , hit->GetId(), Digitize(hit->GetEnergy()), hit->GetTime() ) ; - else if( geom->IsInHCAL(hit->GetId()) ) + else if( geom->IsInHCA(hit->GetId()) ) if( hit->GetEnergy() > fHCPrimThreshold ) curSDigit = new AliEMCALDigit( hit->GetPrimary(), @@ -298,35 +269,29 @@ void AliEMCALSDigitizer::Exec(Option_t *option) NPrimarymax = ((dynamic_cast(sdigits->At(i)))->GetNprimary()) ; } - // Now write SDigits - - if(gAlice->TreeS() == 0 || (fSplitFile)) //<--- To be checked: we should not create TreeS if it is already here - gAlice->MakeTree("S",fSplitFile); - - if(fSplitFile) - fSplitFile->cd() ; + // Now write SDigits //First list of sdigits + Int_t bufferSize = 32000 ; - TBranch * sdigitsBranch = gAlice->TreeS()->Branch("EMCAL",&sdigits,bufferSize); - sdigitsBranch->SetTitle(sdname); + TBranch * sdigitsBranch = treeS->Branch("EMCAL",&sdigits,bufferSize); + + sdigitsBranch->Fill() ; + + gime->WriteSDigits("OVERWRITE"); //NEXT - SDigitizer - Int_t splitlevel = 0 ; - AliEMCALSDigitizer * sd = this ; - TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliEMCALSDigitizer","AliEMCALSDigitizer", - &sd,bufferSize,splitlevel); - sdigitizerBranch->SetTitle(sdname); - - sdigitsBranch->Fill() ; - sdigitizerBranch->Fill() ; - - gAlice->TreeS()->AutoSave() ; + + gime->WriteSDigitizer("OVERWRITE"); if(strstr(option,"deb")) PrintSDigits(option) ; } - + + Unload(); + + gime->EmcalLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + if(strstr(option,"tim")){ gBenchmark->Stop("EMCALSDigitizer"); Info("Exec", "took %f seconds for SDigitizing %f seconds per event", @@ -334,59 +299,20 @@ void AliEMCALSDigitizer::Exec(Option_t *option) } } -//__________________________________________________________________ -void AliEMCALSDigitizer::SetSDigitsBranch(const char * title ){ - - // Setting title to branch SDigits - - TString stitle(title) ; - - // check if branch with title already exists - TBranch * sdigitsBranch = - static_cast(gAlice->TreeS()->GetListOfBranches()->FindObject("EMCAL")) ; - TBranch * sdigitizerBranch = - static_cast(gAlice->TreeS()->GetListOfBranches()->FindObject("AliEMCALSDigitizer")) ; - const char * sdigitsTitle = sdigitsBranch ->GetTitle() ; - const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ; - if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){ - Error("SetSDigitsBranch", "Cannot overwrite existing branch with title %s", title) ; - return ; - } - - Info("SetSDigitsBranch", "Changing SDigits file from %s to %s", GetName(), title) ; - - SetName(title) ; - - // Post to the WhiteBoard - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - gime->PostSDigits( title, GetTitle()) ; -} - //__________________________________________________________________ void AliEMCALSDigitizer::Print(Option_t* option)const { // Prints parameters of SDigitizer + Info("Print", "\n------------------- %s -------------", GetName() ) ; + printf(" Writing SDigits to branch with title %s\n", fEventFolderName.Data()) ; + printf(" with digitization parameters A = %f\n", fA) ; + printf(" B = %f\n", fB) ; + printf(" Threshold for PRE Primary assignment= %f\n", fPREPrimThreshold) ; + printf(" Threshold for EC Primary assignment= %f\n", fECPrimThreshold) ; + printf(" Threshold for HC Primary assignment= %f\n", fHCPrimThreshold) ; + printf("---------------------------------------------------\n") ; - TString message("\n") ; - message += "------------------- "; - message += GetName() ; - message += " -------------\n" ; - message += " Writing SDigitis to branch with title " ; - message += GetName() ; - message += "\n with digitization parameters A = " ; - message += fA ; - message += "\n B = " ; - message += fB ; - message += "\n Threshold for Primary assignment in PreShower = " ; - message += fPREPrimThreshold ; - message += "\n Threshold for Primary assignment in EC section= " ; - message += fECPrimThreshold ; - message += "\n Threshold for Primary assignment in HC section= " ; - message += fHCPrimThreshold ; - message += "\n---------------------------------------------------" ; - - Info("Print", message.Data() ) ; } //__________________________________________________________________ @@ -408,10 +334,8 @@ Bool_t AliEMCALSDigitizer::operator==( AliEMCALSDigitizer const &sd )const void AliEMCALSDigitizer::PrintSDigits(Option_t * option){ //Prints list of digits produced at the current pass of AliEMCALDigitizer - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TString sdname(GetName()) ; - sdname.Remove(sdname.Index(GetTitle())-1) ; - const TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + const TClonesArray * sdigits = gime->SDigits() ; TString message("\n") ; message += "event " ; @@ -442,24 +366,11 @@ void AliEMCALSDigitizer::PrintSDigits(Option_t * option){ Info("PrintSDigits", message.Data() ) ; } -//_______________________________________________________________________________________ -// void AliEMCALSDigitizer::TestTowerID(void) -// { -// Int_t j; - -// Bool_t preshower = kFALSE; -// for (j = 0 ; j < 10 ; j++){ // loop over hit id -// Int_t i; -// for (i = 0 ; i <= 2 ; i++){ // loop over -// Int_t k = i*96*144+j*144+1; -// Info("TestTowerID", " Hit Index = %d %d TOWERID = %d", k, j*10, Layer2TowerID(k, preshower) ) ; -// } -// } -// } - //____________________________________________________________________________ -void AliEMCALSDigitizer::UseHitsFrom(const char * filename) +void AliEMCALSDigitizer::Unload() const { - SetTitle(filename) ; - Init() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + AliEMCALLoader * loader = gime->EmcalLoader() ; + loader->UnloadHits() ; + loader->UnloadSDigits() ; } diff --git a/EMCAL/AliEMCALSDigitizer.h b/EMCAL/AliEMCALSDigitizer.h index 24acce0f824..0c4b1c32048 100644 --- a/EMCAL/AliEMCALSDigitizer.h +++ b/EMCAL/AliEMCALSDigitizer.h @@ -12,43 +12,41 @@ // // Modif: // August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction -// of new IO (à la PHOS) +// July 2003 Yves Schutz: new IO (à la PHOS) // --- ROOT system --- #include "TTask.h" -#include "TString.h" +class TFile ; + // --- Standard library --- // --- AliRoot header files --- +#include "AliConfig.h" class AliEMCALSDigitizer: public TTask { public: AliEMCALSDigitizer() ; // ctor - AliEMCALSDigitizer(const char* headerFile,const char* hdigitsTitle = "Default", const Bool_t toSplit = kFALSE) ; - virtual ~AliEMCALSDigitizer() ; // dtor + AliEMCALSDigitizer(const char * alirunFileName, const char * eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliEMCALSDigitizer(const AliEMCALSDigitizer & sd) ; + virtual ~AliEMCALSDigitizer() {;} // dtor - Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; } - Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); } + Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; } + Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); } virtual void Exec(Option_t *option); - const char * GetSDigitsBranch()const{return GetName();} - const Int_t GetSDigitsInRun() const {return fSDigitsInRun ;} - const Float_t GetPedestalParameter()const {return fA;} - const Float_t GetCalibrationParameter()const{return fB;} + Int_t GetSDigitsInRun() const {return fSDigitsInRun ;} virtual void Print(Option_t* option) const ; - void SetSDigitsBranch(const char * title ) ; - void SetPedestalParameter(Float_t A){fA = A ;} - void SetSlopeParameter(Float_t B){fB = B ;} - void UseHitsFrom(const char * filename) ; + void SetEventFolderName(TString name) { fEventFolderName = name ; } + Bool_t operator == (const AliEMCALSDigitizer & sd) const ; -// const Int_t Segment2TowerID(Int_t SegmentID){ -// return Layer2TowerID(SegmentID,0); -// } + AliEMCALSDigitizer & operator = (const AliEMCALSDigitizer & sd) {return *this ;} + private: void Init() ; void InitParameters() ; void PrintSDigits(Option_t * option) ; + void Unload() const ; private: Float_t fA ; // Pedestal parameter @@ -57,11 +55,11 @@ private: Float_t fECPrimThreshold ; // To store primary if EC Shower Elos > threshold Float_t fHCPrimThreshold ; // To store primary if HC Shower Elos > threshold Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) + TString fEventFolderName; // event folder name + Bool_t fInit ; //! tells if initialisation wennt OK, will revent exec if not Int_t fSDigitsInRun ; //! Total number of sdigits in one run - TFile * fSplitFile ; //! file in which SDigits will eventually be stored - Bool_t fToSplit ; //! Says that sigits should be written into splip file - ClassDef(AliEMCALSDigitizer,4) // description + ClassDef(AliEMCALSDigitizer,5) // description }; diff --git a/EMCAL/AliEMCALTowerRecPoint.cxx b/EMCAL/AliEMCALTowerRecPoint.cxx index 2c4811d4485..47e1ea9f580 100644 --- a/EMCAL/AliEMCALTowerRecPoint.cxx +++ b/EMCAL/AliEMCALTowerRecPoint.cxx @@ -23,7 +23,6 @@ // --- ROOT system --- -#include "TPad.h" #include "TH2.h" #include "TMath.h" #include "TCanvas.h" @@ -125,8 +124,7 @@ Bool_t AliEMCALTowerRecPoint::AreNeighbours(AliEMCALDigit * digit1, AliEMCALDigi Bool_t aren = kFALSE ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - AliEMCALGeometry * phosgeom = (AliEMCALGeometry*)gime->EMCALGeometry(); + AliEMCALGeometry * phosgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); Int_t relid1[4] ; phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; @@ -196,10 +194,8 @@ void AliEMCALTowerRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const // and switched off when the mouse button is released. - // AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; -// if(!gime) return ; -// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry(); - + // AliEMCALGeometry * phosgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); + // static TGraph * digitgraph = 0 ; // if (!gPad->IsEditable()) return; @@ -305,7 +301,7 @@ void AliEMCALTowerRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * dig AliEMCALDigit * digit ; - AliEMCALGeometry * emcalgeom = AliEMCALGetter::GetInstance()->EMCALGeometry(); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); // Calculates the center of gravity in the local EMCAL-module coordinates @@ -321,10 +317,10 @@ void AliEMCALTowerRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * dig if (IsInPRE()) cyl_radius = emcalgeom->GetIP2PRESection() ; - else if (IsInECAL()) - cyl_radius = emcalgeom->GetIP2ECALSection() ; - else if (IsInHCAL()) - cyl_radius = emcalgeom->GetIP2HCALSection() ; + else if (IsInECA()) + cyl_radius = emcalgeom->GetIP2ECASection() ; + else if (IsInHCA()) + cyl_radius = emcalgeom->GetIP2HCASection() ; else Fatal("EvalDispersion", "Unexpected tower section!") ; @@ -375,7 +371,7 @@ void AliEMCALTowerRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * dig AliEMCALDigit * digit ; Float_t wtot = 0. ; - AliEMCALGeometry * emcalgeom = AliEMCALGetter::GetInstance()->EMCALGeometry(); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); Int_t iDigit; if (!fTheta || !fPhi ) { @@ -402,7 +398,7 @@ void AliEMCALTowerRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * dig const Float_t kDeg2Rad = TMath::DegToRad() ; - Float_t cyl_radius = emcalgeom->GetIP2ECALSection(); + Float_t cyl_radius = emcalgeom->GetIP2ECASection(); Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ; Float_t y = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ; Float_t z = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ; @@ -438,7 +434,7 @@ void AliEMCALTowerRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digi AliEMCALDigit * digit ; - AliEMCALGeometry * emcalgeom = AliEMCALGetter::GetInstance()->EMCALGeometry(); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); Int_t iDigit; const Float_t kDeg2Rad = TMath::DegToRad() ; @@ -447,10 +443,10 @@ void AliEMCALTowerRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digi if (IsInPRE()) cyl_radius = emcalgeom->GetIP2PRESection() ; - else if (IsInECAL()) - cyl_radius = emcalgeom->GetIP2ECALSection() ; - else if (IsInHCAL()) - cyl_radius = emcalgeom->GetIP2HCALSection() ; + else if (IsInECA()) + cyl_radius = emcalgeom->GetIP2ECASection() ; + else if (IsInHCA()) + cyl_radius = emcalgeom->GetIP2HCASection() ; else Fatal("EvalDispersion", "Unexpected tower section!") ; @@ -483,8 +479,7 @@ void AliEMCALTowerRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digi // //Apply correction due to non-perpendicular incidence // Double_t CosX ; // Double_t CosZ ; -// AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; -// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry(); +// AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); // Double_t DistanceToIP= (Double_t ) emcalgeom->GetIPDistance() ; // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ; @@ -532,7 +527,7 @@ void AliEMCALTowerRecPoint::EvalGlobalPosition(Float_t logWeight, TClonesArray * // Int_t relid[4] ; AliEMCALDigit * digit ; - AliEMCALGeometry * emcalgeom = AliEMCALGetter::GetInstance()->EMCALGeometry(); + AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry(); Int_t iDigit; for(iDigit=0; iDigitGetIP2PRESection() ; - else if (IsInECAL()) - cyl_radius = emcalgeom->GetIP2ECALSection() ; - else if (IsInHCAL()) - cyl_radius = emcalgeom->GetIP2HCALSection() ; + else if (IsInECA()) + cyl_radius = emcalgeom->GetIP2ECASection() ; + else if (IsInHCA()) + cyl_radius = emcalgeom->GetIP2HCASection() ; else Fatal("EvalGlobalPosition", "Unexpected tower section!") ; diff --git a/EMCAL/AliEMCALTrackSegment.cxx b/EMCAL/AliEMCALTrackSegment.cxx index ec28bec5008..c04e98d1e6e 100644 --- a/EMCAL/AliEMCALTrackSegment.cxx +++ b/EMCAL/AliEMCALTrackSegment.cxx @@ -34,7 +34,7 @@ ClassImp(AliEMCALTrackSegment) //____________________________________________________________________________ -AliEMCALTrackSegment::AliEMCALTrackSegment( AliEMCALTowerRecPoint * ec, AliEMCALTowerRecPoint * pre, AliEMCALTowerRecPoint * hc) +AliEMCALTrackSegment::AliEMCALTrackSegment( AliEMCALTowerRecPoint * eca, AliEMCALTowerRecPoint * pre, AliEMCALTowerRecPoint * hca) { // ctor @@ -43,15 +43,15 @@ AliEMCALTrackSegment::AliEMCALTrackSegment( AliEMCALTowerRecPoint * ec, AliEMCAL else fPRERecPoint = -1 ; - if( ec ) - fECRecPoint = ec->GetIndexInList() ; + if( eca ) + fECARecPoint = eca->GetIndexInList() ; else - fECRecPoint = -1 ; + fECARecPoint = -1 ; - if( hc ) - fHCRecPoint = hc->GetIndexInList() ; + if( hca ) + fHCARecPoint = hca->GetIndexInList() ; else - fHCRecPoint = -1 ; + fHCARecPoint = -1 ; fIndexInList = -1 ; } @@ -72,8 +72,8 @@ void AliEMCALTrackSegment::Copy(TObject & obj) TObject::Copy(obj) ; ( (AliEMCALTrackSegment &)obj ).fPRERecPoint = fPRERecPoint ; - ( (AliEMCALTrackSegment &)obj ).fECRecPoint = fECRecPoint ; - ( (AliEMCALTrackSegment &)obj ).fHCRecPoint = fHCRecPoint ; + ( (AliEMCALTrackSegment &)obj ).fECARecPoint = fECARecPoint ; + ( (AliEMCALTrackSegment &)obj ).fHCARecPoint = fHCARecPoint ; ( (AliEMCALTrackSegment &)obj ).fIndexInList = fIndexInList ; } @@ -88,10 +88,10 @@ void AliEMCALTrackSegment::Print(Option_t * opt) const printf("Stored at position %d\n", fIndexInList) ; if (fPRERecPoint) printf("PRE RecPoint # %d\n", fPRERecPoint) ; - if (fECRecPoint) - printf("EC RecPoint # %d\n", fECRecPoint) ; - if (fHCRecPoint) - printf("HC RecPoint # %d\n", fHCRecPoint) ; + if (fECARecPoint) + printf("EC RecPoint # %d\n", fECARecPoint) ; + if (fHCARecPoint) + printf("HC RecPoint # %d\n", fHCARecPoint) ; printf("------------------------------------ \n") ; @@ -108,11 +108,11 @@ void AliEMCALTrackSegment::SetPRERecPoint(AliEMCALRecPoint * pre) } //____________________________________________________________________________ -void AliEMCALTrackSegment::SetHCRecPoint(AliEMCALRecPoint * hc) +void AliEMCALTrackSegment::SetHCARecPoint(AliEMCALRecPoint * hca) { // gives an id from its position in the list - if( hc ) - fHCRecPoint = hc->GetIndexInList() ; + if( hca ) + fHCARecPoint = hca->GetIndexInList() ; else - fHCRecPoint = -1 ; + fHCARecPoint = -1 ; } diff --git a/EMCAL/AliEMCALTrackSegment.h b/EMCAL/AliEMCALTrackSegment.h index ab574f38416..46bf284ee09 100644 --- a/EMCAL/AliEMCALTrackSegment.h +++ b/EMCAL/AliEMCALTrackSegment.h @@ -34,21 +34,21 @@ public: Int_t GetIndexInList() const { return fIndexInList ; } Int_t GetPREIndex() const { return fPRERecPoint ; } - Int_t GetECIndex() const { return fECRecPoint; } - Int_t GetHCIndex() const { return fHCRecPoint; } + Int_t GetECAIndex() const { return fECARecPoint; } + Int_t GetHCAIndex() const { return fHCARecPoint; } virtual void Print(Option_t * option) const; void SetIndexInList(Int_t val){ fIndexInList = val ; } void SetPRERecPoint(AliEMCALRecPoint * pre ) ; - void SetHCRecPoint(AliEMCALRecPoint * hc ) ; + void SetHCARecPoint(AliEMCALRecPoint * hc ) ; typedef TClonesArray TrackSegmentsList ; private: Int_t fPRERecPoint ; // The PRE reconstructed point index in array stored in TreeR/EMCALPRERP - Int_t fECRecPoint ; // The EC reconstructed point index in array stored in TreeR/EMCALECRP - Int_t fHCRecPoint ; // The HC reconstructed point index in array stored in TreeR/EMCALHCRP + Int_t fECARecPoint ; // The EC reconstructed point index in array stored in TreeR/EMCALECRP + Int_t fHCARecPoint ; // The HC reconstructed point index in array stored in TreeR/EMCALHCRP Int_t fIndexInList ; // The index of this TrackSegment in the list stored in TreeR (to be set by analysis) ClassDef(AliEMCALTrackSegment,1) // Track segment in EMCAL diff --git a/EMCAL/AliEMCALTrackSegmentMaker.cxx b/EMCAL/AliEMCALTrackSegmentMaker.cxx index ef752640788..dc7a98a7d38 100644 --- a/EMCAL/AliEMCALTrackSegmentMaker.cxx +++ b/EMCAL/AliEMCALTrackSegmentMaker.cxx @@ -28,10 +28,8 @@ #include "TTree.h" // --- Standard library --- -#include // --- AliRoot header files --- -#include "AliRun.h" #include "AliEMCALTrackSegmentMaker.h" #include "AliHeader.h" @@ -42,22 +40,20 @@ ClassImp( AliEMCALTrackSegmentMaker) AliEMCALTrackSegmentMaker:: AliEMCALTrackSegmentMaker() : TTask("","") { // ctor - fSplitFile= 0 ; + fEventFolderName = "" ; } //____________________________________________________________________________ -AliEMCALTrackSegmentMaker::AliEMCALTrackSegmentMaker(const char * headerFile, const char * name, const Bool_t toSplit): TTask(name, headerFile) +AliEMCALTrackSegmentMaker::AliEMCALTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName): + TTask("EMCAL"+AliConfig::fgkTrackerTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - fSplitFile= 0 ; - fToSplit = toSplit ; + } //____________________________________________________________________________ AliEMCALTrackSegmentMaker::~AliEMCALTrackSegmentMaker() { - - fSplitFile = 0 ; } diff --git a/EMCAL/AliEMCALTrackSegmentMaker.h b/EMCAL/AliEMCALTrackSegmentMaker.h index 77ee96c81df..a2216ce7f10 100644 --- a/EMCAL/AliEMCALTrackSegmentMaker.h +++ b/EMCAL/AliEMCALTrackSegmentMaker.h @@ -20,8 +20,7 @@ class TFile ; // --- Standard library --- // --- AliRoot header files --- - - +#include "AliConfig.h" class AliEMCALClusterizer ; class AliEMCALGeometry ; @@ -30,8 +29,8 @@ class AliEMCALTrackSegmentMaker : public TTask { public: AliEMCALTrackSegmentMaker() ; - AliEMCALTrackSegmentMaker(const char* headerFile, const char* name, const Bool_t toSplit) ; - + AliEMCALTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliEMCALTrackSegmentMaker(const AliEMCALTrackSegmentMaker & tsmaker) { ; } virtual ~ AliEMCALTrackSegmentMaker() ; virtual void Exec(Option_t * option){Warning("Exec", "Not Defined" ) ; } @@ -42,10 +41,8 @@ public: virtual void WriteTrackSegments(Int_t event){Warning("WriteTrackSegments", "Not Defined" ) ; } protected: + TString fEventFolderName ; // event folder name - TFile * fSplitFile ; //! file in which TrackSegments will eventually be stored - Bool_t fToSplit ; //! Do we work in the split mode - ClassDef( AliEMCALTrackSegmentMaker,1) // Algorithm class to make EMCAL track segments (Base Class) }; diff --git a/EMCAL/AliEMCALTrackSegmentMakerv1.cxx b/EMCAL/AliEMCALTrackSegmentMakerv1.cxx index 78fcc3b8214..c437b081c09 100644 --- a/EMCAL/AliEMCALTrackSegmentMakerv1.cxx +++ b/EMCAL/AliEMCALTrackSegmentMakerv1.cxx @@ -49,7 +49,6 @@ #include "AliEMCALLink.h" #include "AliEMCALGetter.h" #include "AliEMCAL.h" -#include "AliRun.h" ClassImp( AliEMCALTrackSegmentMakerv1) @@ -60,23 +59,17 @@ ClassImp( AliEMCALTrackSegmentMakerv1) // default ctor (to be used mainly by Streamer) InitParameters() ; - - fTrackSegmentsInRun = 0 ; - fDefaultInit = kTRUE ; } //____________________________________________________________________________ - AliEMCALTrackSegmentMakerv1::AliEMCALTrackSegmentMakerv1(const char * headerFile, const char * name, const Bool_t toSplit) : AliEMCALTrackSegmentMaker(headerFile, name, toSplit) + AliEMCALTrackSegmentMakerv1::AliEMCALTrackSegmentMakerv1(const TString alirunFileName, const TString eventFolderName) + :AliEMCALTrackSegmentMaker(alirunFileName, eventFolderName) { // ctor InitParameters() ; - - fTrackSegmentsInRun = 0 ; - Init() ; - fDefaultInit = kFALSE ; } @@ -89,18 +82,15 @@ ClassImp( AliEMCALTrackSegmentMakerv1) if (!fDefaultInit) { delete fPRELinkArray ; - delete fHCLinkArray ; - fSplitFile = 0 ; + delete fHCALinkArray ; } } - //____________________________________________________________________________ const TString AliEMCALTrackSegmentMakerv1::BranchName() const { - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + return GetName() ; + } //____________________________________________________________________________ @@ -136,58 +126,22 @@ void AliEMCALTrackSegmentMakerv1::Init() { // Make all memory allocations that are not possible in default constructor - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname = GetName() ; - branchname.Remove(branchname.Index(Version())-1) ; - AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(),branchname.Data(), fToSplit ) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !") ; - return ; - } - - fSplitFile = 0 ; - if(fToSplit){ - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } - - fPRELinkArray = new TClonesArray("AliEMCALLink", 1000); - fHCLinkArray = new TClonesArray("AliEMCALLink", 1000); - - - gime->PostTrackSegmentMaker(this) ; - gime->PostTrackSegments(BranchName()) ; + AliEMCALGetter* gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data()); + fPRELinkArray = new TClonesArray("AliEMCALLink", 1000); + fHCALinkArray = new TClonesArray("AliEMCALLink", 1000); + if ( !gime->TrackSegmentMaker() ) { + gime->PostTrackSegmentMaker(this); + } } //____________________________________________________________________________ void AliEMCALTrackSegmentMakerv1::InitParameters() { - fClose = 10e-3 ; - fPRELinkArray = 0 ; - fHCLinkArray = 0 ; - TString tsmName( GetName()) ; - if (tsmName.IsNull() ) - tsmName = "Default" ; - tsmName.Append(":") ; - tsmName.Append(Version()) ; - SetName(tsmName) ; + fClose = 10e-3 ; + fPRELinkArray = 0 ; + fHCALinkArray = 0 ; + fTrackSegmentsInRun = 0 ; } @@ -198,50 +152,50 @@ void AliEMCALTrackSegmentMakerv1::MakeLinks()const // which are not further apart from each other than fDangle // and sort them in accordance with this distance - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TObjArray * aECRecPoints = gime->ECALRecPoints() ; - TObjArray * aPRERecPoints = gime->PRERecPoints() ; - TObjArray * aHCRecPoints = gime->HCALRecPoints() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + TObjArray * aECARecPoints = gime->ECARecPoints() ; + TObjArray * aPRERecPoints = gime->PRERecPoints() ; + TObjArray * aHCARecPoints = gime->HCARecPoints() ; fPRELinkArray->Clear() ; - fHCLinkArray->Clear() ; + fHCALinkArray->Clear() ; AliEMCALTowerRecPoint * pre ; - AliEMCALTowerRecPoint * ec ; - AliEMCALTowerRecPoint * hc ; + AliEMCALTowerRecPoint * eca ; + AliEMCALTowerRecPoint * hca ; Int_t iPRELink = 0 ; - Int_t iHCLink = 0 ; + Int_t iHCALink = 0 ; - Int_t iECRP; - for(iECRP = 0; iECRP < aECRecPoints->GetEntriesFast(); iECRP++ ) { - ec = dynamic_cast(aECRecPoints->At(iECRP)) ; + Int_t iECARP; + for(iECARP = 0; iECARP < aECARecPoints->GetEntriesFast(); iECARP++ ) { + eca = dynamic_cast(aECARecPoints->At(iECARP)) ; Bool_t toofar = kTRUE ; Int_t iPRERP = 0 ; for(iPRERP = 0; iPRERP < aPRERecPoints->GetEntriesFast(); iPRERP++ ) { pre = dynamic_cast(aPRERecPoints->At(iPRERP)) ; - Float_t prod = HowClose(ec, pre, toofar) ; + Float_t prod = HowClose(eca, pre, toofar) ; if(toofar) break ; if(prod < fClose) { - new ((*fPRELinkArray)[iPRELink++]) AliEMCALLink(prod, iECRP, iPRERP, 0) ; + new ((*fPRELinkArray)[iPRELink++]) AliEMCALLink(prod, iECARP, iPRERP, 0) ; } } toofar = kTRUE ; - Int_t iHCRP = 0 ; - for(iHCRP = 0; iHCRP < aHCRecPoints->GetEntriesFast(); iHCRP++ ) { - hc = dynamic_cast(aHCRecPoints->At(iHCRP)) ; - Float_t prod = HowClose(ec, hc, toofar) ; + Int_t iHCARP = 0 ; + for(iHCARP = 0; iHCARP < aHCARecPoints->GetEntriesFast(); iHCARP++ ) { + hca = dynamic_cast(aHCARecPoints->At(iHCARP)) ; + Float_t prod = HowClose(eca, hca, toofar) ; if(toofar) break ; if(prod < fClose) { - new ((*fHCLinkArray)[iHCLink++]) AliEMCALLink(prod, iECRP, iHCRP, 1) ; + new ((*fHCALinkArray)[iHCALink++]) AliEMCALLink(prod, iECARP, iHCARP, 1) ; } } } fPRELinkArray->Sort() ; //first links with largest scalar product - fHCLinkArray->Sort() ; //first links with largest scalar product + fHCALinkArray->Sort() ; //first links with largest scalar product } //____________________________________________________________________________ @@ -252,21 +206,21 @@ void AliEMCALTrackSegmentMakerv1::MakePairs() // unassigned RecParticles. We assign these RecPoints to TrackSegment and // remove them from the list of "unassigned". - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - TObjArray * aECALRecPoints = gime->ECALRecPoints() ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + TObjArray * aECARecPoints = gime->ECARecPoints() ; TObjArray * aPRERecPoints = gime->PRERecPoints() ; - TObjArray * aHCALRecPoints = gime->HCALRecPoints() ; - TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ; + TObjArray * aHCARecPoints = gime->HCARecPoints() ; + TClonesArray * trackSegments = gime->TrackSegments() ; //Make arrays to mark clusters already chosen - Int_t * ecalExist = 0; - Int_t nECAL = aECALRecPoints->GetEntriesFast() ; - if (nECAL) - ecalExist = new Int_t[nECAL] ; + Int_t * ecaExist = 0; + Int_t nECA = aECARecPoints->GetEntriesFast() ; + if (nECA) + ecaExist = new Int_t[nECA] ; Int_t index; - for(index = 0; index < nECAL; index ++) - ecalExist[index] = 1 ; + for(index = 0; index < nECA; index ++) + ecaExist[index] = 1 ; Bool_t * preExist = 0; Int_t nPRE = aPRERecPoints->GetEntriesFast() ; @@ -275,12 +229,12 @@ void AliEMCALTrackSegmentMakerv1::MakePairs() for(index = 0; index < nPRE; index ++) preExist[index] = kTRUE ; - Bool_t * hcalExist = 0; - Int_t nHCAL = aHCALRecPoints->GetEntriesFast() ; - if(nHCAL) - hcalExist = new Bool_t[nHCAL] ; - for(index = 0; index < nHCAL; index ++) - hcalExist[index] = kTRUE ; + Bool_t * hcaExist = 0; + Int_t nHCA = aHCARecPoints->GetEntriesFast() ; + if(nHCA) + hcaExist = new Bool_t[nHCA] ; + for(index = 0; index < nHCA; index ++) + hcaExist[index] = kTRUE ; AliEMCALTowerRecPoint * null = 0 ; // Finds the smallest links and makes pairs of PRE and ECAL clusters with largest scalar product @@ -290,18 +244,18 @@ void AliEMCALTrackSegmentMakerv1::MakePairs() while ( (linkPRE = static_cast(nextPRE()) ) ){ - if(ecalExist[linkPRE->GetECAL()] != -1){ //without PRE yet + if(ecaExist[linkPRE->GetECA()] != -1){ //without PRE yet if(preExist[linkPRE->GetOther()]){ // PRE still exist new ((* trackSegments)[fNTrackSegments]) - AliEMCALTrackSegment(dynamic_cast(aECALRecPoints->At(linkPRE->GetECAL())) , + AliEMCALTrackSegment(dynamic_cast(aECARecPoints->At(linkPRE->GetECA())) , dynamic_cast(aPRERecPoints->At(linkPRE->GetOther())), null) ; (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); fNTrackSegments++ ; if (gDebug == 2 ) Info("MakePairs", "ECAL section with PRE section") ; - ecalExist[linkPRE->GetECAL()] = -1 ; //Mark ecal that pre was found + ecaExist[linkPRE->GetECA()] = -1 ; //Mark ecal that pre was found //mark PRE recpoint as already used preExist[linkPRE->GetOther()] = kFALSE ; } //if PRE still exist @@ -310,54 +264,54 @@ void AliEMCALTrackSegmentMakerv1::MakePairs() // Finds the smallest links and makes pairs of HCAL and ECAL clusters with largest scalar product - TIter nextHCAL(fHCLinkArray) ; - AliEMCALLink * linkHCAL ; + TIter nextHCA(fHCALinkArray) ; + AliEMCALLink * linkHCA ; - while ( (linkHCAL = static_cast(nextHCAL()) ) ){ + while ( (linkHCA = static_cast(nextHCA()) ) ){ - if(ecalExist[linkHCAL->GetECAL()] != -2){ //without HCAL yet + if(ecaExist[linkHCA->GetECA()] != -2){ //without HCAL yet - if(hcalExist[linkHCAL->GetOther()]){ // HCAL still exist + if(hcaExist[linkHCA->GetOther()]){ // HCAL still exist // search among the already existing track segments Int_t ii ; Bool_t found = kFALSE ; AliEMCALTrackSegment * ts = 0 ; for ( ii = 0 ; ii < fNTrackSegments ; ii++ ) { ts = dynamic_cast(trackSegments->At(ii)) ; - if ( ts->GetECIndex() == linkHCAL->GetECAL() ) { + if ( ts->GetECAIndex() == linkHCA->GetECA() ) { found = kTRUE ; break ; } } if (found){ - ts->SetHCRecPoint( dynamic_cast(aHCALRecPoints->At(linkHCAL->GetOther())) ) ; + ts->SetHCARecPoint( dynamic_cast(aHCARecPoints->At(linkHCA->GetOther())) ) ; if (gDebug == 2 ) Info("MakePairs", "ECAL section with PRE and HCAL sections") ; } if (!found) { new ((* trackSegments)[fNTrackSegments]) - AliEMCALTrackSegment(dynamic_cast(aECALRecPoints->At(linkHCAL->GetECAL())), null, - dynamic_cast(aHCALRecPoints->At(linkHCAL->GetOther()))) ; + AliEMCALTrackSegment(dynamic_cast(aECARecPoints->At(linkHCA->GetECA())), null, + dynamic_cast(aHCARecPoints->At(linkHCA->GetOther()))) ; (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); fNTrackSegments++ ; if (gDebug == 2 ) Info("MakePairs", "ECAL section with HCAL section") ; } - ecalExist[linkHCAL->GetECAL()] = -2 ; //Mark ecal that hcal was found + ecaExist[linkHCA->GetECA()] = -2 ; //Mark ecal that hcal was found //mark HCAL recpoint as already used - hcalExist[linkHCAL->GetOther()] = kFALSE ; + hcaExist[linkHCA->GetOther()] = kFALSE ; } //if HCAL still exist } } //look through ECAL recPoints left without PRE/HCAL - if(ecalExist){ //if there is ecal rec point - Int_t iECALRP ; - for(iECALRP = 0; iECALRP < nECAL ; iECALRP++ ){ - if(ecalExist[iECALRP] > 0 ){ + if(ecaExist){ //if there is ecal rec point + Int_t iECARP ; + for(iECARP = 0; iECARP < nECA ; iECARP++ ){ + if(ecaExist[iECARP] > 0 ){ new ((*trackSegments)[fNTrackSegments]) - AliEMCALTrackSegment(dynamic_cast(aECALRecPoints->At(iECALRP)), null, null) ; + AliEMCALTrackSegment(dynamic_cast(aECARecPoints->At(iECARP)), null, null) ; (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); fNTrackSegments++; if( gDebug == 2 ) @@ -365,9 +319,9 @@ void AliEMCALTrackSegmentMakerv1::MakePairs() } } } - delete [] ecalExist ; + delete [] ecaExist ; delete [] preExist ; - delete [] hcalExist ; + delete [] hcaExist ; } //____________________________________________________________________________ @@ -375,8 +329,6 @@ void AliEMCALTrackSegmentMakerv1::Exec(Option_t * option) { // STEERing method - if( strcmp(GetName(), "")== 0 ) - Init() ; if(strstr(option,"tim")) gBenchmark->Start("EMCALTSMaker"); @@ -386,23 +338,19 @@ void AliEMCALTrackSegmentMakerv1::Exec(Option_t * option) return ; } - AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; - if(gime->BranchExists("TrackSegments") ) - return ; + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; - Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ; + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ - gime->Event(ievent,"R") ; - //Make some initializations fNTrackSegments = 0 ; - gime->TrackSegments(BranchName())->Clear() ; - MakeLinks() ; + gime->TrackSegments()->Clear() ; + MakeLinks() ; MakePairs() ; WriteTrackSegments(ievent) ; @@ -411,7 +359,7 @@ void AliEMCALTrackSegmentMakerv1::Exec(Option_t * option) PrintTrackSegments(option) ; //increment the total number of track segments per run - fTrackSegmentsInRun += gime->TrackSegments(BranchName())->GetEntriesFast() ; + fTrackSegmentsInRun += gime->TrackSegments()->GetEntriesFast() ; } @@ -420,7 +368,15 @@ void AliEMCALTrackSegmentMakerv1::Exec(Option_t * option) Info("Exec", "took %f seconds for making TS %f seconds per event", gBenchmark->GetCpuTime("EMCALTSMaker"), gBenchmark->GetCpuTime("EMCALTSMaker")/nevents) ; } - + Unload(); +} + +//____________________________________________________________________________ +void AliEMCALTrackSegmentMakerv1::Unload() +{ + AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + gime->EmcalLoader()->UnloadRecPoints() ; + gime->EmcalLoader()->UnloadTracks() ; } //____________________________________________________________________________ @@ -449,47 +405,20 @@ void AliEMCALTrackSegmentMakerv1::WriteTrackSegments(Int_t event) // first we check, if branches with the same title already exist. // If yes - exits without writing. - AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ; + AliEMCALGetter *gime = AliEMCALGetter::Instance() ; TClonesArray * trackSegments = gime->TrackSegments() ; trackSegments->Expand(trackSegments->GetEntriesFast()) ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - char name[10] ; - sprintf(name,"%s%d", "TreeR",event) ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - - if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; - } + + TTree * treeT = gime->TreeT(); //First TS Int_t bufferSize = 32000 ; - TBranch * tsBranch = treeR->Branch("EMCALTS",&trackSegments,bufferSize); - tsBranch->SetTitle(BranchName()); - - //Second -TSMaker - Int_t splitlevel = 0 ; - AliEMCALTrackSegmentMakerv1 * ts = this ; - TBranch * tsMakerBranch = treeR->Branch("AliEMCALTrackSegmentMaker","AliEMCALTrackSegmentMakerv1", - &ts,bufferSize,splitlevel); - tsMakerBranch->SetTitle(BranchName()); - - tsBranch->Fill() ; - tsMakerBranch->Fill() ; - - treeR->AutoSave() ; //Write(0,kOverwrite) ; - if(gAlice->TreeR()!=treeR) - treeR->Delete(); + TBranch * tsBranch = treeT->Branch("EMCALTS",&trackSegments,bufferSize); + tsBranch->Fill() ; + + gime->WriteTracks("OVERWRITE"); + gime->WriteTrackSegmentMaker("OVERWRITE"); } @@ -498,10 +427,8 @@ void AliEMCALTrackSegmentMakerv1::PrintTrackSegments(Option_t * option) { // option deb - prints # of found TrackSegments // option deb all - prints as well indexed of found RecParticles assigned to the TS - TString taskName(GetName()) ; - taskName.Remove(taskName.Index(Version())-1) ; - TClonesArray * trackSegments = AliEMCALGetter::GetInstance()->TrackSegments(taskName) ; + TClonesArray * trackSegments = AliEMCALGetter::Instance()->TrackSegments() ; Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ; @@ -514,7 +441,7 @@ void AliEMCALTrackSegmentMakerv1::PrintTrackSegments(Option_t * option) for (index = 0 ; index < fNTrackSegments ; index++) { AliEMCALTrackSegment * ts = (AliEMCALTrackSegment * )trackSegments->At(index) ; printf(" %d %d %d %d \n", - ts->GetIndexInList(), ts->GetECIndex(), ts->GetPREIndex(), ts->GetHCIndex() ); + ts->GetIndexInList(), ts->GetECAIndex(), ts->GetPREIndex(), ts->GetHCAIndex() ); } } } diff --git a/EMCAL/AliEMCALTrackSegmentMakerv1.h b/EMCAL/AliEMCALTrackSegmentMakerv1.h index 2be5609f0f9..53bd19560c4 100644 --- a/EMCAL/AliEMCALTrackSegmentMakerv1.h +++ b/EMCAL/AliEMCALTrackSegmentMakerv1.h @@ -26,7 +26,7 @@ class AliEMCALTrackSegmentMakerv1 : public AliEMCALTrackSegmentMaker { public: AliEMCALTrackSegmentMakerv1() ; - AliEMCALTrackSegmentMakerv1(const char* headerFile, const char* name = "Default", const Bool_t toSplit = kFALSE) ; + AliEMCALTrackSegmentMakerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName); AliEMCALTrackSegmentMakerv1(const AliEMCALTrackSegmentMakerv1 & tsm) { // cpy ctor: no implementation yet // requested by the Coding Convention @@ -57,6 +57,7 @@ private: void Init() ; void InitParameters() ; void PrintTrackSegments(Option_t *option) ; + void Unload() ; virtual void WriteTrackSegments(Int_t event) ; private: @@ -65,7 +66,7 @@ private: Bool_t fDefaultInit ; //! Says if the task was created by defaut ctor (only parameters are initialized) Int_t fNTrackSegments ; // number of track segments found TClonesArray * fPRELinkArray ;//! Contains the links ECAL-PRE - TClonesArray * fHCLinkArray ; //! Contains the links ECAL-HCAL + TClonesArray * fHCALinkArray ;//! Contains the links ECAL-HCAL Int_t fTrackSegmentsInRun ; //! Total number of track segments in one run ClassDef( AliEMCALTrackSegmentMakerv1,2) // Implementation version 1 of algorithm class to make EMCAL track segments diff --git a/EMCAL/EMCALLinkDef.h b/EMCAL/EMCALLinkDef.h index 74a725fc192..b0e3b52db85 100644 --- a/EMCAL/EMCALLinkDef.h +++ b/EMCAL/EMCALLinkDef.h @@ -26,7 +26,6 @@ #pragma link C++ class AliEMCALHadronCorrectionv0+; #pragma link C++ class AliEMCALHadronCorrectionv1+; #pragma link C++ class AliEMCALParton+; -#pragma link C++ class AliEMCALReconstructioner+; #pragma link C++ class AliEMCALTrackSegment+; #pragma link C++ class AliEMCALTrackSegmentMaker+; #pragma link C++ class AliEMCALTrackSegmentMakerv1+; @@ -35,4 +34,5 @@ #pragma link C++ class AliEMCALFastRecParticle+; #pragma link C++ class AliEMCALPID+; #pragma link C++ class AliEMCALPIDv1+; +#pragma link C++ class AliEMCALLoader+; #endif diff --git a/EMCAL/libEMCAL.pkg b/EMCAL/libEMCAL.pkg index 2bb6b54f775..6a881108111 100644 --- a/EMCAL/libEMCAL.pkg +++ b/EMCAL/libEMCAL.pkg @@ -23,7 +23,6 @@ AliEMCALHadronCorrectionv0.cxx \ AliEMCALHadronCorrectionv1.cxx \ AliEMCALJetMicroDst.cxx \ AliEMCALParton.cxx \ -AliEMCALReconstructioner.cxx \ AliEMCALTrackSegment.cxx \ AliEMCALTrackSegmentMaker.cxx \ AliEMCALTrackSegmentMakerv1.cxx \ @@ -31,7 +30,8 @@ AliEMCALLink.cxx \ AliEMCALRecParticle.cxx \ AliEMCALFastRecParticle.cxx \ AliEMCALPID.cxx \ -AliEMCALPIDv1.cxx +AliEMCALPIDv1.cxx \ +AliEMCALLoader.cxx HDRS= $(SRCS:.cxx=.h) diff --git a/EVGEN/AliDecayer.h b/EVGEN/AliDecayer.h index 595f42d877a..9fc1debe7af 100644 --- a/EVGEN/AliDecayer.h +++ b/EVGEN/AliDecayer.h @@ -22,3 +22,4 @@ typedef enum #endif #endif //ALI_DECAYER__H + diff --git a/EVGEN/AliDimuCombinator.cxx b/EVGEN/AliDimuCombinator.cxx index ce061153c26..f08225f2920 100644 --- a/EVGEN/AliDimuCombinator.cxx +++ b/EVGEN/AliDimuCombinator.cxx @@ -13,38 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2001/11/27 12:18:05 morsch -Fully commented version by Bruno Espagnon. - -Revision 1.10 2001/03/27 11:14:54 morsch -Weight calculation for correlated particles updated: -- Decay probability is counted once if muons are decay products -of the same mother particle. Otherwise, it's counted twice. - -Revision 1.9 2001/03/08 13:30:43 morsch -Make it work with particle stack of V3.05. - -Revision 1.8 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.7 2000/10/02 15:16:37 morsch -Correct coding rule violation for member data names of type fi -> fI. - -Revision 1.6 2000/06/14 15:19:47 morsch -Include clean-up (IH) - -Revision 1.5 2000/06/09 20:35:32 morsch -All coding rule violations except RS3 corrected - -Revision 1.4 2000/03/20 18:03:24 morsch -Change muon particle code to PDG code. - -Revision 1.3 1999/09/29 09:24:08 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /* Class for dimuon analysis and fast dimuon simulation. diff --git a/EVGEN/AliGenBeamGas.cxx b/EVGEN/AliGenBeamGas.cxx index 1876a51f95b..8ce4cebfe97 100644 --- a/EVGEN/AliGenBeamGas.cxx +++ b/EVGEN/AliGenBeamGas.cxx @@ -13,18 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2.6.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.2 2002/05/15 13:29:11 morsch -Use fOsigma[2] for vertex smearing. Default is 2000 cm. - -Revision 1.1 2002/05/15 08:59:36 morsch -First commit. - -*/ +/* $Id$ */ // // Generator to simulate beam gas interactions. diff --git a/EVGEN/AliGenBox.cxx b/EVGEN/AliGenBox.cxx index fbc1e15f0c5..9946aba5899 100644 --- a/EVGEN/AliGenBox.cxx +++ b/EVGEN/AliGenBox.cxx @@ -13,37 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2003/01/14 10:50:18 alibrary -Cleanup of STEER coding conventions - -Revision 1.7 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.6 2001/07/27 17:09:35 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.5 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.4 2000/11/30 07:12:49 alibrary -Introducing new Rndm and QA classes - -Revision 1.3 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/07/11 18:24:55 fca -Coding convention corrections + few minor bug fixes - -Revision 1.1 2000/06/09 20:22:58 morsch -Same class as previously in AliSimpleGen.cxx -All coding rule violations except RS3 corrected (AM) - -*/ - +/* $Id$ */ // Generator for particles in a preset diff --git a/EVGEN/AliGenCocktail.cxx b/EVGEN/AliGenCocktail.cxx index 2edcaba0049..c20ab0f05a5 100644 --- a/EVGEN/AliGenCocktail.cxx +++ b/EVGEN/AliGenCocktail.cxx @@ -13,56 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2003/03/24 16:38:40 morsch -Bug corrected. - -Revision 1.17 2003/03/24 15:58:27 morsch -FinishRun() implemented. - -Revision 1.16 2003/01/14 10:50:18 alibrary -Cleanup of STEER coding conventions - -Revision 1.15 2003/01/07 14:13:22 morsch -Communication between generators provising and requesting collision -geometries. - -Revision 1.14 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.13 2001/10/21 18:35:56 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.12 2001/06/18 13:07:30 morsch -Forward kinematic ranges to entries only if not set by user. - -Revision 1.11 2001/01/30 09:23:12 hristov -Streamers removed (R.Brun) - -Revision 1.10 2001/01/26 19:55:49 hristov -Major upgrade of AliRoot code - -Revision 1.9 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.8 2000/10/27 13:53:29 morsch -AddGenerator: check testbit before setting the pT and momentum range -(D.Y. Peressounko) - -Revision 1.7 2000/10/02 15:15:41 morsch -Use default streamer for AliGenCocktail - -Revision 1.6 2000/09/07 17:04:31 morsch -In Streamer: TIter() after R__b << fEntries (Dmitri Yurevitch Peressounko) - -Revision 1.5 2000/06/09 20:28:51 morsch -All coding rule violations except RS3 corrected (AM) - -Revision 1.4 1999/09/29 09:24:12 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // Container class for AliGenerator through recursion. // Container is itself an AliGenerator. diff --git a/EVGEN/AliGenCocktailAfterBurner.cxx b/EVGEN/AliGenCocktailAfterBurner.cxx index e9e02cfa097..dea75dc05b2 100644 --- a/EVGEN/AliGenCocktailAfterBurner.cxx +++ b/EVGEN/AliGenCocktailAfterBurner.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + // // Container class for AliGenerator and AfterBurners // (which are AliGenerators as well) through recursion. @@ -27,14 +29,17 @@ // debug -> gDebug, // fNEvents replaced with gAlice->GetEventsPerRun() // -#include "AliGenCocktailAfterBurner.h" -#include "AliGenCocktailEntry.h" -#include "AliStack.h" -#include + +#include + #include +#include #include -#include + +#include "AliGenCocktailAfterBurner.h" +#include "AliGenCocktailEntry.h" +#include "AliStack.h" ClassImp(AliGenCocktailAfterBurner) diff --git a/EVGEN/AliGenCocktailAfterBurner.h b/EVGEN/AliGenCocktailAfterBurner.h index fd255051f62..4771c046ee3 100644 --- a/EVGEN/AliGenCocktailAfterBurner.h +++ b/EVGEN/AliGenCocktailAfterBurner.h @@ -9,6 +9,9 @@ // (Container is itself an AliGenerator) // Author: piotr.skowronski@cern.ch // + +#include + #include "AliGenCocktail.h" #include "AliRun.h" diff --git a/EVGEN/AliGenDoubleScan.cxx b/EVGEN/AliGenDoubleScan.cxx index a674d2ccd56..d1f0c1ce73f 100644 --- a/EVGEN/AliGenDoubleScan.cxx +++ b/EVGEN/AliGenDoubleScan.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8.6.1 2002/07/30 15:00:39 alibrary -Correction in initialization of dx (Enrique Gamez Flores). - -Revision 1.9 2002/07/30 13:48:03 morsch - -Correction in initialization of dx (Enrique Gamez Flores). - -Revision 1.8 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.7 2001/07/27 17:09:35 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.6 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.5 2000/12/06 15:11:38 morsch -Correct double declared data members. - -Revision 1.4 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.3 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/06/09 20:37:51 morsch -All coding rule violations except RS3 corrected - -Revision 1.1 2000/02/23 16:25:14 morsch -First commit of this file - -*/ +/* $Id$ */ // As AliGenScan, generation of particles on a 3-dim grid // but here double hits with a predefined distance are generated. diff --git a/EVGEN/AliGenExtFile.cxx b/EVGEN/AliGenExtFile.cxx index e751e34f224..7382b195048 100644 --- a/EVGEN/AliGenExtFile.cxx +++ b/EVGEN/AliGenExtFile.cxx @@ -88,7 +88,7 @@ void AliGenExtFile::Generate() Float_t origin[3] = {0,0,0}; Float_t p[3]; Float_t random[6]; - Int_t i, j, nt; + Int_t i = 0, j, nt; // for (j=0;j<3;j++) origin[j]=fOrigin[j]; if(fVertexSmear == kPerTrack) { @@ -112,7 +112,7 @@ void AliGenExtFile::Generate() // // The selction criterium for the external file generator is as follows: // - // 1) All tracs are subjects to the cuts defined by AliGenerator, i.e. + // 1) All tracks are subjects to the cuts defined by AliGenerator, i.e. // fThetaMin, fThetaMax, fPhiMin, fPhiMax, fPMin, fPMax, fPtMin, fPtMax, // fYMin, fYMax. // If the particle does not satisfy these cuts, it is not put on the @@ -120,12 +120,13 @@ void AliGenExtFile::Generate() // 2) If fCutOnChild and some specific child is selected (e.g. if // fForceDecay==kSemiElectronic) the event is rejected if NOT EVEN ONE // child falls into the child-cuts. + TParticle* iparticle = 0x0; + if(fCutOnChild) { // Count the selected children Int_t nSelected = 0; - - for (i = 0; i < nTracks; i++) { - TParticle* iparticle = fReader->NextParticle(); + while ( (iparticle=fReader->NextParticle()) ) { + ; Int_t kf = CheckPDGCode(iparticle->GetPdgCode()); kf = TMath::Abs(kf); if (ChildSelected(kf) && KinematicSelection(iparticle, 1)) { @@ -167,13 +168,14 @@ void AliGenExtFile::Generate() p[1] = iparticle->Py(); p[2] = iparticle->Pz(); Int_t idpart = iparticle->GetPdgCode(); - if(fVertexSmear==kPerTrack) { - Rndm(random,6); - for (j = 0; j < 3; j++) { - origin[j]=fOrigin[j] - +fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* - TMath::Sqrt(-2*TMath::Log(random[2*j+1])); - } + if(fVertexSmear==kPerTrack) + { + Rndm(random,6); + for (j = 0; j < 3; j++) { + origin[j]=fOrigin[j]+ + fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* + TMath::Sqrt(-2*TMath::Log(random[2*j+1])); + } } Int_t decayed = iparticle->GetFirstDaughter(); Int_t doTracking = fTrackIt && (decayed < 0) && diff --git a/EVGEN/AliGenFLUKAsource.cxx b/EVGEN/AliGenFLUKAsource.cxx index 8cf95bd5b01..31abcdfb6d1 100644 --- a/EVGEN/AliGenFLUKAsource.cxx +++ b/EVGEN/AliGenFLUKAsource.cxx @@ -13,47 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.16 2002/11/21 16:22:35 alibrary -Removing AliMCProcess and AliMC - -Revision 1.15 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.14 2001/03/21 11:28:20 morsch -Use enum constants for particle selection. - -Revision 1.13 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.12 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.11 2000/06/14 15:20:40 morsch -Include clean-up (IH) - -Revision 1.10 2000/06/09 20:31:34 morsch -All coding rule violations except RS3 corrected - -Revision 1.9 2000/03/07 13:52:54 morsch -static Int_t irwn=0; - -Revision 1.8 2000/02/14 14:49:38 morsch -Correct particle type for gamma and neutrons -More consistent calculation of momentum from kin. energy and mass - -Revision 1.7 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -Revision 1.6 1999/09/29 09:24:12 fca -Introduction of the Copyright and cvs Log - -*/ - - +/* $Id$ */ // Read background particles from a FLUKA boundary source file // This is a very special generator that works for background studies for the muon-spectrometer. diff --git a/EVGEN/AliGenFixed.cxx b/EVGEN/AliGenFixed.cxx index 7bef151ec55..4f4b1da1b7c 100644 --- a/EVGEN/AliGenFixed.cxx +++ b/EVGEN/AliGenFixed.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.7.4.1 2003/04/14 17:33:49 hristov +Merging with v3-09-08 (part1) + +Revision 1.8 2003/01/14 10:50:18 alibrary +Cleanup of STEER coding conventions + Revision 1.7 2001/10/30 11:27:35 morsch fExplicit member data correctly initialized. diff --git a/EVGEN/AliGenGSIlib.cxx b/EVGEN/AliGenGSIlib.cxx index fcf39f8279f..4cd1d47f6e6 100644 --- a/EVGEN/AliGenGSIlib.cxx +++ b/EVGEN/AliGenGSIlib.cxx @@ -13,40 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.5.10.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.6 2002/04/16 15:53:19 morsch -Coding rule violations corrected. - -Revision 1.5 2001/05/15 15:43:23 morsch -Update of library for low mass resonances (Yiota Foka) - -Revision 1.4 2001/03/09 13:01:41 morsch -- enum constants for paramterisation type (particle family) moved to AliGen*lib.h -- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants - -Revision 1.3 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.2 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.1 2000/06/15 08:48:43 morsch -AliGenGSIlib with parametersations for GSI physics simulation added (YF, MI) - -Revision 1.7 2000/05/02 08:12:13 morsch -Coding rule violations corrected. - -Revision 1.6 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ ///////////////////////////////////////////////////////////////////////////// // // diff --git a/EVGEN/AliGenHIJINGpara.cxx b/EVGEN/AliGenHIJINGpara.cxx index 3e786107322..3477bbfe62b 100644 --- a/EVGEN/AliGenHIJINGpara.cxx +++ b/EVGEN/AliGenHIJINGpara.cxx @@ -13,81 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2003/03/15 19:48:01 morsch -AliDecayerPythia replaced by AliDecayer - -Revision 1.20 2003/01/28 15:29:07 morsch -Spelling in name corrected. - -Revision 1.19 2003/01/14 10:50:18 alibrary -Cleanup of STEER coding conventions - -Revision 1.18 2002/12/11 11:58:11 morsch -Bug in formula for pi0 energy for decay corrected. - -Revision 1.17 2002/12/10 17:44:57 morsch -Correct mother child relation for pi0. - -Revision 1.16 2002/11/28 11:46:15 morsch -Don't track pi0 if already decayed. - -Revision 1.15 2002/11/28 11:38:53 morsch -Typo corrected. - -Revision 1.14 2002/11/26 17:12:36 morsch -Decay pi0 if requested. - -Revision 1.13 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.11.4.1 2002/07/24 08:56:28 alibrary -Updating EVGEN on TVirtulaMC - -Revision 1.12 2002/06/19 06:56:34 hristov -Memory leak corrected - -Revision 1.11 2002/03/20 10:21:13 hristov -Set fPtMax to 15 GeV in order to avoid some numerical problems - -Revision 1.10 2001/10/15 16:44:46 morsch -- Possibility for vertex distribution truncation. -- Write mc header with vertex position. - -Revision 1.9 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.8 2001/07/20 11:03:58 morsch -Issue warning message if used outside allowed eta range (-8 to 8). - -Revision 1.7 2001/07/17 12:41:01 morsch -- Calculation of fraction of event corresponding to selected pt-range corrected -(R. Turrisi) -- Parent weight corrected. - -Revision 1.6 2001/05/16 14:57:10 alibrary -New files for folders and Stack - -Revision 1.5 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.4 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.3 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/07/11 18:24:55 fca -Coding convention corrections + few minor bug fixes - -Revision 1.1 2000/06/09 20:20:30 morsch -Same class as previously in AliSimpleGen.cxx -All coding rule violations except RS3 corrected (AM) - -*/ +/* $Id$ */ // Parameterisation of pi and K, eta and pt distributions // used for the ALICE TDRs. diff --git a/EVGEN/AliGenHIJINGparaBa.cxx b/EVGEN/AliGenHIJINGparaBa.cxx index 20256cf49ae..1fbae428935 100644 --- a/EVGEN/AliGenHIJINGparaBa.cxx +++ b/EVGEN/AliGenHIJINGparaBa.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.4.1 2003/04/14 17:33:50 hristov +Merging with v3-09-08 (part1) + +Revision 1.2 2003/01/14 10:50:18 alibrary +Cleanup of STEER coding conventions + Revision 1.1 2002/01/08 09:47:28 morsch HIJING parameterisation including baryons, first commit. diff --git a/EVGEN/AliGenHalo.cxx b/EVGEN/AliGenHalo.cxx index 78d18e355bf..d9e830884b8 100644 --- a/EVGEN/AliGenHalo.cxx +++ b/EVGEN/AliGenHalo.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.11.6.1 2003/04/14 17:33:50 hristov +Merging with v3-09-08 (part1) + +Revision 1.12 2003/01/14 10:50:18 alibrary +Cleanup of STEER coding conventions + Revision 1.11 2001/07/27 17:09:36 morsch Use local SetTrack, KeepTrack and SetHighWaterMark methods to delegate either to local stack or to stack owned by AliRun. diff --git a/EVGEN/AliGenHaloProtvino.cxx b/EVGEN/AliGenHaloProtvino.cxx index 2eb40d2cf4b..5b2a60d8536 100644 --- a/EVGEN/AliGenHaloProtvino.cxx +++ b/EVGEN/AliGenHaloProtvino.cxx @@ -13,52 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.12 2002/11/21 16:22:35 alibrary -Removing AliMCProcess and AliMC - -Revision 1.11 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.8.4.1 2002/07/24 08:56:28 alibrary -Updating EVGEN on TVirtulaMC - -Revision 1.10 2002/05/28 14:28:12 morsch -Correct LHC nominal current profile (1st year 20%, 2nd year 30%, 3rd year 100 %) - -Revision 1.9 2002/05/28 13:49:17 morsch -- Udates for new pressure table -- calculate time -- first provisions for real events. - -Revision 1.8 2002/03/22 13:00:25 morsch -Initialize sum to 0. (Jiri Chudoba). - -Revision 1.7 2002/02/21 16:09:45 morsch -Move SetHighwaterMark() after last possible SetTrack() - -Revision 1.6 2002/02/01 15:28:22 morsch -Fastidious print statements removed. - -Revision 1.5 2002/02/01 14:12:28 morsch -Include new gas pressure estimates (LHC Pproject Note 273) - -Revision 1.4 2001/12/19 16:30:24 morsch -Some bugs corrected and skip method added. (Rachid Guernane) - -Revision 1.3 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.2 2001/06/14 12:15:27 morsch -Bugs corrected. SetSide() method added. - -Revision 1.1 2001/01/23 15:04:33 morsch -Generator to read beam halo file from Protvino group. - -*/ +/* $Id$ */ // Read background particles from a boundary source // Very specialized generator to simulate background from beam halo. diff --git a/EVGEN/AliGenMC.cxx b/EVGEN/AliGenMC.cxx index e205984c5b2..ce15a232008 100644 --- a/EVGEN/AliGenMC.cxx +++ b/EVGEN/AliGenMC.cxx @@ -13,64 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2003/04/30 14:48:21 hristov -Changes related to the initialization of random numbers generators. Now one can use its own randoms for each module, particle generator, and/or tracking package. The interface with Fortran is simplified and some inter-library dependencies are avoided. Future improvements are welcome... - -Revision 1.16 2003/04/08 10:22:05 morsch -Rapidity shift calculated in Init(). - -Revision 1.15 2003/04/04 08:13:26 morsch -Boost method added. - -Revision 1.14 2003/01/14 10:50:19 alibrary -Cleanup of STEER coding conventions - -Revision 1.13 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.5.4.2 2002/07/24 08:56:28 alibrary -Updating EVGEN on TVirtulaMC - -Revision 1.12 2002/07/19 11:42:33 morsch -Use CalcMass() - -Revision 1.11 2002/06/06 15:26:24 morsch -Correct child-selection for kPhiKK - -Revision 1.10 2002/06/05 14:05:46 morsch -Decayer option kPhiKK for forced phi->K+K- decay added. - -Revision 1.9 2002/05/30 14:58:29 morsch -Add pointer to AliGeometry to handle geometrical acceptance. (G. MArtinez) - -Revision 1.8 2002/04/26 10:42:35 morsch -Case kNoDecayHeavy added. (N. Carrer) - -Revision 1.7 2002/04/17 10:32:32 morsch -Coding Rule violations corrected. - -Revision 1.6 2002/03/26 14:19:36 morsch -Saver calculation of rapdity. - -Revision 1.5 2002/03/12 17:02:20 morsch -Change in calculation of rapidity, include case in which numerically e == pz. - -Revision 1.4 2001/11/27 13:13:07 morsch -Maximum lifetime for long-lived particles to be put on the stack is parameter. -It can be set via SetMaximumLifetime(..). - -Revision 1.3 2001/10/16 08:48:56 morsch -Common vertex related code moved to base class AliGenerator. - -Revision 1.2 2001/10/15 08:15:51 morsch -Event vertex and vertex truncation setting moved into AliMC. - -Revision 1.1 2001/07/13 10:56:00 morsch -AliGenMC base class for AliGenParam and AliGenPythia commonalities. - -*/ +/* $Id$ */ // Base class for generators using external MC generators. // For example AliGenPythia using Pythia. diff --git a/EVGEN/AliGenMUONlib.cxx b/EVGEN/AliGenMUONlib.cxx index 0adcc17a14c..32a62077a0d 100644 --- a/EVGEN/AliGenMUONlib.cxx +++ b/EVGEN/AliGenMUONlib.cxx @@ -13,63 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2003/03/25 12:01:11 morsch -Quarkonia for pp @ 14 TeV added. - -Revision 1.20 2003/03/13 11:54:39 morsch -Limited pT range for parameterized Upsilon and J/Psi pT distributions. - -Revision 1.19 2003/02/24 16:46:11 morsch -New parameterisation for Psi and Upsilon (PbPb) - -Revision 1.18 2002/11/07 09:13:42 morsch -Use "Vogt" to label new distributions. - -Revision 1.17 2002/11/07 09:06:10 morsch -J/Psi and Upsilon pt and y distributions from R. Vogt 2002 added. - -Revision 1.16 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.15 2002/04/17 10:11:51 morsch -Coding Rule violations corrected. - -Revision 1.14 2002/02/22 17:26:43 morsch -Eta and omega added. - -Revision 1.13 2001/03/27 11:01:04 morsch -Charm pt-distribution corrected. More realistic y-distribution for pi and K. - -Revision 1.12 2001/03/09 13:01:41 morsch -- enum constants for paramterisation type (particle family) moved to AliGen*lib.h -- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants - -Revision 1.11 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.10 2000/06/29 21:08:27 morsch -All paramatrisation libraries derive from the pure virtual base class AliGenLib. -This allows to pass a pointer to a library directly to AliGenParam and avoids the -use of function pointers in Config.C. - -Revision 1.9 2000/06/14 15:20:56 morsch -Include clean-up (IH) - -Revision 1.8 2000/06/09 20:32:11 morsch -All coding rule violations except RS3 corrected - -Revision 1.7 2000/05/02 08:12:13 morsch -Coding rule violations corrected. - -Revision 1.6 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // Library class for particle pt and y distributions used for // muon spectrometer simulations. @@ -351,14 +295,7 @@ Double_t AliGenMUONlib::YJpsiPP( Double_t *px, Double_t *dummy) Int_t AliGenMUONlib::IpJpsi(TRandom *) { // J/Psi composition - Int_t ip; - Float_t r = gRandom->Rndm(); - if (r < 0.98) { - ip = 443; - } else { - ip = 100443; - } - return ip; + return 443; } // Upsilon @@ -506,18 +443,7 @@ Double_t AliGenMUONlib::YUpsilonPP( Double_t *px, Double_t *dummy) Int_t AliGenMUONlib::IpUpsilon(TRandom *) { // y composition - Int_t ip; - Float_t r = gRandom->Rndm(); - - if (r < 0.712) { - ip = 553; - } else if (r < 0.896) { - ip = 100553; - } else { - ip = 200553; - } - - return ip; + return 553; } // diff --git a/EVGEN/AliGenPHOSlib.cxx b/EVGEN/AliGenPHOSlib.cxx index fad630e98e9..516bd7a0b33 100644 --- a/EVGEN/AliGenPHOSlib.cxx +++ b/EVGEN/AliGenPHOSlib.cxx @@ -14,42 +14,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7.10.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.10 2002/05/02 09:40:50 morsch -Recover mods from Rev. 1.8 - -Revision 1.9 2002/04/23 12:54:29 morsch -New options kPi0Flat y kEtaFlat (Gustavo Conesa) - -Revision 1.7 2001/03/09 13:01:41 morsch -- enum constants for paramterisation type (particle family) moved to AliGen*lib.h -- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants - -Revision 1.6 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.5 2000/06/29 21:08:27 morsch -All paramatrisation libraries derive from the pure virtual base class AliGenLib. -This allows to pass a pointer to a library directly to AliGenParam and avoids the -use of function pointers in Config.C. - -Revision 1.4 2000/06/14 15:21:05 morsch -Include clean-up (IH) - -Revision 1.3 2000/06/09 20:32:54 morsch -All coding rule violations except RS3 corrected - -Revision 1.2 1999/11/04 11:30:48 fca -Improve comments - -Revision 1.1 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -*/ +/* $Id$ */ //====================================================================== // AliGenPHOSlib class contains parameterizations of the diff --git a/EVGEN/AliGenPMDlib.cxx b/EVGEN/AliGenPMDlib.cxx index 6a6c6f556e1..03a25f9b452 100644 --- a/EVGEN/AliGenPMDlib.cxx +++ b/EVGEN/AliGenPMDlib.cxx @@ -13,29 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.3.10.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.4 2002/04/17 12:48:54 morsch -const added. - -Revision 1.3 2001/03/09 13:01:41 morsch -- enum constants for paramterisation type (particle family) moved to AliGen*lib.h -- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants - -Revision 1.2 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.1 2000/09/08 15:37:58 morsch -pt and y-parameterisations for PMD physics simulation. -THIS VERSION IS JUST A TEMPLATE THE PT AND Y DISTRIBUTIONS HAVE TO BE CORRECTED !!!!. - -*/ +/* $Id$ */ #include #include diff --git a/EVGEN/AliGenParam.cxx b/EVGEN/AliGenParam.cxx index 61f8f44a090..6cfdb4e4175 100644 --- a/EVGEN/AliGenParam.cxx +++ b/EVGEN/AliGenParam.cxx @@ -13,123 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.42 2003/03/15 19:48:01 morsch -AliDecayerPythia replaced by AliDecayer - -Revision 1.41 2003/01/09 17:38:47 morsch -Draw() method added. - -Revision 1.40 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.36.6.3 2002/10/10 16:40:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.39 2002/09/16 08:21:16 morsch -Use TDatabasePDG::Instance(); - -Revision 1.38 2002/05/30 14:59:12 morsch -Check geometrical acceptance. (G. Martinez) - -Revision 1.37 2002/04/17 10:20:44 morsch -Coding Rule violations corrected. - -Revision 1.36 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.35 2002/01/21 10:02:40 morsch -ty is Double_t -Abort if too high rapidity causes numerical paroblem. User has to specify -meaningful y-range. - -Revision 1.34 2001/11/27 13:13:07 morsch -Maximum lifetime for long-lived particles to be put on the stack is parameter. -It can be set via SetMaximumLifetime(..). - -Revision 1.33 2001/10/21 18:35:56 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.32 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.31 2001/07/13 10:58:54 morsch -- Some coded moved to AliGenMC -- Improved handling of secondary vertices. - -Revision 1.30 2001/06/15 07:55:04 morsch -Put only first generation decay products on the stack. - -Revision 1.29 2001/03/27 10:58:41 morsch -Initialize decayer before generation. Important if run inside cocktail. - -Revision 1.28 2001/03/09 13:01:41 morsch -- enum constants for paramterisation type (particle family) moved to AliGen*lib.h -- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants - -Revision 1.27 2001/02/02 15:21:10 morsch -Set high water mark after last particle. -Use Vertex() method for Vertex. - -Revision 1.26 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.25 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.24 2000/10/18 19:11:27 hristov -Division by zero fixed - -Revision 1.23 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.22 2000/09/12 14:14:55 morsch -Call fDecayer->ForceDecay() at the beginning of Generate(). - -Revision 1.21 2000/09/08 15:39:01 morsch -Handle the case fForceDecay=all during the generation, i.e. select all secondaries. - -Revision 1.20 2000/09/06 14:35:44 morsch -Use AliDecayerPythia for particle decays. - -Revision 1.19 2000/07/11 18:24:56 fca -Coding convention corrections + few minor bug fixes - -Revision 1.18 2000/06/29 21:08:27 morsch -All paramatrisation libraries derive from the pure virtual base class AliGenLib. -This allows to pass a pointer to a library directly to AliGenParam and avoids the -use of function pointers in Config.C. - -Revision 1.17 2000/06/09 20:33:30 morsch -All coding rule violations except RS3 corrected - -Revision 1.16 2000/05/02 07:51:31 morsch -- Control precision of pT sampling TF1::SetNpx(..) -- Correct initialisation of child-cuts in all constructors. -- Most coding rule violations corrected. - -Revision 1.15 2000/04/03 15:42:12 morsch -Cuts on primary particles are separated from those on the decay products. Methods -SetChildMomentumRange, SetChildPtRange, SetChildPhiRange, SetChildThetaRange added. - -Revision 1.14 1999/11/09 07:38:48 fca -Changes for compatibility with version 2.23 of ROOT - -Revision 1.13 1999/11/04 11:30:31 fca -Correct the logics for SetForceDecay - -Revision 1.12 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -Revision 1.11 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log - -*/ - - +/* $Id$ */ // Class to generate particles from using paramtrized pT and y distributions. // Distributions are obtained from pointer to object of type AliGenLib. diff --git a/EVGEN/AliGenReader.cxx b/EVGEN/AliGenReader.cxx index 48998ef49fa..4c881061744 100644 --- a/EVGEN/AliGenReader.cxx +++ b/EVGEN/AliGenReader.cxx @@ -13,19 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1.8.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 +/* $Id$ */ -Revision 1.2 2002/04/26 10:37:23 morsch -Method RewindEvent() added. (N. Carrer) - -Revision 1.1 2001/11/09 09:09:59 morsch -Base class with responsibility to read events and particles from a file. To be used -with AliGenExtFile. - -*/ #include "AliGenReader.h" ClassImp(AliGenReader) diff --git a/EVGEN/AliGenReader.h b/EVGEN/AliGenReader.h index 14130ab6cfc..8d923f025a4 100644 --- a/EVGEN/AliGenReader.h +++ b/EVGEN/AliGenReader.h @@ -12,8 +12,8 @@ class TParticle; class AliGenReader : public TObject { public: - AliGenReader(){;} - AliGenReader(const AliGenReader &reader){;} + AliGenReader():fFileName(NULL),fCode(kPDG){;} + AliGenReader(const AliGenReader &reader):fFileName(NULL),fCode(kPDG){;} virtual ~AliGenReader(){;} // Initialise diff --git a/EVGEN/AliGenReaderCwn.cxx b/EVGEN/AliGenReaderCwn.cxx index c248381ca6b..0e25d0e8844 100644 --- a/EVGEN/AliGenReaderCwn.cxx +++ b/EVGEN/AliGenReaderCwn.cxx @@ -14,21 +14,7 @@ **************************************************************************/ -/* -$Log$ -Revision 1.4 2002/10/30 13:39:51 hristov -Warnings cleaned up (Alpha) - -Revision 1.3 2002/10/21 09:20:51 alibrary -Introduce Riostream.h and remove unused variables - -Revision 1.2 2001/11/12 14:31:00 morsch -Memory leaks fixed. (M. Bondila) - -Revision 1.1 2001/11/09 09:10:46 morsch -Realisation of AliGenReader that reads the old cwn event format. - -*/ +/* $Id$ */ // Read the old ALICE event format based on CW-ntuples // http://consult.cern.ch/alice/Internal_Notes/1995/32/abstract @@ -37,11 +23,12 @@ Realisation of AliGenReader that reads the old cwn event format. // Author: andreas.morsch@cern.ch #include -#include #include +#include #include #include "AliGenReaderCwn.h" + ClassImp(AliGenReaderCwn); diff --git a/EVGEN/AliGenReaderEcalHijing.cxx b/EVGEN/AliGenReaderEcalHijing.cxx index b4ac4955268..9fcc01ed722 100644 --- a/EVGEN/AliGenReaderEcalHijing.cxx +++ b/EVGEN/AliGenReaderEcalHijing.cxx @@ -13,21 +13,15 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2002/10/30 13:39:06 hristov -Missing initialization added (Alpha) - -Revision 1.1 2002/01/08 09:59:34 morsch -Readers for EMCAL primary particle input. - -*/ +/* $Id$ */ #include -#include #include +#include +#include #include "AliGenReaderEcalHijing.h" + ClassImp(AliGenReaderEcalHijing) diff --git a/EVGEN/AliGenReaderEcalJets.cxx b/EVGEN/AliGenReaderEcalJets.cxx index cf1be513f6b..9ae491b0b33 100644 --- a/EVGEN/AliGenReaderEcalJets.cxx +++ b/EVGEN/AliGenReaderEcalJets.cxx @@ -13,21 +13,15 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2002/10/30 13:39:06 hristov -Missing initialization added (Alpha) - -Revision 1.1 2002/01/08 09:59:34 morsch -Readers for EMCAL primary particle input. - -*/ +/* $Id$ */ #include -#include #include +#include +#include #include "AliGenReaderEcalJets.h" + ClassImp(AliGenReaderEcalJets) diff --git a/EVGEN/AliGenReaderTreeK.cxx b/EVGEN/AliGenReaderTreeK.cxx index 4463f781d9f..461c156a25e 100644 --- a/EVGEN/AliGenReaderTreeK.cxx +++ b/EVGEN/AliGenReaderTreeK.cxx @@ -13,53 +13,48 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4.4.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 +/* $Id$ */ -Revision 1.5 2002/04/26 10:37:23 morsch -Method RewindEvent() added. (N. Carrer) - -Revision 1.4 2002/03/22 08:25:33 morsch -TreeE connected correctly. - -Revision 1.3 2001/12/12 11:21:37 morsch -Dummy copy constructor added. - -Revision 1.2 2001/11/12 14:31:00 morsch -Memory leaks fixed. (M. Bondila) - -Revision 1.1 2001/11/09 09:11:24 morsch -Realisation of AliGenReader that reads the kine tree (TreeK). - -*/ #include #include #include +#include +#include #include "AliGenReaderTreeK.h" -#include "AliStack.h" #include "AliHeader.h" #include "AliRun.h" +#include "AliRunLoader.h" ClassImp(AliGenReaderTreeK); - -AliGenReaderTreeK::AliGenReaderTreeK():AliGenReader() +const TString AliGenReaderTreeK::fgkEventFolderName("GenReaderTreeK"); + +AliGenReaderTreeK::AliGenReaderTreeK(): + AliGenReader(), + fNcurrent(0), + fNparticle(0), + fNp(0), + fInRunLoader(0), + fBaseFile(0), + fStack(0), + fOnlyPrimaries(kFALSE), + fDirs(0x0), + fCurrentDir(0) { // Default constructor - fFileName = NULL; - fStack = 0; - fHeader = 0; - fNcurrent = 0; - fNparticle = 0; - fFile = 0; - fBaseFile = 0; - fTreeE = 0; } -AliGenReaderTreeK::AliGenReaderTreeK(const AliGenReaderTreeK &reader) +AliGenReaderTreeK::AliGenReaderTreeK(const AliGenReaderTreeK &reader): + fNcurrent(0), + fNparticle(0), + fNp(0), + fInRunLoader(0), + fBaseFile(0), + fStack(0), + fOnlyPrimaries(kFALSE), + fDirs(0x0), + fCurrentDir(0) { ; } @@ -68,7 +63,8 @@ AliGenReaderTreeK::AliGenReaderTreeK(const AliGenReaderTreeK &reader) AliGenReaderTreeK::~AliGenReaderTreeK() { // Destructor - delete fTreeE; + delete fInRunLoader;//it cleans all the loaded data + delete fDirs; } void AliGenReaderTreeK::Init() @@ -78,11 +74,17 @@ void AliGenReaderTreeK::Init() TTree *ali = gAlice->TreeE(); if (ali) { - fBaseFile = ali->GetCurrentFile(); + fBaseFile = ali->GetCurrentFile(); } else { - printf("\n Warning: Basefile cannot be found !\n"); + printf("\n Warning: Basefile cannot be found !\n"); } - if (!fFile) fFile = new TFile(fFileName); + //if (!fFile) fFile = new TFile(fFileName); + if (fInRunLoader == 0x0) + { + fInRunLoader = AliRunLoader::Open((GetDirName(fCurrentDir++)+"/")+fFileName,fgkEventFolderName); + fInRunLoader->LoadHeader(); + fInRunLoader->LoadKinematics("READ"); + } } Int_t AliGenReaderTreeK::NextEvent() @@ -90,35 +92,50 @@ Int_t AliGenReaderTreeK::NextEvent() // Read the next event // cd to file with old kine tree if (!fBaseFile) Init(); - fFile->cd(); -// Connect header tree - if (!fTreeE) fTreeE = (TTree*)gDirectory->Get("TE"); - if (fHeader) delete fHeader; - fHeader = 0; - fTreeE->SetBranchAddress("Header", &fHeader); // Get next event - fTreeE->GetEntry(fNcurrent); -// Connect Stack - if (fStack) delete fStack; - fStack = fHeader->Stack(); - fStack->GetEvent(fNcurrent); + + if (fNcurrent >= fInRunLoader->GetNumberOfEvents()) + { + if (fCurrentDir >= fDirs->GetEntries()) + { + Warning("NextEvent","No more events"); + return 0; + } + delete fInRunLoader; + fInRunLoader = AliRunLoader::Open((GetDirName(fCurrentDir++)+"/")+fFileName,fgkEventFolderName); + fInRunLoader->LoadHeader(); + fInRunLoader->LoadKinematics("READ"); + fNcurrent = 0; + } + fInRunLoader->GetEvent(fNcurrent); + fStack = fInRunLoader->Stack(); + // cd back to base file fBaseFile->cd(); // fNcurrent++; fNparticle = 0; - Int_t ntrack = fStack->GetNtrack(); - printf("\n Next event contains %d particles", ntrack); + fNp = fStack->GetNtrack(); + printf("\n Next event contains %d particles", fNp); // - return ntrack; + return fNp; } TParticle* AliGenReaderTreeK::NextParticle() { -// Return next particle - TParticle* part = fStack->Particle(fNparticle); - fNparticle++; - return part; +//Return next particle + TParticle* part = GetParticle(fNparticle++); + if (part == 0x0) return 0x0; + //if only primaries are to be read, and this particle is not primary enter loop + if (fOnlyPrimaries && ( part->GetFirstMother() > -1) ) + for (;;) + { //look for a primary + part = GetParticle(fNparticle++); + if (part == 0x0) return 0x0; + if (part->GetFirstMother() == -1) return part; + } + + return part; } void AliGenReaderTreeK::RewindEvent() @@ -136,3 +153,47 @@ AliGenReaderTreeK& AliGenReaderTreeK::operator=(const AliGenReaderTreeK& rhs) +TString& AliGenReaderTreeK::GetDirName(Int_t entry) + { + TString* retval;//return value + if (fDirs == 0x0) + { + retval = new TString("."); + return *retval; + } + + if ( (entry>fDirs->GetEntries()) || (entry<0))//if out of bounds return empty string + { //note that entry==0 is accepted even if array is empty (size=0) + Error("GetDirName","Name out of bounds"); + retval = new TString(); + return *retval; + } + + if (fDirs->GetEntries() == 0) + { + retval = new TString("."); + return *retval; + } + + TObjString *dir = dynamic_cast(fDirs->At(entry)); + if(dir == 0x0) + { + Error("GetDirName","Object in TObjArray is not a TObjString or its descendant"); + retval = new TString(); + return *retval; + } + if (gDebug > 0) Info("GetDirName","Returned ok %s",dir->String().Data()); + return dir->String(); + } + +void AliGenReaderTreeK::AddDir(const char* dirname) +{ + //adds a directory to the list of directories where data are looked for + if(fDirs == 0x0) + { + fDirs = new TObjArray(); + fDirs->SetOwner(kTRUE); + } + TObjString *odir= new TObjString(dirname); + fDirs->Add(odir); +} diff --git a/EVGEN/AliGenReaderTreeK.h b/EVGEN/AliGenReaderTreeK.h index 1d78d301b20..487d2f4fa8f 100644 --- a/EVGEN/AliGenReaderTreeK.h +++ b/EVGEN/AliGenReaderTreeK.h @@ -6,10 +6,13 @@ /* $Id$ */ #include "AliGenReader.h" +#include "AliStack.h" + class TFile; -class AliStack; class AliHeader; - +class AliRunLoader; +class TString; +class TObjArray; class AliGenReaderTreeK : public AliGenReader { @@ -23,19 +26,35 @@ class AliGenReaderTreeK : public AliGenReader virtual Int_t NextEvent(); virtual TParticle* NextParticle(); virtual void RewindEvent(); + virtual void SetOnlyPrimaries(Bool_t flag){fOnlyPrimaries = flag;} AliGenReaderTreeK & operator=(const AliGenReaderTreeK & rhs); - + void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names + void AddDir(const char* dirname); protected: Int_t fNcurrent; // points to the next entry Int_t fNparticle; // Next particle in list Int_t fNp; // number of particles - TFile *fFile; //! pointer to file + AliRunLoader *fInRunLoader; //!Run Loader of the input event TFile *fBaseFile; //! pointer to base file AliStack *fStack; //! Particle stack - AliHeader *fHeader; //! Pointer to event header - TTree *fTreeE; //! Pointer to header tree + Bool_t fOnlyPrimaries; // Flag indicating wether only primaries are read + TObjArray *fDirs; //arry with directories to read data from + Int_t fCurrentDir; //Number of current directory + static const TString fgkEventFolderName;//!name of folder where event to read is mounted + + TString& GetDirName(Int_t entry); + TParticle* GetParticle(Int_t i); + ClassDef(AliGenReaderTreeK,1) // Read particles from TreeK }; + +inline +TParticle* AliGenReaderTreeK::GetParticle(Int_t i) + { + if (fStack && iParticle(i); + return 0x0; + } + #endif diff --git a/EVGEN/AliGenSTRANGElib.cxx b/EVGEN/AliGenSTRANGElib.cxx index 7c9a8156d81..9c58a778f42 100644 --- a/EVGEN/AliGenSTRANGElib.cxx +++ b/EVGEN/AliGenSTRANGElib.cxx @@ -34,18 +34,7 @@ // Tiziano.Virgili@roma1.infn.it //====================================================================== -/* -$Log$ -Revision 1.1.6.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.2 2002/04/17 12:48:54 morsch -const added. - -Revision 1.1 2001/12/04 18:06:39 morsch -AliGenSTRANGElib.cxx first commit. - -*/ +/* $Id: */ #include "TMath.h" #include "TRandom.h" diff --git a/EVGEN/AliGenScan.cxx b/EVGEN/AliGenScan.cxx index f20f6b69d4d..d9198a86dbd 100644 --- a/EVGEN/AliGenScan.cxx +++ b/EVGEN/AliGenScan.cxx @@ -13,41 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10.6.1 2002/07/30 11:30:48 alibrary -Updating VirtualMC - -Revision 1.11 2002/07/30 09:09:59 morsch -Correction in initialization. - -Revision 1.10 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.9 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.8 2000/12/06 15:11:38 morsch -Correct double declared data members. - -Revision 1.7 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.6 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.5 2000/06/09 20:37:20 morsch -All coding rule violations except RS3 corrected - -Revision 1.4 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -Revision 1.3 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ #include "AliGenScan.h" #include "AliRun.h" diff --git a/EVGEN/AliGenSlowNucleons.cxx b/EVGEN/AliGenSlowNucleons.cxx index 3599590cfb5..b23555c867c 100644 --- a/EVGEN/AliGenSlowNucleons.cxx +++ b/EVGEN/AliGenSlowNucleons.cxx @@ -13,19 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2003/06/26 08:45:22 morsch -- Vertex using Vertex() method. -- Use member data in GetNumberOfSlowNucleons call. - -Revision 1.2 2003/03/25 09:55:24 morsch -Numbers of slow nucleons either from model or user set. - -Revision 1.1 2003/03/24 16:49:23 morsch -Slow nucleon generator and model. - -*/ +/* $Id$ */ /* Generator for slow nucluons in pA interactions. diff --git a/EVGEN/AliGenThetaSlice.cxx b/EVGEN/AliGenThetaSlice.cxx index ba4237a63aa..d23cbe339d8 100644 --- a/EVGEN/AliGenThetaSlice.cxx +++ b/EVGEN/AliGenThetaSlice.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.4.1 2003/04/14 17:33:50 hristov +Merging with v3-09-08 (part1) + +Revision 1.2 2003/01/14 10:50:19 alibrary +Cleanup of STEER coding conventions + Revision 1.1 2002/03/11 10:56:06 morsch AliGenThetaSlice, first commit. (Jiri Chudoba) diff --git a/EVGEN/AliPartonicEnergyLoss.cxx b/EVGEN/AliPartonicEnergyLoss.cxx index f5e00eaca72..fb67828d318 100644 --- a/EVGEN/AliPartonicEnergyLoss.cxx +++ b/EVGEN/AliPartonicEnergyLoss.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.2.4.1 2002/11/26 16:57:23 hristov +Merging NewIO with v3-09-04 + +Revision 1.2 2002/10/14 14:55:35 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.1.2.1 2002/07/24 08:56:29 alibrary Updating EVGEN on TVirtulaMC diff --git a/EVGEN/AliSlowNucleonModel.cxx b/EVGEN/AliSlowNucleonModel.cxx index 91517175932..74b23c42619 100644 --- a/EVGEN/AliSlowNucleonModel.cxx +++ b/EVGEN/AliSlowNucleonModel.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/14 17:33:50 hristov +Merging with v3-09-08 (part1) + +Revision 1.1 2003/03/24 16:49:23 morsch +Slow nucleon generator and model. + */ diff --git a/EVGEN/AliSlowNucleonModelExp.cxx b/EVGEN/AliSlowNucleonModelExp.cxx index a7f4f3c0e6a..71ece112e9d 100644 --- a/EVGEN/AliSlowNucleonModelExp.cxx +++ b/EVGEN/AliSlowNucleonModelExp.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/14 17:33:50 hristov +Merging with v3-09-08 (part1) + +Revision 1.1 2003/03/24 16:49:23 morsch +Slow nucleon generator and model. + */ diff --git a/EVGEN/AliStructFuncType.cxx b/EVGEN/AliStructFuncType.cxx index 80b3a3a05bf..5accfb0ac0f 100644 --- a/EVGEN/AliStructFuncType.cxx +++ b/EVGEN/AliStructFuncType.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.2.4.1 2002/11/26 16:57:23 hristov +Merging NewIO with v3-09-04 + +Revision 1.2 2002/10/14 14:55:35 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.1.2.1 2002/07/24 08:56:29 alibrary Updating EVGEN on TVirtulaMC diff --git a/FASTSIM/AliFastDetector.cxx b/FASTSIM/AliFastDetector.cxx index 8bc30e9be19..d86ce9d66d3 100644 --- a/FASTSIM/AliFastDetector.cxx +++ b/FASTSIM/AliFastDetector.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.4.1 2002/11/26 16:56:30 hristov +Merging NewIO with v3-09-04 + +Revision 1.3 2002/11/07 09:07:07 hristov +Adding FASTSIM code (lost during the merge with VMC) + Revision 1.1 2002/09/20 13:32:51 morsch Base classes for fast simulation. First commit. diff --git a/FASTSIM/AliFastEvent.cxx b/FASTSIM/AliFastEvent.cxx index 906a3b85276..7c94bcdf519 100644 --- a/FASTSIM/AliFastEvent.cxx +++ b/FASTSIM/AliFastEvent.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.4.1 2002/11/26 16:56:30 hristov +Merging NewIO with v3-09-04 + +Revision 1.3 2002/11/07 09:07:07 hristov +Adding FASTSIM code (lost during the merge with VMC) + Revision 1.1 2002/09/20 13:32:51 morsch Base classes for fast simulation. First commit. diff --git a/FASTSIM/AliFastGlauber.cxx b/FASTSIM/AliFastGlauber.cxx index 81459125e33..8dba8fc44f5 100644 --- a/FASTSIM/AliFastGlauber.cxx +++ b/FASTSIM/AliFastGlauber.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2003/06/03 13:13:20 morsch -GetRandom returning impact parameter bin and flag for hard process added. - -Revision 1.3 2003/04/21 09:35:53 morsch -Protection against division by 0 in Binaries(). - -Revision 1.2 2003/04/14 14:23:44 morsch -Correction in Binaries(). - -Revision 1.1 2003/04/10 08:48:13 morsch -First commit. - -*/ +/* $Id$ */ // from AliRoot #include "AliFastGlauber.h" @@ -341,12 +327,7 @@ Double_t AliFastGlauber::WSN(Double_t* x, Double_t* par) // Number of hard processes per event // Double_t b = x[0]; - Double_t y; - if (b != 0.) { - y = fWSbinary->Eval(b)/fWSgeo->Eval(b); - } else { - y = fWSbinary->Eval(1.e-4)/fWSgeo->Eval(1.e-4); - } + Double_t y = fWSbinary->Eval(b)/fWSgeo->Eval(b); return y; } @@ -404,7 +385,7 @@ void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult) b = fWSgeo->GetRandom(); Float_t mu = fWSN->Eval(b); p = 1.-TMath::Exp(-mu); - mult = 6000./fWSN->Eval(0.) * mu; + mult = 6000./fWSN->Eval(1.) * mu; } void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard) diff --git a/FASTSIM/AliFastMuonTrackingAcc.cxx b/FASTSIM/AliFastMuonTrackingAcc.cxx index 0c1d62ed1bd..a190c0b4996 100644 --- a/FASTSIM/AliFastMuonTrackingAcc.cxx +++ b/FASTSIM/AliFastMuonTrackingAcc.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.1 2003/01/06 10:13:09 morsch +First commit. + */ #include "AliFastMuonTrackingAcc.h" diff --git a/FASTSIM/AliFastMuonTrackingEff.cxx b/FASTSIM/AliFastMuonTrackingEff.cxx index 55aa3534607..be605e0188e 100644 --- a/FASTSIM/AliFastMuonTrackingEff.cxx +++ b/FASTSIM/AliFastMuonTrackingEff.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.1 2003/01/06 10:13:09 morsch +First commit. + */ #include "AliFastMuonTrackingEff.h" diff --git a/FASTSIM/AliFastMuonTrackingRes.cxx b/FASTSIM/AliFastMuonTrackingRes.cxx index e192c4e506d..6234882aadf 100644 --- a/FASTSIM/AliFastMuonTrackingRes.cxx +++ b/FASTSIM/AliFastMuonTrackingRes.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.1 2003/01/06 10:13:09 morsch +First commit. + */ #include "AliFastMuonTrackingRes.h" diff --git a/FASTSIM/AliFastMuonTriggerEff.cxx b/FASTSIM/AliFastMuonTriggerEff.cxx index f50826f2ed5..f71f3eef857 100644 --- a/FASTSIM/AliFastMuonTriggerEff.cxx +++ b/FASTSIM/AliFastMuonTriggerEff.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.2.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.2 2003/01/21 10:49:17 morsch +Corrected path for vettotpara.root + Revision 1.1 2003/01/06 10:13:09 morsch First commit. diff --git a/FASTSIM/AliFastParticle.cxx b/FASTSIM/AliFastParticle.cxx index 693ea2ff68f..47868ac8603 100644 --- a/FASTSIM/AliFastParticle.cxx +++ b/FASTSIM/AliFastParticle.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.4.1 2002/11/26 16:56:30 hristov +Merging NewIO with v3-09-04 + +Revision 1.3 2002/11/07 09:07:07 hristov +Adding FASTSIM code (lost during the merge with VMC) + Revision 1.1 2002/09/20 13:32:51 morsch Base classes for fast simulation. First commit. diff --git a/FASTSIM/AliFastResponse.cxx b/FASTSIM/AliFastResponse.cxx index a8b0a9871eb..6f8d81f07dd 100644 --- a/FASTSIM/AliFastResponse.cxx +++ b/FASTSIM/AliFastResponse.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.4.1 2002/11/26 16:56:30 hristov +Merging NewIO with v3-09-04 + +Revision 1.3 2002/11/07 09:07:07 hristov +Adding FASTSIM code (lost during the merge with VMC) + Revision 1.1 2002/09/20 13:32:51 morsch Base classes for fast simulation. First commit. diff --git a/FASTSIM/AliMUONFastTracking.cxx b/FASTSIM/AliMUONFastTracking.cxx index ce9f021ac45..b7eefacdd3f 100644 --- a/FASTSIM/AliMUONFastTracking.cxx +++ b/FASTSIM/AliMUONFastTracking.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.2.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.2 2003/01/08 10:29:33 morsch +Path to data file changed. + Revision 1.1 2003/01/06 10:13:33 morsch First commit. diff --git a/FASTSIM/AliMUONFastTrackingEntry.cxx b/FASTSIM/AliMUONFastTrackingEntry.cxx index 43208259a8e..b10f67f0fc0 100644 --- a/FASTSIM/AliMUONFastTrackingEntry.cxx +++ b/FASTSIM/AliMUONFastTrackingEntry.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/15 15:57:31 hristov +Merging with v3-09-08 + +Revision 1.1 2003/01/07 08:41:02 morsch +First commit. + */ #include "AliMUONFastTrackingEntry.h" diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index 5c2d456e7b4..6ad1f1beada 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -12,6 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + +/* $Id$ */ + ////////////////////////////////////////////////////////////////////////////// // // // Forward Multiplicity Detector based on Silicon plates // @@ -36,28 +39,30 @@ // // /////////////////////////////////////////////////////////////////////////////// - #define DEBUG -#include + +#include +#include + +#include +#include #include +#include +#include +#include #include #include -#include -#include +#include -#include -#include -#include "AliFMDv1.h" -#include "AliRun.h" #include "AliDetector.h" -#include -#include -#include "AliMagF.h" -#include "AliFMDhit.h" -#include "AliFMDdigit.h" -#include "AliFMDReconstruction.h" #include "AliFMDReconstParticles.h" -#include +#include "AliFMDReconstruction.h" +#include "AliFMDdigit.h" +#include "AliFMDhit.h" +#include "AliFMDv1.h" +#include "AliLoader.h" +#include "AliMagF.h" +#include "AliRun.h" ClassImp (AliFMD) //_____________________________________________________________________________ @@ -113,7 +118,7 @@ AliFMD::~AliFMD () delete fDigits; fDigits = 0; } - if (fReconParticles) + if (fReconParticles) { fReconParticles->Delete (); delete fReconParticles; @@ -137,11 +142,11 @@ void AliFMD::AddDigit (Int_t * digits) { // add a real digit - as coming from data - + if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000); TClonesArray & ldigits = *fDigits; new (ldigits[fNdigits++]) AliFMDdigit (digits); - } + //_____________________________________________________________________________ void AliFMD::BuildGeometry () { @@ -182,7 +187,6 @@ void AliFMD::BuildGeometry () new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5); top->cd (); - // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,""); node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, ""); node->SetLineColor (kColorFMD); fNodes->Add (node); @@ -215,7 +219,6 @@ void AliFMD::ResetDigits () } //------------------------------------------------------------------------- - void AliFMD::Init () { // @@ -246,30 +249,31 @@ void AliFMD::Init () fIdSens5 = gMC->VolId ("GRN5"); //Si sensetive volume } - //--------------------------------------------------------------------- -void AliFMD::MakeBranch (Option_t * option, const char *file) +void AliFMD::MakeBranch (Option_t * option) { // Create Tree branches for the FMD. char branchname[10]; const Int_t kBufferSize = 16000; sprintf (branchname, "%s", GetName ()); - AliDetector::MakeBranch (option, file); + const char *cH = strstr(option,"H"); const char *cD = strstr(option,"D"); const char *cR = strstr(option,"R"); - if (cD){ + if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000); - MakeBranchInTree(gAlice->TreeD(), - branchname,&fDigits, - kBufferSize, file); - cout<<" tree "<TreeD()<<" "<TreeD(), branchname,&fDigits, kBufferSize, 0); } + if (cR){ - MakeBranchInTree(gAlice->TreeR(), - branchname,&fReconParticles, - kBufferSize, file); + if (fReconParticles == 0x0) + fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); + MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0); } } @@ -279,27 +283,28 @@ void AliFMD::SetTreeAddress () { // Set branch address for the Hits and Digits Tree. char branchname[30]; + + if (fLoader->TreeH() && (fHits == 0x0)) + fHits = new TClonesArray ("AliFMDhit", 1000); + AliDetector::SetTreeAddress (); TBranch *branch; - TTree *treeD = gAlice->TreeD (); - + TTree *treeD = fLoader->TreeD(); if (treeD) { - if (fDigits) - { - branch = treeD->GetBranch (branchname); - if (branch) - branch->SetAddress (&fDigits); - } - + if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000); + branch = treeD->GetBranch (branchname); + if (branch) + branch->SetAddress (&fDigits); } - - - if (gAlice->TreeR() && fReconParticles) + + if (fLoader->TreeR() && fReconParticles) { - branch = gAlice->TreeR()->GetBranch("FMD"); + if (fReconParticles == 0x0) + fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); + branch = fLoader->TreeR()->GetBranch("FMD"); if (branch) branch->SetAddress(&fReconParticles) ; } } @@ -308,8 +313,7 @@ void AliFMD::SetTreeAddress () void AliFMD::SetRingsSi1(Int_t ringsSi1) { - // fRingsSi1=ringsSi1; - fRingsSi1=768; + fRingsSi1=512; } void AliFMD::SetSectorsSi1(Int_t sectorsSi1) { @@ -317,15 +321,13 @@ void AliFMD::SetSectorsSi1(Int_t sectorsSi1) } void AliFMD::SetRingsSi2(Int_t ringsSi2) { - fRingsSi2=384; + fRingsSi2=256; } void AliFMD::SetSectorsSi2(Int_t sectorsSi2) { fSectorsSi2=40; } -//--------------------------------------------------------------------- - void @@ -341,14 +343,13 @@ AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius) printf ("%s: eta %f radius %f\n", ClassName (), eta, rad); } -//----------------------------------------------------------------------- +//--------------------------------------------------------------------- + void AliFMD::Digits2Reco() { - char * fileReconParticles=0; - char * fileHeader=0; - AliFMDReconstruction * reconstruction = - new AliFMDReconstruction(fileHeader,fileReconParticles) ; + AliFMDReconstruction * reconstruction = new AliFMDReconstruction(fLoader->GetRunLoader()); + cout<<" AliFMD::Digits2Reco >> "<Exec(""); delete reconstruction; } @@ -357,18 +358,14 @@ void AliFMD::Digits2Reco() void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file) { // - // Create TreeD branches for the MUON. + // Create TreeD branches for the FMD // - const Int_t kBufferSize = 4000; char branchname[20]; - - sprintf(branchname,"%s",GetName()); - if(treeD){ - MakeBranchInTree(treeD, - branchname,&fDigits, - kBufferSize, file); - } + if(treeD) + { + MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file); + } } diff --git a/FMD/AliFMD.h b/FMD/AliFMD.h index 74662065786..5800d17b6ea 100644 --- a/FMD/AliFMD.h +++ b/FMD/AliFMD.h @@ -7,25 +7,24 @@ // Manager and hits classes for set:Si-FMD // //////////////////////////////////////////////// -#include "TBranch.h" #include "AliDetector.h" - +#include "TBranch.h" class TClonesArray; -class AliFMD : public AliDetector { + class AliFMD : public AliDetector { public: AliFMD(); AliFMD(const char *name, const char *title); virtual ~AliFMD(); - virtual void AddHit(Int_t track, Int_t * vol, Float_t * hits); - virtual void AddDigit(Int_t* digits); - virtual void BuildGeometry(); + virtual void AddHit(Int_t, Int_t*, Float_t*); + virtual void AddDigit(Int_t*); + virtual void BuildGeometry(); virtual void CreateGeometry() {} virtual void CreateMaterials()=0; virtual Int_t DistanceToPrimitive(Int_t px, Int_t py); virtual Int_t IsVersion() const =0; virtual void Init(); - virtual void MakeBranch(Option_t *opt=" ",const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void MakeBranchInTreeD(TTree *treeD, const char *file=0); virtual void SetTreeAddress(); virtual void ResetHits(); @@ -39,12 +38,12 @@ public: virtual void SetSectorsSi2(Int_t sectorsSi2=40); void SetEventNumber(Int_t i) {fEvNrSig = i;} - void Eta2Radius(Float_t eta, Float_t zDisk, Float_t * radius); - void Digits2Reco(); - virtual void SetHitsAddressBranch(TBranch *b){b->SetAddress(&fHits);} - + void Eta2Radius(Float_t, Float_t, Float_t*); + void Digits2Reco(); + // Digitisation - TClonesArray *ReconParticles() const {return fReconParticles;} + TClonesArray *ReconParticles() const {return fReconParticles;} + virtual void SetHitsAddressBranch(TBranch *b){b->SetAddress(&fHits);} protected: Int_t fIdSens1; //Si sensetive volume @@ -61,7 +60,7 @@ public: Int_t fNevents ; // Number of events to digitize Int_t fEvNrSig; // signal event number - TClonesArray *fReconParticles; // list of reconstructed particles + TClonesArray *fReconParticles; ClassDef(AliFMD,5) //Class for the FMD detector }; diff --git a/FMD/AliFMDDigitizer.cxx b/FMD/AliFMDDigitizer.cxx index 673c0fa8eb6..f5b9d5fc546 100644 --- a/FMD/AliFMDDigitizer.cxx +++ b/FMD/AliFMDDigitizer.cxx @@ -24,13 +24,14 @@ #include "AliFMDDigitizer.h" #include "AliFMD.h" -#include "AliFMDSDigitizer.h" #include "AliFMDhit.h" #include "AliFMDdigit.h" #include "AliRunDigitizer.h" #include "AliRun.h" #include "AliPDG.h" +#include "AliLoader.h" +#include "AliRunLoader.h" #include #include @@ -49,7 +50,7 @@ ClassImp(AliFMDDigitizer) AliFMDDigitizer::AliFMDDigitizer(AliRunDigitizer* manager) :AliDigitizer(manager) { - cout<<"AliFMDDigitizer::AliFMDDigitizer"<2) @@ -64,18 +65,19 @@ AliFMDDigitizer::~AliFMDDigitizer() } //------------------------------------------------------------------------ -/* -Bool_t AliFMDDigitizer::Init() +Bool_t AliFMDDigitizer::Init() { +// Initialization cout<<"AliFMDDigitizer::Init"<> "<GetOutputFolderName()); + outgime = outRL->GetLoader("FMDLoader"); + cout<<"AliFMDDigitizer::Exec >> "<SDigits2Digits start...\n"; #endif - // cout<<" FMD "<GetDetector("FMD") ; - + inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + if (inRL == 0x0) + { + Error("Exec","Can not find Run Loader for input stream 0"); + return; + } + Info("Exec","inRL->GetAliRun() %#x",inRL->GetAliRun()); + + inRL->LoadgAlice(); + + AliFMD * fFMD = (AliFMD *) inRL->GetAliRun()->GetDetector("FMD"); + Info("Exec","inRL->GetAliRun(): %#x, FMD: %#x, InRL %#x.",inRL->GetAliRun(),fFMD,inRL); + if (fFMD == 0x0) + { + Error("Exec","Can not get FMD from gAlice"); + return; + } // Loop over files to digitize Int_t nFiles=GetManager()->GetNinputs(); - for (Int_t inputFile=0; inputFileGetOutputEventNr()<Hits (); - tH = fManager->GetInputTreeH(inputFile); - brHits = tH->GetBranch("FMD"); + { + + inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + ingime = inRL->GetLoader("FMDLoader"); + ingime->LoadHits("READ");//probably it is necessary to load them before + + + TH = ingime->TreeH(); + if (TH == 0x0) + { + ingime->LoadHits("read"); + TH = ingime->TreeH(); + } + brHits = TH->GetBranch("FMD"); if (brHits) { - fFMD->SetHitsAddressBranch(brHits); + // brHits->SetAddress(&fHits); + fFMD->SetHitsAddressBranch(brHits); }else{ - cerr<<"EXEC Branch FMD hit not found"<GetEntries(); - - for (Int_t track = 0; track < ntracks; track++) - { - brHits->GetEntry(track); - Int_t nhits = FMDhits->GetEntries (); - - for (hit = 0; hit < nhits; hit++) - { - fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit); - - volume = fmdHit->Volume (); - sector = fmdHit->NumberOfSector (); - ring = fmdHit->NumberOfRing (); - e = fmdHit->Edep (); - de[volume][sector][ring] += e; - - } //hit loop - } //track loop - } //if FMD + TClonesArray *FMDhits = fFMD->Hits (); + Int_t ntracks = (Int_t) TH->GetEntries(); + cout<<"Number of tracks TreeH"<GetEntry(track); + Int_t nhits = FMDhits->GetEntries (); + // if(nhits>0) cout<<"nhits "<UncheckedAt(hit); + + volume = fmdHit->Volume (); + sector = fmdHit->NumberOfSector (); + ring = fmdHit->NumberOfRing (); + e = fmdHit->Edep (); + de[volume][sector][ring] += e; + // if (fManager->GetOutputEventNr()>1) + // cout<<" "<Gaus(500,250)); + // digit[3]=PutNoise(charge); + digit[3]=charge + pedestal; + if(digit[3]<= 500) digit[3]=500; //dynamic range from MIP(0.155MeV) to 30MIP(4.65MeV) //1024 ADC channels - Float_t channelWidth=(22400*50)/1024; - digit[4]=Int_t(digit[3]/channelWidth); - if (digit[4]>1024) digit[4]=1024; - fFMD->AddDigit(digit); - } //ivol - } //iSector - } //iRing - - TTree* treeD = fManager->GetTreeD(); - treeD->Clear(); - treeD->Reset(); - fFMD->MakeBranchInTreeD(treeD); - treeD->Fill(); - - fManager->GetTreeD()->Write(0,TObject::kOverwrite); + Float_t channelWidth=(22400*50)/1024; + digit[4]=Int_t(digit[3]/channelWidth); + if (digit[4]>1024) digit[4]=1024; + fFMD->AddDigit(digit); + } //ivol + } //iSector + } //iRing + + TTree* treeD = outgime->TreeD(); + cout<<" treeD "<MakeTree("D"); + treeD = outgime->TreeD(); + cout<<" After MakeTree "<Clear(); + treeD->Reset(); + fFMD->MakeBranchInTreeD(treeD); + brD = treeD->GetBranch("FMD"); + cout<<" Make branch "<Fill(); //this operator does not work for events >1 + treeD->Print(); + outgime->WriteDigits("OVERWRITE"); - gAlice->ResetDigits(); - } + gAlice->ResetDigits(); + } } + + + + diff --git a/FMD/AliFMDDigitizer.h b/FMD/AliFMDDigitizer.h index 2c1b292603b..80349205bca 100644 --- a/FMD/AliFMDDigitizer.h +++ b/FMD/AliFMDDigitizer.h @@ -4,15 +4,16 @@ * See cxx source for full Copyright notice */ #include "AliDigitizer.h" -class TClonesArray; + class AliRunDigitizer; +class TClonesArray; class AliFMDDigitizer : public AliDigitizer { public: AliFMDDigitizer(); AliFMDDigitizer(AliRunDigitizer * manager); virtual ~AliFMDDigitizer(); - virtual Bool_t Init() {return kTRUE;} ///??????????? + virtual Bool_t Init(); // Do the main work diff --git a/FMD/AliFMDMerger.cxx b/FMD/AliFMDMerger.cxx index e5f7a609b9d..52e9cc8d2c3 100644 --- a/FMD/AliFMDMerger.cxx +++ b/FMD/AliFMDMerger.cxx @@ -12,28 +12,16 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +//Piotr.Skowronski@cern.ch +//Fast fixes to be able to compile with new Folder and I/O structure +//To be implemented correctly by the responsible person -/* -$Log$ -Revision 1.3 2001/10/21 18:36:31 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems +//PH 20/05/2003 It seems this class is obsolete and not used anymore -Revision 1.2 2001/09/24 16:41:15 hristov -New version of FMD code (A.Maevskaia) +/* $Id$ */ -Revision 1.1 2001/05/29 12:01:06 hristov -Last minute changes and new code for event mixing and reconstruction (A.Maevskaia) - -Revision 1.3 2001/03/05 23:57:44 morsch -Writing of digit tree moved to macro. - -Revision 1.2 2001/03/05 08:40:25 morsch -Method SortTracks(..) imported from AliMUON. - -Revision 1.1 2001/02/02 14:11:53 morsch -AliMUONMerger prototype to be called by the merge manager. +#include "AliFMDMerger.h" -*/ #include #include @@ -41,8 +29,10 @@ AliMUONMerger prototype to be called by the merge manager. #include #include +#include "AliDetector.h" +#include "AliRunLoader.h" +#include "AliLoader.h" -#include "AliFMDMerger.h" #include "AliFMD.h" #include "AliFMDSDigitizer.h" #include "AliFMDhit.h" @@ -63,6 +53,8 @@ ClassImp(AliFMDMerger) // Default constructor fEvNrSig = 0; fEvNrBgr = 0; + fBgrLoader = 0x0; + fSigLoader = 0x0; fMerge = kDigitize; fDigits = 0; fSDigits = 0; @@ -107,7 +99,6 @@ void AliFMDMerger::Init() { // Initialisation if (fMerge) fBgrFile = InitBgr(); - } @@ -116,7 +107,8 @@ void AliFMDMerger::Init() TFile* AliFMDMerger::InitBgr() { // Initialise background event - TFile *file = new TFile(fFnBgr); + fBgrLoader= AliRunLoader::Open(fFnBgr); + TFile *file = TFile::Open(fFnBgr); // add error checking later printf("\n AliFMDMerger has opened %s file with background event \n", fFnBgr); return file; @@ -134,7 +126,16 @@ void AliFMDMerger::Digitise() #ifdef DEBUG cout<<"ALiFMDMerger::>SDigits2Digits start...\n"; #endif - + if (fBgrLoader == 0x0) + { + cerr<<"AliFMDMerger::Digitise : Background Run Loader is NULL"<LoadgAlice(); + fBgrLoader->LoadHeader(); + fBgrLoader->LoadKinematics(); + AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ; Int_t chargeSum[10][30][150]; @@ -147,30 +148,48 @@ void AliFMDMerger::Digitise() {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1}; TFile *f1 =0; - TTree *TK = gAlice->TreeK(); + TTree *TK = fBgrLoader->TreeK(); if (TK) f1 = TK->GetCurrentFile(); - gAlice->GetEvent(fEvNrSig) ; + //just patches to be able to compile + + + fBgrLoader->GetEvent(fEvNrSig) ; + AliLoader* loader = fBgrLoader->GetLoader("FMDLoader"); + if (loader == 0x0) + { + cerr<<"AliFMDMerger::Digitise : Can not find loader for FMD. Exiting"<LoadDigits("UPDATE"); + if (retval == 0x0) + { + cerr<<"AliFMDMerger::Digitise : Error occured while loading digits. Exiting"<TreeD() == 0) + loader->MakeTree("D") ; - if(gAlice->TreeD() == 0) - gAlice->MakeTree("D") ; - gAlice->TreeD()->Reset(); + loader->TreeD()->Reset(); //Make branches ReadDigit( chargeSum, fEvNrSig); if(fMerge){ - fBgrFile->cd(); +// fBgrFile->cd(); // gAlice->TreeS()->Reset(); - gAlice = (AliRun*)fBgrFile->Get("gAlice"); + gAlice = fBgrLoader->GetAliRun(); Int_t chargeBgr[10][30][150]; ReadDigit( chargeBgr,fEvNrBgr); for ( ivol=1; ivol<=5; ivol++) for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++) - for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++) - chargeSum[ivol][iSector][iRing]= - chargeBgr[ivol][iSector][iRing]+ - chargeSum[ivol][iSector][iRing]; + for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++) + chargeSum[ivol][iSector][iRing]= + chargeBgr[ivol][iSector][iRing]+ + chargeSum[ivol][iSector][iRing]; } //if merge @@ -179,19 +198,19 @@ void AliFMDMerger::Digitise() for ( ivol=1; ivol<=5; ivol++){ for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++){ for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++){ - digit[0]=ivol; - digit[1]=iSector; - digit[2]=iRing; - digit[3]=PutNoise(chargeSum[ivol][iSector][iRing]); - if(chargeSum[ivol][iSector][iRing] <= 500) digit[3]=500; + digit[0]=ivol; + digit[1]=iSector; + digit[2]=iRing; + digit[3]=PutNoise(chargeSum[ivol][iSector][iRing]); + if(chargeSum[ivol][iSector][iRing] <= 500) digit[3]=500; //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV) //1024 ADC channels - Float_t channelWidth=(22400*50)/1024; - digit[4]=Int_t(digit[3]/channelWidth); - if (digit[4]>1024) digit[4]=1024; + Float_t channelWidth=(22400*50)/1024; + digit[4]=Int_t(digit[3]/channelWidth); + if (digit[4]>1024) digit[4]=1024; - FMD->AddDigit(digit); + FMD->AddDigit(digit); } //ivol } //iSector @@ -202,12 +221,12 @@ void AliFMDMerger::Digitise() //Make branch for digits FMD->MakeBranch("D"); - gAlice->TreeD()->Reset(); - gAlice->TreeD()->Fill(); + loader->TreeD()->Reset(); + loader->TreeD()->Fill(); - fDigits = FMD->Digits(); + fDigits = FMD->Digits();//should be moved to specialized loader (AliFMDLoader) - gAlice->TreeD()->Write(0,TObject::kOverwrite) ; + loader->WriteDigits("OVERWRITE"); gAlice->ResetDigits(); @@ -222,7 +241,7 @@ void AliFMDMerger::ReadDigit(Int_t chargeSum[][30][150], Int_t iEvNum) for (Int_t i=0; i<10; i++) for(Int_t j=0; j<30; j++) for(Int_t ij=0; ij<150; ij++) - chargeSum[i][j][ij]=0; + chargeSum[i][j][ij]=0; AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ; diff --git a/FMD/AliFMDMerger.h b/FMD/AliFMDMerger.h index 40ac715ea6f..bee02e46805 100644 --- a/FMD/AliFMDMerger.h +++ b/FMD/AliFMDMerger.h @@ -6,7 +6,12 @@ // #include "AliMerger.h" // #include "AliMergable.h" #include "TRandom.h" -#include "AliDetector.h" + + + +class AliRunLoader; +class TClonesArray; +class TFile; typedef enum {kDigitize=0, kMerge = 1} MergeMode_t; @@ -30,8 +35,8 @@ class AliFMDMerger { // Setters -> Later Communication with gAlice void SetSignalEventNumber(Int_t i) {fEvNrSig = i;} void SetBackgroundEventNumber(Int_t i) {fEvNrBgr = i;} - void SetBackgroundFileName(char* file) {fFnBgr = file;} - void SetSignalFileName(char* file) {fFnSig = file;} + void SetBackgroundFileName(char* file) {fFnBgr = file;} + void SetSignalFileName(char* file) {fFnSig = file;} void SetMode(MergeMode_t mode) {fMerge = mode;} // Granularity @@ -44,7 +49,7 @@ class AliFMDMerger { private: // Open the bgr file - TFile *InitBgr(); + TFile *InitBgr(); //Granularity Int_t fRingsSi1; // Number of rings Int_t fSectorsSi1; // Number of sectors @@ -61,6 +66,9 @@ class AliFMDMerger { char *fFnSig; // signal file name TFile *fBgrFile; // Pointer to background file + AliRunLoader* fBgrLoader; //! Background event run loader + AliRunLoader* fSigLoader; //! Signal event run loader + ClassDef(AliFMDMerger,0) }; #endif diff --git a/FMD/AliFMDReconstruction.cxx b/FMD/AliFMDReconstruction.cxx index dd5222ee3b8..0604948a218 100644 --- a/FMD/AliFMDReconstruction.cxx +++ b/FMD/AliFMDReconstruction.cxx @@ -30,10 +30,13 @@ // --- Standard library --- #include -#include "Riostream.h" +#include // --- AliRoot header files --- +#include "AliRunLoader.h" +#include "AliLoader.h" + #include "AliFMDdigit.h" #include "AliFMDhit.h" #include "AliFMDReconstParticles.h" @@ -41,8 +44,10 @@ #include "AliFMDv1.h" #include "AliFMDReconstruction.h" #include "AliRun.h" +#include "AliConfig.h" #include "AliHeader.h" #include "AliGenEventHeader.h" + ClassImp(AliFMDReconstruction) @@ -51,20 +56,31 @@ ClassImp(AliFMDReconstruction) AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","") { fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file - // add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + fRunLoader = 0x0; + } //____________________________________________________________________________ -AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","") +AliFMDReconstruction::AliFMDReconstruction(AliRunLoader* rl):TTask("AliFMDReconstruction","") { + + if (rl == 0x0) + { + Fatal("AliFMDReconstruction","Argument AliRunLoader* is null!"); + return; + } + fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file - fReconstParticlesFile=ReconstParticlesFile ; - fHeadersFile=HeaderFile ; + + fRunLoader = rl; + AliLoader* gime = fRunLoader->GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event"); + return;//never reached + } //add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + gime->PostReconstructioner(this); } //____________________________________________________________________________ @@ -72,12 +88,14 @@ AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstPartic AliFMDReconstruction::~AliFMDReconstruction() { } -//---------------------------------------------------------------------------- + +//____________________________________________________________________________ void AliFMDReconstruction::Exec(Option_t *option) { + //Collects all digits in the same active volume into number of particles /* - Reconstruct nember of particles + Reconstruct number of particles in given group of pads for given FMDvolume determine by numberOfVolume , numberOfMinSector,numberOfMaxSector, @@ -100,29 +118,78 @@ void AliFMDReconstruction::Exec(Option_t *option) Int_t numberOfSectors[5]= {20,40,20,40,20}; Int_t numberOfEtaIntervals[5]; // number of ring for boundary 0.1 eta - TBranch *brDigits=0; + + if (fRunLoader == 0x0) + { + Error("Exec","Run Loader loader is NULL - Session not opened"); + return; + } + AliLoader* gime = fRunLoader->GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event"); + return;//never reached + } + + fRunLoader->LoadgAlice(); + Int_t retval; + + retval = gime->LoadHits("READ"); + if (retval) + { + Error("Exec","Error occured while loading hits. Exiting."); + return; + } + + retval = gime->LoadDigits("READ"); + if (retval) + { + Error("Exec","Error occured while loading digits. Exiting."); + return; + } + AliFMD * fFMD = (AliFMD *) gAlice->GetDetector("FMD"); TClonesArray *fReconParticles=fFMD->ReconParticles(); - if(fNevents == 0) fNevents=(Int_t)gAlice->TreeE()->GetEntries(); - cout<<" fNevents "<TreeD(); + if (treeD == 0x0) + { + Error("Exec","Can not get Tree with Digits. Nothing to reconstruct - Exiting"); + return; + } + if(fNevents == 0) fNevents=(Int_t)treeD->GetEntries(); + //PH Do we use TreeE (kinematics), or TreeD (digits) toaccess the number + //PH of events? +//PH if(fNevents == 0) fNevents=(Int_t)gAlice->TreeE()->GetEntries(); +//PH cout<<" fNevents "<GetEvent(ievent) ; + + TTree* treeH = gime->TreeH(); + if (treeH == 0x0) + { + Error("Exec","Can not get TreeH"); + return; + } cout<<" ievent "<GetEvent(ievent) ; - if(gAlice->TreeH()==0) return; - if(gAlice->TreeD()==0) return; - brDigits=gAlice->TreeD()->GetBranch("FMD"); + + brDigits=treeD->GetBranch("FMD"); if (!brDigits){ cerr<<"EXEC Branch FMD digits not found"<TreeR()==0) gAlice->MakeTree("R"); + if(gime->TreeR()==0) gime->MakeTree("R"); + //Make branches fFMD->MakeBranch("R"); @@ -132,7 +199,7 @@ void AliFMDReconstruction::Exec(Option_t *option) AliFMDdigit *fmdDigit; if (fFMD) { - gAlice->TreeD()->GetEvent(0); + gime->TreeD()->GetEvent(0); TClonesArray *fFMDdigits=fFMD->Digits(); Int_t nDigits=fFMDdigits->GetEntries(); cout<<" nDigits "<GetHeader(); + AliHeader *header = fRunLoader->GetHeader(); AliGenEventHeader* genHeader = header->GenEventHeader(); TArrayF *o = new TArrayF(3); genHeader->PrimaryVertex(*o); @@ -214,12 +281,12 @@ void AliFMDReconstruction::Exec(Option_t *option) } // volume }//if FMD - gAlice->TreeR()->Reset(); - gAlice->TreeR()->Fill(); - gAlice->TreeR()->Write(0,TObject::kOverwrite); + gime->TreeR()->Reset(); + gime->TreeR()->Fill(); + gime->WriteRecPoints("OVERWRITE"); } //event loop cout<<"\nAliFMDReconstruction::Exec finished"< +#include -// --- AliRoot header files --- +// --- ROOT system --- +#include +#include +#include +#include +#include +#include +#include +// --- AliRoot header files --- +#include "AliConfig.h" +#include "AliDetector.h" +#include "AliFMD.h" +#include "AliFMDSDigitizer.h" #include "AliFMDdigit.h" #include "AliFMDhit.h" -#include "AliFMD.h" #include "AliFMDv1.h" -#include "AliFMDSDigitizer.h" +#include "AliLoader.h" #include "AliRun.h" -#include "AliDetector.h" - -#include "TFile.h" -#include "TTask.h" -#include "TTree.h" -#include "TSystem.h" -#include "TROOT.h" -#include "TFolder.h" -#include -#include +#include "AliRunLoader.h" +#include "AliStack.h" ClassImp(AliFMDSDigitizer) @@ -56,16 +58,28 @@ ClassImp(AliFMDSDigitizer) fNevents = 0 ; fSDigits = 0 ; fHits = 0 ; - + fRunLoader = 0; } //____________________________________________________________________________ - AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliFMDSDigitizer","") +AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliFMDSDigitizer","") { fNevents = 0 ; // Number of events to digitize, 0 means all evens in current file // add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + fRunLoader = AliRunLoader::Open(HeaderFile);//Load event in default folder + if (fRunLoader == 0x0) + { + Fatal("AliFMDSDigitizer","Can not open session. Header File is %s ",HeaderFile); + return;//never reached + } + AliLoader* gime = fRunLoader->GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDSDigitizer","Can not find FMD (loader) in specified event"); + return;//never reached + } + //add Task to //root/Tasks folder + gime->PostSDigitizer(this); } //____________________________________________________________________________ @@ -93,16 +107,39 @@ void AliFMDSDigitizer::SetSectorsSi2(Int_t sectorsSi2) } //____________________________________________________________________________ -void AliFMDSDigitizer::Exec(Option_t *option) { - - - - +void AliFMDSDigitizer::Exec(Option_t *option) + { Int_t NumberOfRings[5]= {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1}; Int_t NumberOfSectors[5]= {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1}; + if (fRunLoader) + { + Error("Exec","Run Loader loader is NULL - Session not opened"); + return; + } + AliLoader* gime = fRunLoader->GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event"); + return;//never reached + } + + fRunLoader->LoadgAlice(); + fRunLoader->LoadHeader(); + fRunLoader->LoadKinematics("READ"); + + Int_t retval; + + retval = gime->LoadHits("READ"); + if (retval) + { + Error("Exec","Error occured while loading hits. Exiting."); + return; + } + + // Initialise Hit array fHits = new TClonesArray ("AliFMDhit", 1000); fSDigits = new TClonesArray ("AliFMDdigit", 1000); @@ -110,26 +147,23 @@ void AliFMDSDigitizer::Exec(Option_t *option) { AliFMD *FMD = (AliFMD *) gAlice->GetDetector ("FMD"); if (fNevents == 0) - fNevents = (Int_t) gAlice->TreeE ()->GetEntries (); + fNevents = (Int_t) fRunLoader->TreeE ()->GetEntries (); for (Int_t ievent = 0; ievent < fNevents; ievent++) { - gAlice->GetEvent (ievent); - if (gAlice->TreeH () == 0) - return; - if (gAlice->TreeS () == 0) - gAlice->MakeTree ("S"); - + fRunLoader->GetEvent (ievent); + TTree* TH = gime->TreeH(); + if (TH == 0x0) + { + Error("Exec","Can not get TreeH"); + return; + } + if (gime->TreeS () == 0) gime->MakeTree("S"); - - //Make branches - char branchname[20]; - sprintf (branchname, "%s", FMD->GetName ()); //Make branch for digits - FMD->MakeBranch ("S"); - - //Now made SDigits from hits, for PHOS it is the same + FMD->MakeBranch ("S"); + //Now made SDigits from hits, for PHOS it is the same Int_t volume, sector, ring, charge; Float_t e; Float_t de[10][50][150]; @@ -142,65 +176,66 @@ void AliFMDSDigitizer::Exec(Option_t *option) { // Event ------------------------- LOOP for (ivol = 0; ivol < 10; ivol++) - for (isec = 0; isec < 50; isec++) - for (iring = 0; iring < 150; iring++) - de[ivol][isec][iring] = 0; + for (isec = 0; isec < 50; isec++) + for (iring = 0; iring < 150; iring++) + de[ivol][isec][iring] = 0; if (FMD) - { - FMDhits = FMD->Hits (); - TTree *TH = gAlice->TreeH (); - Stat_t ntracks = TH->GetEntries (); - for (Int_t track = 0; track < ntracks; track++) - { - gAlice->ResetHits (); - nbytes += TH->GetEvent (track); - particle = gAlice->Particle (track); - Int_t nhits = FMDhits->GetEntriesFast (); - - for (hit = 0; hit < nhits; hit++) - { - fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit); - - volume = fmdHit->Volume (); - sector = fmdHit->NumberOfSector (); - ring = fmdHit->NumberOfRing (); - e = fmdHit->Edep (); - de[volume][sector][ring] += e; - } //hit loop - } //track loop - } //if FMD + { + FMDhits = FMD->Hits (); + + + Stat_t ntracks = TH->GetEntries (); + for (Int_t track = 0; track < ntracks; track++) + { + gAlice->ResetHits (); + nbytes += TH->GetEvent(track); + particle = fRunLoader->Stack()->Particle (track); + Int_t nhits = FMDhits->GetEntriesFast (); + + for (hit = 0; hit < nhits; hit++) + { + fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit); + + volume = fmdHit->Volume (); + sector = fmdHit->NumberOfSector (); + ring = fmdHit->NumberOfRing (); + e = fmdHit->Edep (); + de[volume][sector][ring] += e; + } //hit loop + } //track loop + } //if FMD Int_t digit[5]; - Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6; + Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6; for (ivol = 1; ivol < 6; ivol++) - { - for (isec = 1; isec <= NumberOfSectors[ivol-1]; isec++) - { - for (iring = 1; iring <= NumberOfRings[ivol-1]; iring++) - { - digit[0] = ivol; - digit[1] = isec; - digit[2] = iring; - charge = Int_t (de[ivol][isec][iring] / I); - - digit[3] = charge; - //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV) - //1024 ADC channels - Float_t channelWidth = (22400 * 30) / 1024; - - digit[4] = Int_t (digit[3] / channelWidth); - FMD->AddSDigit(digit); - - } // iring loop - } //sector loop - } // volume loop + { + for (isec = 1; isec <= NumberOfSectors[ivol-1]; isec++) + { + for (iring = 1; iring <= NumberOfRings[ivol-1]; iring++) + { + digit[0] = ivol; + digit[1] = isec; + digit[2] = iring; + charge = Int_t (de[ivol][isec][iring] / I); + + digit[3] = charge; + //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV) + //1024 ADC channels + Float_t channelWidth = (22400 * 30) / 1024; + + digit[4] = Int_t (digit[3] / channelWidth); + FMD->AddSDigit(digit); + + } // iring loop + } //sector loop + } // volume loop - gAlice->TreeS()->Reset(); - gAlice->TreeS()->Fill(); - gAlice->TreeS()->Write(0,TObject::kOverwrite) ; - } //event loop + gime->TreeS()->Reset(); + gime->TreeS()->Fill(); + gime->WriteSDigits("OVERWRITE"); + } //event loop } diff --git a/FMD/AliFMDSDigitizer.h b/FMD/AliFMDSDigitizer.h index c77a2d4c246..5b6ed79d5f3 100644 --- a/FMD/AliFMDSDigitizer.h +++ b/FMD/AliFMDSDigitizer.h @@ -21,6 +21,8 @@ // --- AliRoot header files --- +class AliRunLoader; + class AliFMDSDigitizer: public TTask { public: @@ -51,13 +53,16 @@ private: TClonesArray *fSDigits ; // List of summable digits TClonesArray *fHits ; // List of summable digits TString fHeadersFile ; //input file + + AliRunLoader *fRunLoader;//!Run Loader + protected: //Granularity Int_t fRingsSi1; // Number of rings Int_t fSectorsSi1; // Number of sectors Int_t fRingsSi2; // Number of rings Int_t fSectorsSi2; // Number of sectors - + ClassDef(AliFMDSDigitizer,1) // description diff --git a/FMD/AliFMDv0.cxx b/FMD/AliFMDv0.cxx index c7edb790e19..e112abbc740 100644 --- a/FMD/AliFMDv0.cxx +++ b/FMD/AliFMDv0.cxx @@ -12,6 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + +/* $Id$ */ + ///////////////////////////////////////////////////////////////////// // // // Forward Multiplicity detector based on Silicon version 0 // @@ -25,21 +28,22 @@ // // ////////////////////////////////////////////////////////////////////// -#include +#include +#include + #include -#include +#include +#include #include -#include +#include #include + #include "AliFMDv0.h" -#include "AliRun.h" -#include -#include "AliRndm.h" #include "AliMagF.h" +#include "AliRndm.h" +#include "AliRun.h" #include "AliFMDhit.h" -#include -//class TGeant3; ClassImp(AliFMDv0) //-------------------------------------------------------------------- diff --git a/FMD/AliFMDv1.cxx b/FMD/AliFMDv1.cxx index b9fcd3cf712..0699b3bd4d7 100644 --- a/FMD/AliFMDv1.cxx +++ b/FMD/AliFMDv1.cxx @@ -12,6 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + +/* $Id$ */ + ///////////////////////////////////////////////////////////////////// // // // Forward Multiplicity detector based on Silicon version 0 // @@ -25,25 +28,27 @@ // // ////////////////////////////////////////////////////////////////////// -#include +#include +#include + +#include +#include +#include #include +#include +#include +#include #include -#include #include -#include -#include -#include -#include -#include "AliFMDv1.h" +#include + +#include "AliFMDdigit.h" +#include "AliFMDhit.h" #include "AliFMDv0.h" -#include "AliRun.h" -#include +#include "AliFMDv1.h" #include "AliMagF.h" -#include "AliFMDhit.h" -#include "AliFMDdigit.h" -#include -//#include "TGeant3.h" -//class TGeant3; +#include "AliRun.h" + ClassImp(AliFMDv1) //-------------------------------------------------------------------- @@ -213,7 +218,6 @@ void AliFMDv1::DrawDetector() // Draw a shaded view of the Forward multiplicity detector version 0 // - //Set ALIC mother transparent gMC->Gsatt("ALIC","SEEN",0); // diff --git a/FMD/FMDDigit.C b/FMD/FMDDigit.C index 1942a9cff53..4c87c0a97e8 100644 --- a/FMD/FMDDigit.C +++ b/FMD/FMDDigit.C @@ -6,7 +6,12 @@ void FMDDigit () gROOT->LoadMacro("loadlibs.C"); loadlibs(); } - + if (gAlice) + { + delete gAlice; + gAlice = 0x0; + } + AliRunDigitizer * manager = new AliRunDigitizer(1,1); manager->SetInputStream(0,"galice.root"); AliFMDDigitizer *FMD = new AliFMDDigitizer(manager); diff --git a/FMD/FMDReconstructor.C b/FMD/FMDReconstructor.C index 6151f0e7651..952e13e0200 100644 --- a/FMD/FMDReconstructor.C +++ b/FMD/FMDReconstructor.C @@ -9,9 +9,24 @@ void FMDReconstructor (Int_t evNumber=1) cout << "SPLIT" << endl; else cout << "NO SPLIT" << endl ; - TFile * f = new TFile("galice.root","UPDATE"); - gAlice = (AliRun*) f->Get("gAlice") ; + + + + //TFile * f = new TFile("galice.root","UPDATE"); + //gAlice = (AliRun*) f->Get("gAlice") ; + + AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read"); + if (rl == 0x0) + { + cerr<<"Can not open session for file galice.root\n"; + return; + } + + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + AliFMD* FMD = (AliFMD *)gAlice->GetDetector("FMD"); - gAlice->RunReco("FMD") ; + + gAlice->RunReco("FMD"); } diff --git a/HBTAN/AliHBTCorrelFctn.cxx b/HBTAN/AliHBTCorrelFctn.cxx index 042cc6b515a..bda4216832f 100644 --- a/HBTAN/AliHBTCorrelFctn.cxx +++ b/HBTAN/AliHBTCorrelFctn.cxx @@ -1,19 +1,16 @@ #include "AliHBTCorrelFctn.h" -//_____________________________________________________________ -/////////////////////////////////////////////////////////////// +//Set of Correlation fuctions +//AliHBTQInvCorrelFctn - Q Invariant correlatyion function // -// Set of Correlation fuctions -// AliHBTQInvCorrelFctn - Q Invariant correlatyion function // -// Corroleation function is created from dividing two histograms of QInvariant: -// of particles from the same evnt -// by -// of particles from different events // -/////////////////////////////////////////////////////////////// ClassImp(AliHBTQInvCorrelFctn) +//Corroleation function is created from dividing two histograms of QInvariant: +// of particles from the same evnt +//by +// of particles from different events AliHBTQInvCorrelFctn:: AliHBTQInvCorrelFctn(Int_t nbins, Double_t maxXval, Double_t minXval): diff --git a/HBTAN/AliHBTCorrelFctn.h b/HBTAN/AliHBTCorrelFctn.h index 407e1358ffb..9c001a99efe 100644 --- a/HBTAN/AliHBTCorrelFctn.h +++ b/HBTAN/AliHBTCorrelFctn.h @@ -1,19 +1,15 @@ #ifndef ALIHBTCORRELFUNCTION_H #define ALIHBTCORRELFUNCTION_H -//_________________________________________________________________ -/////////////////////////////////////////////////////////////////// -// + +#include "AliHBTFunction.h" +#include "AliHBTParticle.h" +#include //Set of functions: // Q Invaraint Correlation Function // Invariant Mass Function // //more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html //Piotr.Skowronski@cern.ch -// -/////////////////////////////////////////////////////////////////// -#include "AliHBTFunction.h" - -class AliHBTParticle; /*************************************************************************************/ class AliHBTQInvCorrelFctn: public AliHBTOnePairFctn1D diff --git a/HBTAN/AliHBTEvent.cxx b/HBTAN/AliHBTEvent.cxx index bf3bd7e4c8d..de7cdf29fd8 100644 --- a/HBTAN/AliHBTEvent.cxx +++ b/HBTAN/AliHBTEvent.cxx @@ -19,7 +19,12 @@ const UInt_t AliHBTEvent::fgkInitEventSize = 100; /**************************************************************************/ -AliHBTEvent::AliHBTEvent() +AliHBTEvent::AliHBTEvent(): + fSize(fgkInitEventSize), + fParticles(new AliHBTParticle* [fSize]), + fNParticles(0), + fOwner(kTRUE), + fRandomized(kFALSE) { //default constructor if(fgkInitEventSize<1) @@ -29,10 +34,6 @@ AliHBTEvent::AliHBTEvent() fgkInitEventSize); } - fSize=fgkInitEventSize; - fParticles = new AliHBTParticle* [fSize]; - fNParticles = 0; - fOwner = kTRUE; } /**************************************************************************/ diff --git a/HBTAN/AliHBTEvent.h b/HBTAN/AliHBTEvent.h index 1b0f52d1ead..cfd0f853a12 100644 --- a/HBTAN/AliHBTEvent.h +++ b/HBTAN/AliHBTEvent.h @@ -1,5 +1,5 @@ -#ifndef ALIHBTEvent_H -#define ALIHBTEvent_H +#ifndef ALIHBTEVENT_H +#define ALIHBTEVENT_H //__________________________________________________________ /////////////////////////////////////////////////////////////////// // @@ -36,12 +36,14 @@ class AliHBTEvent: public TObject void Reset(); //deletes all entries void SetOwner(Bool_t owns = kTRUE){ fOwner = owns; } Bool_t IsOwner() {return fOwner;} - + void SetRandomized(Bool_t rd = kTRUE){fRandomized = rd;} + Bool_t IsRandomized()const {return fRandomized;} protected: + Int_t fSize; //!current size of the array AliHBTParticle ** fParticles; //!array of pointers to the particles Int_t fNParticles; //!number of particles in Event - Int_t fSize; //!current size of the array Bool_t fOwner; //flag if that event owns the + Bool_t fRandomized; //!flag indicating if particles positions has been already randomizd void Expand(); //expands the array if necessary private: diff --git a/HBTAN/AliHBTLLWeightFctn.cxx b/HBTAN/AliHBTLLWeightFctn.cxx index 192dde6ad72..0cc61f44213 100644 --- a/HBTAN/AliHBTLLWeightFctn.cxx +++ b/HBTAN/AliHBTLLWeightFctn.cxx @@ -10,10 +10,13 @@ //Author: Ludmila Malinina, JINR (malinina@sunhe.jinr.ru) #include "AliHBTLLWeightFctn.h" #include "AliHBTLLWeights.h" +#include "AliHBTLLWeightsPID.h" //--for test--AliHBTLLWeightQInvFctn* yyy= new AliHBTLLWeightQInvFctn(); -ClassImp( AliHBTLLWeightQInvFctn ) +ClassImp( AliHBTLLWeightQInvFctn ) + + /****************************************************************/ AliHBTLLWeightQInvFctn::AliHBTLLWeightQInvFctn(Int_t nbins, Double_t maxXval, Double_t minXval): AliHBTTwoPairFctn1D(nbins,maxXval,minXval) diff --git a/HBTAN/AliHBTLLWeightFctn.h b/HBTAN/AliHBTLLWeightFctn.h index a300c0366e6..2505073d31b 100644 --- a/HBTAN/AliHBTLLWeightFctn.h +++ b/HBTAN/AliHBTLLWeightFctn.h @@ -8,7 +8,6 @@ class AliHBTLLWeights; - class AliHBTLLWeightQInvFctn: public AliHBTTwoPairFctn1D { public: @@ -18,7 +17,7 @@ class AliHBTLLWeightQInvFctn: public AliHBTTwoPairFctn1D void ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair); void ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair); - Double_t GetValue(AliHBTPair* trackpair, AliHBTPair* partpair) const + Double_t GetValue(AliHBTPair* trackpair, AliHBTPair* partpair) { return trackpair->GetQInv()-partpair->GetQInv();} //isn't use ClassDef(AliHBTLLWeightQInvFctn,1) }; diff --git a/HBTAN/AliHBTLLWeights.cxx b/HBTAN/AliHBTLLWeights.cxx index e3d23295290..e53acfd388f 100644 --- a/HBTAN/AliHBTLLWeights.cxx +++ b/HBTAN/AliHBTLLWeights.cxx @@ -1,22 +1,140 @@ -/* $Id$ */ - -//------------------------------------------------------------------ -// This class introduces the weight's calculation -// according to the Lednicky's algorithm. -// The detailed description of the algorithm can be found -// in comments to fortran code: -// fsiw.f, fsiini.f -// Author: -//------------------------------------------------------------------ - -#include -#include -#include - #include "AliHBTLLWeights.h" -#include "AliHBTPair.h" -#include "AliHBTParticle.h" -#include "WLedCOMMONS.h" +/************************************************************************** + * 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. * + **************************************************************************/ + +//_________________________________________________________________________ +/////////////////////////////////////////////////////////////////////////// +// +// class AliHBTLLWeights +// +// This class introduces the weight's calculation +// according to the Lednicky's algorithm. +// +// +// fsiw.f, fsiini.f +// +// Description from fortran code by author R. Lednicky +// +// Calculates final state interaction (FSI) weights +// WEIF = weight due to particle - (effective) nucleus FSI (p-N) +// WEI = weight due to p-p-N FSI +// WEIN = weight due to p-p FSI; note that WEIN=WEI if I3C=0; +// note that if I3C=1 the calculation of +// WEIN can be skipped by putting J=0 +//....................................................................... +// Correlation Functions: +// CF(p-p-N) = sum(WEI)/sum(WEIF) +// CF(p-p) = sum(WEIN)/sum(1); here the nucleus is completely +// inactive +// CF(p-p-"N") = sum(WEIN*WEIF')/sum(WEIF'), where WEIN and WEIF' +// are not correlated (calculated at different emission +// points, e.g., for different events); +// thus here the nucleus affects one-particle +// spectra but not the correlation +//....................................................................... +// User must supply data file on unit NUNIT (e.g. =11) specifying +// LL : particle pair +// NS : approximation used to calculate Bethe-Salpeter amplitude +// ITEST: test switch +// If ITEST=1 then also following parameters are required +// ICH : 1(0) Coulomb interaction between the two particles ON (OFF) +// IQS : 1(0) quantum statistics for the two particles ON (OFF) +// ISI : 1(0) strong interaction between the two particles ON (OFF) +// I3C : 1(0) Coulomb interaction with residual nucleus ON (OFF) +// This data file can contain other information useful for the user. +// It is read by subroutines READINT4 and READREA8(4) (or READ_FILE). +// ------------------------------------------------------------------- +//- LL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 +//- part. 1: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K- +//- part. 2: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p +// NS=1 y/n: + + + + + - - - - - - - - - - - - +// ------------------------------------------------------------------- +//- LL 18 19 20 21 22 23 24 25 26 27 28 +//- part. 1: d d t t K0 K0 d p p p n +//- part. 2: d alfa t alfa K0 K0b t t alfa lambda lambda +// NS=1 y/n: - - - - - - - - - + + +// ------------------------------------------------------------------- +// NS=1 Square well potential, +// NS=3 not used +// NS=4 scattered wave approximated by the spherical wave, +// NS=2 same as NS=4 but the approx. of equal emission times in PRF +// not required (t=0 approx. used in all other cases). +// Note: if NS=2,4, the B-S amplitude diverges at zero distance r* in +// the two-particle c.m.s.; user can specify a cutoff AA in +// SUBROUTINE FSIINI, for example: +// IF(NS.EQ.2.OR.NS.EQ.4)AA=5.D0 !! in 1/GeV --> AA=1. fm +// ------------------------------------------------------------------ +// ITEST=1 any values of parameters ICH, IQS, ISI, I3C are allowed +// and should be given in data file +// ITEST=0 physical values of these parameters are put automatically +// in FSIINI (their values are not required in data file) +//===================================================================== +// At the beginning of calculation user should call FSIINI, +// which reads LL, NS, ITEST (and eventually ICH, IQS, ISI, I3C) +// and initializes various parameters. +// In particular the constants in +// COMMON/FSI_CONS/PI,PI2,SPI,DR,W +// may be useful for the user: +// W=1/.1973D0 ! from fm to 1/GeV +// PI=4*DATAN(1.D0) +// PI2=2*PI +// SPI=DSQRT(PI) +// DR=180.D0/PI ! from radian to degree +// _______________________________________________________ +// !! |Important note: all real quantities are assumed REAL*8 | !! +// ------------------------------------------------------- +// For each event user should fill in the following information +// in COMMONs (all COMMONs in FSI calculation start with FSI_): +// ................................................................... +// COMMON/FSI_POC/AMN,AM1,AM2,CN,C1,C2,AC1,AC2 +// Only +// AMN = mass of the effective nucleus [GeV/c**2] +// CN = charge of the effective nucleus [elem. charge units] +// are required +// ................................................................... +// COMMON/FSI_MOM/P1X,P1Y,P1Z,E1,P1, !part. momenta in the rest frame +// 1 P2X,P2Y,P2Z,E2,P2 !of effective nucleus (NRF) +// Only the components +// PiX,PiY,PiZ [GeV/c] +// in NRF are required. +// To make the corresponding Lorentz transformation user can use the +// subroutines LTRAN and LTRANB +// ................................................................... +// COMMON/FSI_COOR/X1,Y1,Z1,T1,R1, ! 4-coord. of emission +// 1 X2,Y2,Z2,T2,R2 ! points in NRF +// The componets +// Xi,Yi,Zi [fm] +// and emission times +// Ti [fm/c] +// should be given in NRF with the origin assumed at the center +// of the effective nucleus. If the effect of residual nucleus is +// not calculated within FSIW, the NRF can be any fixed frame. +// -------------------------------------------------------------------- +// Before calling FSIW the user must call +// CALL LTRAN12 +// Besides Lorentz transformation to pair rest frame: +// (p1-p2)/2 --> k* it also transforms 4-coordinates of +// emission points from fm to 1/GeV and calculates Ei,Pi and Ri. +// Note that |k*|=AK in COMMON/FSI_PRF/ +// -------------------------------------------------------------------- +// After making some additional filtering using k* (say k* < k*max) +// or direction of vector k*, +// user can finally call FSIW to calculate the FSI weights +// to be used to construct the correlation function +//====================================================================== + /*******************************************************************/ /****** ROUTINES USED FOR COMMUNUCATION ********/ @@ -27,12 +145,14 @@ # define fsiini fsiini_ # define ltran12 ltran12_ # define fsiw fsiw_ +# define setpdist setpdist_ # define type_of_call #else # define led_bldata LED_BLDATA # define fsiini FSIINI # define ltran12 LTRAN12 # define fsiw FSIW +# define setpdist SETPDIST # define type_of_call _stdcall #endif /****************************************************************/ @@ -40,199 +160,210 @@ extern "C" void type_of_call led_bldata(); extern "C" void type_of_call fsiini(); extern "C" void type_of_call ltran12(); extern "C" void type_of_call fsiw(); +extern "C" void type_of_call setpdist(Double_t& r); /**************************************************************/ +#include "AliHBTPair.h" +#include "AliHBTParticle.h" +#include "WLedCOMMONS.h" +#include +#include +#include +#include + + ClassImp(AliHBTLLWeights) -AliHBTLLWeights* AliHBTLLWeights::fgLLWeights=NULL; +AliHBTLLWeights* AliHBTLLWeights::fgLLWeights = 0x0; +const Double_t AliHBTLLWeights::fgkWcons = 1./0.1973; -AliHBTLLWeights::AliHBTLLWeights() +AliHBTLLWeights::AliHBTLLWeights(): + fTest(kTRUE), + fColoumbSwitch(kTRUE), + fQuantStatSwitch(kTRUE), + fStrongInterSwitch(kTRUE), + fColWithResidNuclSwitch(kTRUE), + fNuclMass(0.0), + fNuclCharge(0.0), + fRandomPosition(kFALSE), + fRadius(0.0), + fPID1(0), + fPID2(0), + fSigma(0.0) { - // Default Constructor - fPID1 = 0; - fPID2 = 0; - SetRandomPosition(); - SetColWithResidNuclSwitch(); - SetStrongInterSwitch(); - SetQuantumStatistics(); - SetColoumb(); - SetTest(); - +// Default Constructor } - +/**************************************************************/ AliHBTLLWeights* AliHBTLLWeights::Instance() -{ - // Instantiates new object or returns a pointer to already exitsing one - if (fgLLWeights) { - return fgLLWeights; - } else { - fgLLWeights = new AliHBTLLWeights(); +{ +// returns instance of class + if (fgLLWeights) + { return fgLLWeights; - } -} - + } + else + { + fgLLWeights = new AliHBTLLWeights(); + return fgLLWeights; + } +} + Double_t AliHBTLLWeights::GetWeight(const AliHBTPair* partpair) { - // Returns the weignt of the pair "partpair" +// calculates weight for a pair + static const Double_t cmtofm = 1.e13; + AliHBTParticle *part1 = partpair->Particle1(); AliHBTParticle *part2 = partpair->Particle2(); if ( (part1 == 0x0) || (part2 == 0x0)) - { - Error("GetWeight","Null particle pointer"); - return 0.0; - } - - - Double_t part1Momentum[]={part1->Px(),part1->Py(),part1->Pz()}; - Double_t part2Momentum[]={part2->Px(),part2->Py(),part2->Pz()}; - + { + Error("GetWeight","Null particle pointer"); + return 0.0; + } + + +//eats a lot of time if ( (part1->Px() == part2->Px()) && (part1->Py() == part2->Py()) && (part1->Pz() == part2->Pz()) ) - { - return 0.0; - } - - + { + return 0.0; + } + if ((!fRandomPosition) && - (part1->Vx() == part2->Vx()) && (part1->Vy() == part2->Vy()) - && (part1->Vz() == part2->Vz()) ) + (part1->Vx() == part2->Vx()) && + (part1->Vy() == part2->Vy()) && + (part1->Vz() == part2->Vz()) ) { return 0.0; } - - - - FSI_MOM.P1X=part1Momentum[0]; - FSI_MOM.P1Y=part1Momentum[1]; - FSI_MOM.P1Z=part1Momentum[2]; - - FSI_MOM.P2X=part2Momentum[0]; - FSI_MOM.P2Y=part2Momentum[1]; - FSI_MOM.P2Z=part2Momentum[2]; - - if (fRandomPosition){ - - Double_t rxcm = fsigma*gRandom->Gaus(); - Double_t rycm = fsigma*gRandom->Gaus(); - Double_t rzcm = fsigma*gRandom->Gaus(); - - FSI_PRF.X=rxcm*fwcons; - FSI_PRF.Y=rycm*fwcons; - FSI_PRF.Z=rzcm*fwcons; - FSI_PRF.T=0.; - - Double_t rps=rxcm*rxcm+rycm*rycm+rzcm*rzcm; - Double_t rp=TMath::Sqrt(rps); - FSI_PRF.RP=rp; - FSI_PRF.RPS=rps; - - } + + FSI_MOM.P1X = part1->Px(); + FSI_MOM.P1Y = part1->Py(); + FSI_MOM.P1Z = part1->Pz(); + + FSI_MOM.P2X = part2->Px(); + FSI_MOM.P2Y = part2->Py(); + FSI_MOM.P2Z = part2->Pz(); + + FSI_COOR.X1 = part1->Vx()*cmtofm; + FSI_COOR.Y1 = part1->Vy()*cmtofm; + FSI_COOR.Z1 = part1->Vz()*cmtofm; + FSI_COOR.T1 = part1->T(); + + FSI_COOR.X2 = part2->Vx()*cmtofm; + FSI_COOR.Y2 = part2->Vy()*cmtofm; + FSI_COOR.Z2 = part2->Vz()*cmtofm; + FSI_COOR.T2 = part2->T(); ltran12(); - fsiw(); - if(flambda<1){ - if(gRandom->Rndm()<(1-flambda))LEDWEIGHT.WEIN=1.;} - + //this must be after ltran12 because it would overwrite what we set below + if (fRandomPosition) + { + Double_t rxcm = fSigma*gRandom->Gaus(); + Double_t rycm = fSigma*gRandom->Gaus(); + Double_t rzcm = fSigma*gRandom->Gaus(); + + FSI_PRF.X=rxcm*fgkWcons; + FSI_PRF.Y=rycm*fgkWcons; + FSI_PRF.Z=rzcm*fgkWcons; + FSI_PRF.T=0.; + + Double_t rps=rxcm*rxcm+rycm*rycm+rzcm*rzcm; + Double_t rp=TMath::Sqrt(rps); + setpdist(rp); + } + + fsiw(); return LEDWEIGHT.WEIN; } - /************************************************************/ + void AliHBTLLWeights::Init() { - //--------------------------------------------------------------------- - //initial parameters of model - +//initial parameters of model + FSI_NS.NS = fApproximationModel; - if(!ftest){LEDWEIGHT.ITEST=0;} - - if(ftest){ - LEDWEIGHT.ITEST=1; - if(fColoumbSwitch){FSI_NS.ICH =1;} - else{FSI_NS.ICH=0;} - if(fStrongInterSwitch){FSI_NS.ISI=1;} - else{FSI_NS.ISI=0;} - if(fQuantStatSwitch){FSI_NS.IQS=1;} - else{FSI_NS.IQS=0;} - if(fColWithResidNuclSwitch){FSI_NS.I3C=1;} - else{FSI_NS.I3C=0;} - } - - if(fRandomPosition){LEDWEIGHT.IRANPOS=1;} - else{LEDWEIGHT.IRANPOS=0;} - - + LEDWEIGHT.ITEST = fTest; + if(fTest) + { + FSI_NS.ICH = fColoumbSwitch; + FSI_NS.ISI = fStrongInterSwitch; + FSI_NS.IQS = fQuantStatSwitch; + FSI_NS.I3C = fColWithResidNuclSwitch; + LEDWEIGHT.IRANPOS = fRandomPosition; + } + if ( (fPID1 == 0) || (fPID2 == 0) ) - { - Fatal("Init","Particles types are not set"); - return;//pro forma - } - + { + Fatal("Init","Particles types are not set"); + return;//pro forma + } FSI_NS.LL = GetPairCode(fPID1,fPID2); - + if (FSI_NS.LL == 0) - { - Fatal("Init","Particles types are not supported"); - return;//pro forma - } - - + { + Fatal("Init","Particles types are not supported"); + return;//pro forma + } + + TParticlePDG* tpart1 = TDatabasePDG::Instance()->GetParticle(fPID1); if (tpart1 == 0x0) - { - Fatal("init","We can not find particle with ID=%d in our DataBase",fPID1); - return; - } - + { + Fatal("init","We can not find particle with ID=%d in PDG DataBase",fPID1); + return; + } + FSI_POC.AM1=tpart1->Mass(); FSI_POC.C1=tpart1->Charge(); - + TParticlePDG* tpart2 = TDatabasePDG::Instance()->GetParticle(fPID2); - //mlv - - - +//lv if (tpart2 == 0x0) - { - Fatal("init","We can not find particle with ID=%d in our DataBase",fPID2); - return; - } - + { + Fatal("init","We can not find particle with ID=%d in our DataBase",fPID2); + return; + } + FSI_POC.AM2=tpart2->Mass(); FSI_POC.C1=tpart2->Charge(); - + led_bldata(); fsiini(); - - - //constants for radii simulation - - if(fRandomPosition){ - fsigma =TMath::Sqrt(2.)*fRadius; - fwcons =FSI_CONS.W; - } + + +//constants for radii simulation + + if(fRandomPosition) + { + fSigma =TMath::Sqrt(2.)*fRadius; + } } +/************************************************************/ Int_t AliHBTLLWeights::GetPairCode(const AliHBTPair* partpair) { - // Return the code of the pair "partpair" - return GetPairCode(partpair->Particle1()->GetPdgCode(),partpair->Particle2()->GetPdgCode()); +//returns Code corresponding to that pair + return GetPairCode(partpair->Particle1()->GetPdgCode(),partpair->Particle2()->GetPdgCode()); } +/************************************************************/ Int_t AliHBTLLWeights::GetPairCode(Int_t pid1,Int_t pid2) { - // pairCode 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 - // hpid: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K- d d t t K0 K0 d p p p n - // lpid: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p d alfa t alfa K0 K0b t t alfa lambda lambda - // NS=1 y/n: + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - //alphas, deuterons and tyts are NOT supported here - +// returns code corresponding to the pair of PIDs +// pairCode 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 +// hpid: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K- d d t t K0 K0 d p p p n +// lpid: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p d alfa t alfa K0 K0b t t alfa lambda lambda +// NS=1 y/n: + + + + + - - - - - - - - - - - - - - - - - - - - - - - + +//alphas, deuterons and tyts are NOT supported here + Int_t chargefactor = 1; Int_t hpid; //pid in higher row Int_t lpid; //pid in lower row @@ -240,166 +371,247 @@ Int_t AliHBTLLWeights::GetPairCode(Int_t pid1,Int_t pid2) Bool_t swap; - //determine the order of selcetion in switch +//determine the order of selcetion in switch if (TMath::Abs(pid1) < TMath::Abs(pid2) ) - { - if (pid1<0) chargefactor=-1; - hpid=pid2*chargefactor; - lpid=pid1*chargefactor; - swap = kFALSE; - } + { + if (pid1<0) chargefactor=-1; + hpid=pid2*chargefactor; + lpid=pid1*chargefactor; + swap = kFALSE; + } else - { - if (pid2<0) chargefactor=-1; - hpid=pid1*chargefactor; - lpid=pid2*chargefactor; - swap = kTRUE; - } - - //mlv - hpid=pid1; - lpid=pid2; - - - //Determine the pair code + { + if (pid2<0) chargefactor=-1; + hpid=pid1*chargefactor; + lpid=pid2*chargefactor; + swap = kTRUE; + } + +//mlv + hpid=pid1; + lpid=pid2; + + +//Determine the pair code switch (hpid) //switch on first particle id - { - case kNeutron: + { + case kNeutron: switch (lpid) - { - case kNeutron: - code = 1; //neutron neutron - break; - - case kProton: - code = 3; //neutron proton - break; - - case kLambda0: - code = 28; //neutron lambda - break; - - default: - return 0; //given pair not supported - break; - } + { + case kNeutron: + code = 1; //neutron neutron + break; + + case kProton: + code = 3; //neutron proton + break; + + case kLambda0: + code = 28; //neutron lambda + break; + + default: + return 0; //given pair not supported + break; + } break; - - case kProton: + + case kProton: switch (lpid) - { - case kProton: - code = 2; //proton proton - break; - - case kLambda0: - code = 27;//proton lambda - break; - - default: - return 0; //given pair not supported - break; - - } + { + case kProton: + code = 2; //proton proton + break; + + case kLambda0: + code = 27;//proton lambda + break; + + default: + return 0; //given pair not supported + break; + + } break; - - case kPiPlus: - + + case kPiPlus: + switch (lpid) - { - case kPiPlus: - code = 7; //piplus piplus - break; - - case kPiMinus: - code = 5; //piplus piminus - break; - - case kKMinus: - code = 10; //piplus Kminus - break; - - case kKPlus: - code = 11; //piplus Kplus - break; - - case kProton: - code = 12; //piplus proton - chargefactor*=-1; - break; - - default: - return 0; //given pair not supported - break; - } + { + case kPiPlus: + code = 7; //piplus piplus + break; + + case kPiMinus: + code = 5; //piplus piminus + break; + + case kKMinus: + code = 10; //piplus Kminus + break; + + case kKPlus: + code = 11; //piplus Kplus + break; + + case kProton: + code = 12; //piplus proton + chargefactor*=-1; + break; + + default: + return 0; //given pair not supported + break; + } break; - case kPi0: + case kPi0: switch (lpid) - { - case kPi0: - code = 6; - break; - - default: - return 0; //given pair not supported - break; - } + { + case kPi0: + code = 6; + break; + + default: + return 0; //given pair not supported + break; + } break; - case kKPlus: + case kKPlus: switch (lpid) - { - case kKMinus: - code = 14; //Kplus Kminus - break; - - case kKPlus: - code = 15; //Kplus Kplus - break; - - case kProton: - code = 16; //Kplus proton - break; - - default: - return 0; //given pair not supported - break; - } + { + case kKMinus: + code = 14; //Kplus Kminus + break; + + case kKPlus: + code = 15; //Kplus Kplus + break; + + case kProton: + code = 16; //Kplus proton + break; + + default: + return 0; //given pair not supported + break; + } break; - case kKMinus: + case kKMinus: switch (lpid) - { - case kProton: - code = 17; //Kminus proton - chargefactor*=1; - break; - - default: - return 0; //given pair not supported - break; - } + { + case kProton: + code = 17; //Kminus proton + chargefactor*=1; + break; + + default: + return 0; //given pair not supported + break; + } break; - case kK0: + case kK0: switch (lpid) - { - case kK0: - code = 2; //Kzero Kzero - break; - - case kK0Bar: - code = 17; //Kzero KzeroBar - break; - - default: - return 0; //given pair not supported - break; - } + { + case kK0: + code = 2; //Kzero Kzero + break; + + case kK0Bar: + code = 17; //Kzero KzeroBar + break; + + default: + return 0; //given pair not supported + break; + } break; - - default: return 0; - } + + default: return 0; + } return code; } +/************************************************************/ + +void AliHBTLLWeights::SetTest(Bool_t rtest) +{ + //Sets fTest member + fTest = rtest; +} +/************************************************************/ + +void AliHBTLLWeights::SetColoumb(Bool_t col) +{ + // (ICH in fortran code) Coulomb interaction between the two particles ON (OFF) + fColoumbSwitch = col; +} +/************************************************************/ + +void AliHBTLLWeights::SetQuantumStatistics(Bool_t qss) +{ + //IQS: quantum statistics for the two particles ON (OFF) + //if non-identical particles automatically off + fQuantStatSwitch = qss; +} +/************************************************************/ + +void AliHBTLLWeights::SetStrongInterSwitch(Bool_t sis) +{ + //ISI: strong interaction between the two particles ON (OFF) + fStrongInterSwitch = sis; +} +/************************************************************/ +void AliHBTLLWeights::SetColWithResidNuclSwitch(Bool_t crn) +{ + //I3C: Coulomb interaction with residual nucleus ON (OFF) + fColWithResidNuclSwitch = crn; +} +/************************************************************/ + +void AliHBTLLWeights::SetApproxModel(Int_t ap) +{ + //sets Model of Approximation (NS in Fortran code) + fApproximationModel=ap; +} +/************************************************************/ + +void AliHBTLLWeights::SetRandomPosition(Bool_t rp) +{ + //ON=kTRUE(OFF=kFALSE) + //ON -- calculation of the Gauss source radii + //if the generator don't allows the source generation (for example MeVSim) + //if ON the following parameters are requested: + fRandomPosition = rp; +} +/************************************************************/ + +void AliHBTLLWeights::SetR1dw(Double_t R) +{ + //spherical source model radii + fRadius=R; +} +/************************************************************/ + +void AliHBTLLWeights::SetParticlesTypes(Int_t pid1, Int_t pid2) +{ + //set AliRoot particles types + fPID1 = pid1; + fPID2 = pid2; +} +/************************************************************/ + +void AliHBTLLWeights::SetNucleusCharge(Double_t ch) +{ + // not used now (see comments in fortran code) + fNuclCharge=ch; +} +/************************************************************/ + +void AliHBTLLWeights::SetNucleusMass(Double_t mass) +{ + // (see comments in fortran code) + fNuclMass=mass; +} diff --git a/HBTAN/AliHBTLLWeights.h b/HBTAN/AliHBTLLWeights.h index a533dec72a6..93cd15931c5 100644 --- a/HBTAN/AliHBTLLWeights.h +++ b/HBTAN/AliHBTLLWeights.h @@ -5,6 +5,7 @@ // The detailed description of the algorithm can be found // in comments to fortran code: // fsiw.f, fsiini.f + #ifndef ALIHBTLLWEIGHTS_H #define ALIHBTLLWEIGHTS_H @@ -12,139 +13,58 @@ class AliHBTPair; class AliHBTLLWeights: public TObject -{ - public: - virtual ~AliHBTLLWeights(){;} - AliHBTLLWeights(const AliHBTLLWeights &source) { - //Copy ctor needed by the coding conventions but not used - Fatal("AliHBTLLWeights","copy ctor not implemented"); - } - AliHBTLLWeights & operator=(const AliHBTLLWeights &source) { - //Assignment operator needed by the coding conventions but not used - Fatal("AliHBTLLWeights","assignment operator not implemented"); - return * this; - } - static AliHBTLLWeights* Instance(); - - void Init(); //put the initial values in fortran commons fsiini, led_bldata - Double_t GetWeight(const AliHBTPair* partpair); //get weight calculated by Lednicky's algorithm + { + public: + virtual ~AliHBTLLWeights(){;} + static AliHBTLLWeights* Instance(); + + Double_t GetWeight(const AliHBTPair* partpair); //get weight calculated by Lednicky's algorithm + + void Init(); //put the initial values in fortran commons fsiini, led_bldata + void SetTest(Bool_t rtest = kTRUE);//Sets fTest member - void SetTest(Bool_t rtest = kTRUE){ftest = rtest;} //if ftest=0: - //physical values of the following parameters are put automatically - // in FSIINI (their values are not required) - // ftest=1: any values of the following parameters are allowed, - //the following parameters are required: + void SetColoumb(Bool_t col = kTRUE);//: (ICH in fortran code) Coulomb interaction between the two particles ON (OFF) + void SetQuantumStatistics(Bool_t qss = kTRUE);//IQS: quantum statistics for the two particles ON (OFF) //if non-identical particles automatically off + void SetStrongInterSwitch(Bool_t sis = kTRUE);//ISI: strong interaction between the two particles ON (OFF) + void SetColWithResidNuclSwitch(Bool_t crn = kTRUE);//I3C: Coulomb interaction with residual nucleus ON (OFF) + void SetApproxModel(Int_t ap);//sets Model of Approximation (NS in Fortran code) + void SetRandomPosition(Bool_t rp = kTRUE); //ON=kTRUE(OFF=kFALSE) + void SetR1dw(Double_t R); //spherical source model radii + void SetParticlesTypes(Int_t pid1, Int_t pid2); //set AliRoot particles types + void SetNucleusCharge(Double_t ch); // not used now (see comments in fortran code) + void SetNucleusMass(Double_t mass); // (see comments in fortran code) - void SetColoumb(Bool_t col = kTRUE){ - //(ICH in fortran code) Coulomb interaction between - //the two particles ON (OFF) - fColoumbSwitch = col; - } - void SetQuantumStatistics(Bool_t qss = kTRUE){ - //IQS: quantum statistics for the two particles ON (OFF) - //if non-identical particles automatically off - fQuantStatSwitch = qss; - } - void SetStrongInterSwitch(Bool_t sis = kTRUE){ - //ISI: strong interaction between the two particles ON (OFF) - fStrongInterSwitch = sis; - } - void SetColWithResidNuclSwitch(Bool_t crn = kTRUE){ - //I3C: Coulomb interaction with residual nucleus ON (OFF) - fColWithResidNuclSwitch = crn; - } - void SetApproxModel(Int_t ap){ - //NS in Fortran code, - fApproximationModel=ap; - } - // NS=1 Square well potential, - // NS=3 not used - // NS=4 scattered wave approximated by the spherical wave, - // NS=2 same as NS=4 but the approx. of equal emission times in PRF - // not required (t=0 approx. used in all other cases). + protected: + + Bool_t fTest; //flag indicating if parameters listed below are to be calculated automatically (0) + //or + Bool_t fColoumbSwitch; + Bool_t fQuantStatSwitch; + Bool_t fStrongInterSwitch;//Switches strong interactions TRUE=ON + Bool_t fColWithResidNuclSwitch;//Switches couloumb interaction + //with residual nucleus TRUE=ON + Double_t fNuclMass; //mass of nucleus + Double_t fNuclCharge; //charge of nucleus + + Bool_t fRandomPosition;//flag indicating if positions of particles shuold be randomized according to parameters below + Double_t fRadius; //radius used for randomizing particle vertex position - void SetRandomPosition(Bool_t rp = kTRUE){ - //ON=kTRUE(OFF=kFALSE) - fRandomPosition = rp; - } - // ON -- calculation of the Gauss source radii if the generator - // don't allows the source generation (for example MeVSim) - //if ON the following parameters are requested: - void SetR1dw(Double_t R){fRadius=R;} //spherical source model radii - void SetLambdaw(Double_t la){flambda=la;} //lambda=haoticity - void SetParticlesTypes(Int_t pid1, Int_t pid2){ - //set AliRoot particles types - fPID1 = pid1; fPID2 = pid2; - } - - void SetNucleusCharge(Double_t ch){ - // not used now (see comments in fortran code) - fNuclCharge=ch; - } - void SetNucleusMass(Double_t mass){ - // (see comments in fortran code) - fNuclMass=mass; - } - - - protected: - - Bool_t ftest; // Switch for automatic setting of all parameters - Bool_t fColoumbSwitch; // Swith for Couloumb interaction in the pair - Bool_t fQuantStatSwitch; //Switch for quantum statistics - Bool_t fStrongInterSwitch;//Switches strong interactions TRUE=ON - Bool_t fColWithResidNuclSwitch;//Switches couloumb interaction - //with residual nucleus TRUE=ON - Double_t fNuclMass; //mass - Double_t fNuclCharge; //charge - - Bool_t fRandomPosition; // Radius of Gaussian source - Double_t fRadius; // Raduis of spheric source - Double_t flambda; // Chaoticity - - - // Double_t fWein; - - Int_t fApproximationModel; //approximation used to calculate - // Bethe-Salpeter amplitude - // ==1 Square well potential, - // ==3 not used - // ==4 scattered wave approximated by the spherical wave, - // ==2 same as NS=4 but the approx. of equal emission times in PRF - // not required (t=0 approx. used in all other cases). - // Note: if ==2,4, the B-S amplitude diverges at zero distance r* in - // the two-particle c.m.s.; user can specify a cutoff AA in - // SUBROUTINE FSIINI, for example: - // IF(NS.EQ.2.OR.NS.EQ.4)AA=5.D0 !! in 1/GeV --> AA=1. fm - - Int_t fPID1; // Type of the first particle - Int_t fPID2; // Type of the second particle - - static AliHBTLLWeights *fgLLWeights;// pointer to wrapper of Fortran Lednicky code - - - static Int_t GetPairCode(Int_t pid1,Int_t pid2); - static Int_t GetPairCode(const AliHBTPair* partpair);//calculate automatically internal FSIW - //---------------------------------------------------------------------- - // LL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - // part. 1: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K- - // part. 2: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p - // NS=1 y/n: + + + + + - - - - - - - - - - - - - //---------------------------------------------------------------------- - // LL 18 19 20 21 22 23 24 25 26 27 28 - // part. 1: d d t t K0 K0 d p p p n - // part. 2: d alfa t alfa K0 K0b t t alfa lambda lambda - // NS=1 y/n: - - - - - - - - - + + - //---------------------------------------------------------------------- - - Double_t fsigma; //constants for spherical source model - Double_t fwcons; //weight of final state interaction? - - private: - AliHBTLLWeights(); - - ClassDef(AliHBTLLWeights,1) + Int_t fApproximationModel; //approximation used to calculate Bethe-Salpeter amplitude see SetApproxModel for more comments + + Int_t fPID1; + Int_t fPID2; + Double_t fSigma; //constants for spherical source model in cm + static const Double_t fgkWcons; //constant for fm->GeV conversion 1/0.1973 + + static AliHBTLLWeights *fgLLWeights;// pointer to wrapper of Fortran Lednicky code + + static Int_t GetPairCode(Int_t pid1,Int_t pid2); + static Int_t GetPairCode(const AliHBTPair* partpair);//calculate automatically internal code + + private: + AliHBTLLWeights(); + ClassDef(AliHBTLLWeights,1) }; #endif diff --git a/HBTAN/AliHBTMonDistributionFctns.cxx b/HBTAN/AliHBTMonDistributionFctns.cxx index 4f4705f4f3e..1e5fe5de4dc 100644 --- a/HBTAN/AliHBTMonDistributionFctns.cxx +++ b/HBTAN/AliHBTMonDistributionFctns.cxx @@ -6,9 +6,8 @@ ClassImp(AliHBTMonPxDistributionFctn) -AliHBTMonPxDistributionFctn:: -AliHBTMonPxDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonPxDistributionFctn::AliHBTMonPxDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("Px","Px"); } @@ -28,9 +27,8 @@ AliHBTMonPyDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): ClassImp(AliHBTMonPzDistributionFctn) -AliHBTMonPzDistributionFctn:: -AliHBTMonPzDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonPzDistributionFctn::AliHBTMonPzDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("Pz","Pz"); } @@ -39,9 +37,9 @@ AliHBTMonPzDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): ClassImp(AliHBTMonPDistributionFctn) -AliHBTMonPDistributionFctn:: -AliHBTMonPDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonPDistributionFctn::AliHBTMonPDistributionFctn + (Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("P","P"); } @@ -51,9 +49,9 @@ AliHBTMonPDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): ClassImp(AliHBTMonPtDistributionFctn) -AliHBTMonPtDistributionFctn:: -AliHBTMonPtDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonPtDistributionFctn::AliHBTMonPtDistributionFctn + (Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("Pt","Pt"); } @@ -63,40 +61,40 @@ AliHBTMonPtDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): /******************************************************************/ ClassImp( AliHBTMonPxDistributionVsPtFctn ) -AliHBTMonPxDistributionVsPtFctn:: -AliHBTMonPxDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonPxDistributionVsPtFctn::AliHBTMonPxDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("PxDistVsPt","Px vs. Pt"); } /******************************************************************/ ClassImp( AliHBTMonPyDistributionVsPtFctn ) -AliHBTMonPyDistributionVsPtFctn:: -AliHBTMonPyDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonPyDistributionVsPtFctn::AliHBTMonPyDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("PyDistVsPt","Py vs. Pt"); } /******************************************************************/ ClassImp( AliHBTMonPzDistributionVsPtFctn ) -AliHBTMonPzDistributionVsPtFctn:: -AliHBTMonPzDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonPzDistributionVsPtFctn::AliHBTMonPzDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("PzDistVsPt","Pz vs. Pt"); } /******************************************************************/ ClassImp( AliHBTMonPDistributionVsPtFctn ) -AliHBTMonPDistributionVsPtFctn:: -AliHBTMonPDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonPDistributionVsPtFctn::AliHBTMonPDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("PDistVsPt","P vs. Pt"); } @@ -106,41 +104,99 @@ AliHBTMonPDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, /******************************************************************/ ClassImp(AliHBTMonPhiDistributionFctn) -AliHBTMonPhiDistributionFctn:: -AliHBTMonPhiDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonPhiDistributionFctn::AliHBTMonPhiDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("Phi","Phi"); } /******************************************************************/ ClassImp(AliHBTMonThetaDistributionFctn) -AliHBTMonThetaDistributionFctn:: -AliHBTMonThetaDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): - AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +AliHBTMonThetaDistributionFctn::AliHBTMonThetaDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) { Rename("Theta","Theta"); } /******************************************************************/ ClassImp( AliHBTMonPhiDistributionVsPtFctn ) -AliHBTMonPhiDistributionVsPtFctn:: -AliHBTMonPhiDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonPhiDistributionVsPtFctn::AliHBTMonPhiDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("PhiDistVsPt","Phi vs. Pt"); } /******************************************************************/ ClassImp( AliHBTMonThetaDistributionVsPtFctn ) -AliHBTMonThetaDistributionVsPtFctn:: -AliHBTMonThetaDistributionVsPtFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, - Int_t nYbins, Double_t maxYval, Double_t minYval): - AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +AliHBTMonThetaDistributionVsPtFctn::AliHBTMonThetaDistributionVsPtFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) { Rename("ThetaDistVsPt","Theta vs. Pt"); } +/******************************************************************/ + +ClassImp(AliHBTMonVxDistributionFctn) + +AliHBTMonVxDistributionFctn:: +AliHBTMonVxDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +{ + Rename("Vx","X of Vertex"); +} +/******************************************************************/ + +ClassImp(AliHBTMonVyDistributionFctn) + +AliHBTMonVyDistributionFctn:: +AliHBTMonVyDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +{ + Rename("Vy","Y of Vertex"); +} +/******************************************************************/ + +ClassImp(AliHBTMonVzDistributionFctn) + +AliHBTMonVzDistributionFctn:: +AliHBTMonVzDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +{ + Rename("Vz","Z of Vertex"); +} +/******************************************************************/ +ClassImp(AliHBTMonRDistributionFctn) + +AliHBTMonRDistributionFctn:: +AliHBTMonRDistributionFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonOneParticleFctn1D(nbins,maxXval,minXval) +{ + Rename("VertexDistanceFromCenter","Distance of Particle Vertex From Center"); +} +/******************************************************************/ + +ClassImp(AliHBTMonVyDistributionVsVxFctn) +AliHBTMonVyDistributionVsVxFctn::AliHBTMonVyDistributionVsVxFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +{ + Rename("VyDistVsVx","Vrtex Y position versus X vertex position"); +} +/******************************************************************/ + +ClassImp(AliHBTMonRtDistributionVsVzFctn) +AliHBTMonRtDistributionVsVzFctn::AliHBTMonRtDistributionVsVzFctn + (Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval): + AliHBTMonOneParticleFctn2D(nXbins,maxXval,minXval,nYbins,maxYval,minYval) +{ + Rename("RDistVsVz","Distance of vertex position from center in trensverse plane versus Z vertex position"); +} + /******************************************************************/ /******************************************************************/ diff --git a/HBTAN/AliHBTMonDistributionFctns.h b/HBTAN/AliHBTMonDistributionFctns.h index 593e9f4c77d..00bd7da5153 100644 --- a/HBTAN/AliHBTMonDistributionFctns.h +++ b/HBTAN/AliHBTMonDistributionFctns.h @@ -14,6 +14,14 @@ class AliHBTMonPDistributionFctn; class AliHBTMonPDistributionVsPtFctn; class AliHBTMonPtDistributionFctn; +class AliHBTMonVxDistributionFctn; +class AliHBTMonVyDistributionFctn; +class AliHBTMonVzDistributionFctn; +class AliHBTMonRDistributionFctn; + +class AliHBTMonVyDistributionVsVxFctn; +class AliHBTMonRtDistributionVsVzFctn; + #include "AliHBTMonitorFunction.h" /***********************************************************************/ /***********************************************************************/ @@ -221,7 +229,7 @@ class AliHBTMonPhiDistributionVsPtFctn: public AliHBTMonOneParticleFctn2D /***********************************************************************/ class AliHBTMonThetaDistributionVsPtFctn: public AliHBTMonOneParticleFctn2D - { +{ public: AliHBTMonThetaDistributionVsPtFctn(Int_t nXbins = 200, Double_t maxXval = 1.4, Double_t minXval = -0.1, Int_t nYbins = 200, Double_t maxYval = 3.14, Double_t minYval =0.0); @@ -233,14 +241,94 @@ class AliHBTMonThetaDistributionVsPtFctn: public AliHBTMonOneParticleFctn2D y = partparticle->Theta(); } TH1* GetResult(){return fResult;} - protected: - private: - public: + protected: + private: ClassDef(AliHBTMonThetaDistributionVsPtFctn,1) }; /***********************************************************************/ +class AliHBTMonVxDistributionFctn: public AliHBTMonOneParticleFctn1D +{ + public: + AliHBTMonVxDistributionFctn(Int_t nbins = 200, Double_t maxXval = 500, Double_t minXval = -500); + virtual ~AliHBTMonVxDistributionFctn(){}; + TH1* GetResult(){return fResult;} + protected: + Double_t GetValue(AliHBTParticle * particle) { return particle->Vx();} + ClassDef(AliHBTMonVxDistributionFctn,1) +}; /***********************************************************************/ +class AliHBTMonVyDistributionFctn: public AliHBTMonOneParticleFctn1D +{ + public: + AliHBTMonVyDistributionFctn(Int_t nbins = 200, Double_t maxXval = 500, Double_t minXval = -500); + virtual ~AliHBTMonVyDistributionFctn(){}; + TH1* GetResult(){return fResult;} + protected: + Double_t GetValue(AliHBTParticle * particle) { return particle->Vy();} + ClassDef(AliHBTMonVyDistributionFctn,1) +}; +/***********************************************************************/ +class AliHBTMonVzDistributionFctn: public AliHBTMonOneParticleFctn1D +{ + public: + AliHBTMonVzDistributionFctn(Int_t nbins = 200, Double_t maxXval = 300, Double_t minXval = -300); + virtual ~AliHBTMonVzDistributionFctn(){}; + TH1* GetResult(){return fResult;} + protected: + Double_t GetValue(AliHBTParticle * particle) { return particle->Vz();} + ClassDef(AliHBTMonVzDistributionFctn,1) +}; +/***********************************************************************/ +class AliHBTMonRDistributionFctn: public AliHBTMonOneParticleFctn1D +{ + public: + AliHBTMonRDistributionFctn(Int_t nbins = 200, Double_t maxXval = 500, Double_t minXval = -500); + virtual ~AliHBTMonRDistributionFctn(){}; + TH1* GetResult(){return fResult;} + protected: + Double_t GetValue(AliHBTParticle * p) { return TMath::Sqrt(p->Vx()*p->Vx() + p->Vy()*p->Vy() + p->Vz()*p->Vz());} + ClassDef(AliHBTMonRDistributionFctn,1) +}; + +/***********************************************************************/ +class AliHBTMonVyDistributionVsVxFctn: public AliHBTMonOneParticleFctn2D +{ + public: + AliHBTMonVyDistributionVsVxFctn(Int_t nXbins = 200, Double_t maxXval = 10.0, Double_t minXval = -10.0, + Int_t nYbins = 200, Double_t maxYval = 10.0, Double_t minYval =-10.0); + virtual ~AliHBTMonVyDistributionVsVxFctn(){} + + void GetValues(AliHBTParticle* partparticle, Double_t& x, Double_t& y) + { + x = partparticle->Vx(); + y = partparticle->Vy(); + } + TH1* GetResult(){return fResult;} + protected: + private: + ClassDef(AliHBTMonVyDistributionVsVxFctn,1) + }; + + +class AliHBTMonRtDistributionVsVzFctn: public AliHBTMonOneParticleFctn2D +{ + public: + AliHBTMonRtDistributionVsVzFctn(Int_t nXbins = 200, Double_t maxXval = 10.0, Double_t minXval = -10.0, + Int_t nYbins = 100, Double_t maxYval = 10.0, Double_t minYval = 0.0); + virtual ~AliHBTMonRtDistributionVsVzFctn(){} + + void GetValues(AliHBTParticle* partparticle, Double_t& x, Double_t& y) + { + x = partparticle->Vz(); + y = TMath::Hypot(partparticle->Vx(),partparticle->Vy()); + } + TH1* GetResult(){return fResult;} + protected: + private: + ClassDef(AliHBTMonRtDistributionVsVzFctn,1) + }; + /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ diff --git a/HBTAN/AliHBTPairCut.cxx b/HBTAN/AliHBTPairCut.cxx index 4994148eb36..319358f4b76 100644 --- a/HBTAN/AliHBTPairCut.cxx +++ b/HBTAN/AliHBTPairCut.cxx @@ -246,22 +246,21 @@ void AliHBTPairCut::Streamer(TBuffer &b) { Version_t v = b.ReadVersion(&R__s, &R__c); if (v > -1) - { - delete fFirstPartCut; - delete fSecondPartCut; - fFirstPartCut = 0x0; - fSecondPartCut = 0x0; - TObject::Streamer(b); - b >> fFirstPartCut; - b >> fSecondPartCut; - b >> fNCuts; - for (Int_t i = 0;i> fCuts[i]; - } + { + delete fFirstPartCut; + delete fSecondPartCut; + fFirstPartCut = 0x0; + fSecondPartCut = 0x0; + TObject::Streamer(b); + b >> fFirstPartCut; + b >> fSecondPartCut; + b >> fNCuts; + for (Int_t i = 0;i> fCuts[i]; + } } b.CheckByteCount(R__s, R__c,AliHBTPairCut::IsA()); - } else { @@ -271,9 +270,9 @@ void AliHBTPairCut::Streamer(TBuffer &b) b << fSecondPartCut; b << fNCuts; for (Int_t i = 0;i +#include "AliHBTRun.h" +#include "AliHBTEvent.h" +#include "AliHBTParticle.h" + + +ClassImp(AliHBTPositionRandomizer) + +/*********************************************************************/ + +AliHBTPositionRandomizer::AliHBTPositionRandomizer(): + fReader(0x0), + fRandomizer(0x0), + fModel(0), + fAddToExistingPos(kFALSE), + fOnlyParticlesFromVertex(kFALSE), + fVX(0.0), + fVY(0.0), + fVZ(0.0) +{ +//constructor +} +/*********************************************************************/ + +AliHBTPositionRandomizer::AliHBTPositionRandomizer(AliHBTReader* reader): + fReader(reader), + fRandomizer(new AliHBTRndmGaussBall(8.0)), + fModel(0), + fAddToExistingPos(kFALSE), + fOnlyParticlesFromVertex(kFALSE), + fVX(0.0), + fVY(0.0), + fVZ(0.0) +{ +//constructor +} +/*********************************************************************/ + +Int_t AliHBTPositionRandomizer::Read(AliHBTRun* particles, AliHBTRun *tracks) +{ + if (fReader == 0x0) return 1; + Info("Randomize(AliHBTRun*)",""); + Int_t err = fReader->Read(particles,tracks); + if (err) return err; + Randomize(particles); + return 0; +} +/*********************************************************************/ + +AliHBTEvent* AliHBTPositionRandomizer::GetParticleEvent(Int_t n) +{ +//returns event n + if (fReader == 0x0) return 0x0; + AliHBTEvent *e = fReader->GetParticleEvent(n); + if (e->IsRandomized() == kFALSE) Randomize(e); + return e; +} + +/*********************************************************************/ + +void AliHBTPositionRandomizer::Randomize(AliHBTRun* run) +{ +// randomizes postions of all particles in the run + if (run == 0x0) return; + Info("Randomize(AliHBTRun*)",""); + for (Int_t i = 0; i < run->GetNumberOfEvents(); i++) + { + Randomize(run->GetEvent(i)); + } +} +/*********************************************************************/ +void AliHBTPositionRandomizer::Randomize(AliHBTEvent* event) +{ +// randomizes postions of all particles in the event + static const Double_t fmtocm = 1.e-13; + Info("Randomize(AliHBTEvent*)",""); + if (event == 0x0) return; + + for (Int_t i = 0; i < event->GetNumberOfParticles(); i++) + { + AliHBTParticle* p = event->GetParticle(i); + Double_t x,y,z,t=0.0; + fRandomizer->Randomize(x,y,z,p); + p->SetProductionVertex(x*fmtocm,y*fmtocm,z*fmtocm,t*fmtocm); + } + event->SetRandomized(); +} +/*********************************************************************/ + +void AliHBTPositionRandomizer::SetGaussianBall(Double_t r) +{ + SetGaussianBall(r,r,r); +} +/*********************************************************************/ + +void AliHBTPositionRandomizer::SetGaussianBall(Double_t rx, Double_t ry, Double_t rz) +{ + delete fRandomizer; + fRandomizer = new AliHBTRndmGaussBall(rx,ry,rz); +} +/*********************************************************************/ + +void AliHBTPositionRandomizer::SetCyllinderSurface(Double_t r, Double_t l) +{ + delete fRandomizer; + fRandomizer = new AliHBTRndmCyllSurf(r,l); +} +/*********************************************************************/ + +void AliHBTPositionRandomizer::SetEventVertex(Double_t x, Double_t y,Double_t z) +{ +//sets event vertex position + fVX = x; + fVY = y; + fVZ = z; +} +/*********************************************************************/ +//_____________________________________________________________________ +/////////////////////////////////////////////////////////////////////// +// // +// class AliHBTRndmGaussBall // +// // +/////////////////////////////////////////////////////////////////////// + +AliHBTRndmGaussBall::AliHBTRndmGaussBall(): + fRx(0.0), + fRy(0.0), + fRz(0.0) +{ + //constructor +} +/*********************************************************************/ + +AliHBTRndmGaussBall::AliHBTRndmGaussBall(Float_t r): + fRx(r), + fRy(r), + fRz(r) +{ + //constructor +} +/*********************************************************************/ + +AliHBTRndmGaussBall::AliHBTRndmGaussBall(Float_t rx, Float_t ry, Float_t rz): + fRx(rx), + fRy(ry), + fRz(rz) +{ + //constructor +} +/*********************************************************************/ + +void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p) +{ +//randomizez gauss for each coordinate separately + x = gRandom->Gaus(0.0,fRx); + y = gRandom->Gaus(0.0,fRy); + z = gRandom->Gaus(0.0,fRz); +} +/*********************************************************************/ +//_____________________________________________________________________ +/////////////////////////////////////////////////////////////////////// +// // +// class AliHBTRndmGaussBall // +// // +/////////////////////////////////////////////////////////////////////// + +void AliHBTRndmCyllSurf::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p) +{ + Double_t sf = fR/p->Pt();//scaling factor for position transformation -> + //we move direction of string momentum but legth defined by r + x = sf*p->Px(); + y = sf*p->Py(); + z = gRandom->Uniform(-fL,fL); + +} diff --git a/HBTAN/AliHBTPositionRandomizer.h b/HBTAN/AliHBTPositionRandomizer.h new file mode 100644 index 00000000000..accb4df6fa7 --- /dev/null +++ b/HBTAN/AliHBTPositionRandomizer.h @@ -0,0 +1,91 @@ +#ifndef ALIHBTPOSITIONRANDOMIZER_H +#define ALIHBTPOSITIONRANDOMIZER_H + +#include "AliHBTReader.h" + +class AliHBTRndm; +class AliHBTEvent; +class AliHBTRun; +class AliHBTParticle; + +class AliHBTPositionRandomizer: public AliHBTReader +{ + public: + enum EModelTypes{kGausBall,kCylinder,kCylinderSurf}; + AliHBTPositionRandomizer(); + AliHBTPositionRandomizer(AliHBTReader* reader); + + Int_t Read(AliHBTRun* particles, AliHBTRun *tracks); + + AliHBTEvent* GetParticleEvent(Int_t n); + AliHBTEvent* GetTrackEvent(Int_t n){return (fReader)?fReader->GetTrackEvent(n):0x0;} + Int_t GetNumberOfPartEvents(){return (fReader)?fReader->GetNumberOfPartEvents():0;} + Int_t GetNumberOfTrackEvents(){return (fReader)?fReader->GetNumberOfTrackEvents():0;} + + void Randomize(AliHBTEvent* event); + void Randomize(AliHBTRun* run); + void SetEventVertex(Double_t x, Double_t y,Double_t z); + + void SetGaussianBall(Double_t r); + void SetGaussianBall(Double_t rx, Double_t ry, Double_t rz); + void SetCyllinderSurface(Double_t r, Double_t l); + + protected: + void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p); + private: + AliHBTReader* fReader; + AliHBTRndm* fRandomizer; + + Int_t fModel; + + Bool_t fAddToExistingPos; + Bool_t fOnlyParticlesFromVertex; + + Double_t fVX; //vertex position + Double_t fVY; //vertex position + Double_t fVZ; //vertex position + + ClassDef(AliHBTPositionRandomizer,1) +}; + +class AliHBTRndm: public TObject +{ + public: + AliHBTRndm(){} + ~AliHBTRndm(){} + virtual void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p) = 0; + ClassDef(AliHBTRndm,1) +}; + +class AliHBTRndmGaussBall: public AliHBTRndm +{ + public: + AliHBTRndmGaussBall(); + AliHBTRndmGaussBall(Float_t r); + AliHBTRndmGaussBall(Float_t rx, Float_t ry, Float_t rz); + ~AliHBTRndmGaussBall(){} + void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p); + private: + Float_t fRx; + Float_t fRy; + Float_t fRz; + ClassDef(AliHBTRndmGaussBall,1) +}; + +class AliHBTRndmCyllSurf: public AliHBTRndm +{ + public: + AliHBTRndmCyllSurf():fR(0.0){} + AliHBTRndmCyllSurf(Float_t r, Float_t l):fR(r),fL(l){} + ~AliHBTRndmCyllSurf(){} + + void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p); + private: + Float_t fR; + Float_t fL; + + ClassDef(AliHBTRndmCyllSurf,1) +}; + +#endif + diff --git a/HBTAN/AliHBTReader.cxx b/HBTAN/AliHBTReader.cxx index fca4c9a113d..dc0435c2975 100644 --- a/HBTAN/AliHBTReader.cxx +++ b/HBTAN/AliHBTReader.cxx @@ -8,7 +8,7 @@ #include "AliHBTParticleCut.h" - + ClassImp(AliHBTReader) //pure virtual @@ -56,7 +56,7 @@ void AliHBTReader::AddParticleCut(AliHBTParticleCut* cut) /*************************************************************************************/ Bool_t AliHBTReader::Pass(AliHBTParticle* p) - { +{ //Method examines whether particle meets all cut and particle type criteria if(p==0x0)//of corse we not pass NULL pointers @@ -74,8 +74,7 @@ Bool_t AliHBTReader::Pass(AliHBTParticle* p) } return kTRUE;//not accepted - - } +} /*************************************************************************************/ Bool_t AliHBTReader::Pass(Int_t pid) diff --git a/HBTAN/AliHBTReader.h b/HBTAN/AliHBTReader.h index 2a2e530c798..f2d5d7d39b2 100644 --- a/HBTAN/AliHBTReader.h +++ b/HBTAN/AliHBTReader.h @@ -13,7 +13,7 @@ class AliHBTParticleCut; class TObjArray; class AliHBTParticle; class TString; - + class AliHBTReader: public TNamed { public: @@ -32,6 +32,9 @@ class AliHBTReader: public TNamed void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names + virtual AliHBTEvent* GetNextParticleEvent(){return 0x0;} + virtual AliHBTEvent* GetNextTrackEvent(){return 0x0;} + protected: TObjArray *fCuts;//array with particle cuts diff --git a/HBTAN/AliHBTReaderITSv1.cxx b/HBTAN/AliHBTReaderITSv1.cxx index abc6cb1e61d..8e96eec46a4 100644 --- a/HBTAN/AliHBTReaderITSv1.cxx +++ b/HBTAN/AliHBTReaderITSv1.cxx @@ -211,7 +211,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks) Double_t y= iotrack->GetY(); Double_t z= iotrack->GetZ(); - AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(),i , px, py , pz, tEtot, x, y, z, 0.); + AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), i, px, py , pz, tEtot, x, y, z, 0.); if(Pass(track)) { delete track;continue;}//check if meets all criteria of any of our cuts //if it does not delete it and take next good track diff --git a/HBTAN/AliHBTReaderITSv2.cxx b/HBTAN/AliHBTReaderITSv2.cxx index 646e977646d..dd56bda19c2 100644 --- a/HBTAN/AliHBTReaderITSv2.cxx +++ b/HBTAN/AliHBTReaderITSv2.cxx @@ -1,5 +1,7 @@ + #include "AliHBTReaderITSv2.h" +#include #include #include #include @@ -8,7 +10,10 @@ #include #include +#include +#include #include +#include #include #include #include @@ -21,17 +26,21 @@ ClassImp(AliHBTReaderITSv2) -AliHBTReaderITSv2::AliHBTReaderITSv2(const Char_t* trackfilename, - const Char_t* clusterfilename, - const Char_t* galicefilename): - fTrackFileName(trackfilename), - fClusterFileName(clusterfilename), - fGAliceFileName(galicefilename) +AliHBTReaderITSv2::AliHBTReaderITSv2():fFileName("galice.root") +{ + //constructor, + //Defaults: + // galicefilename = "galice.root" + fParticles = 0x0; + fTracks = 0x0; + fIsRead = kFALSE; +} +/********************************************************************/ + +AliHBTReaderITSv2::AliHBTReaderITSv2(const Char_t* galicefilename):fFileName(galicefilename) { //constructor, //Defaults: - // trackfilename = "AliITStracksV2.root" - // clusterfilename = "AliITSclustersV2.root" // galicefilename = "galice.root" fParticles = new AliHBTRun(); fTracks = new AliHBTRun(); @@ -39,19 +48,11 @@ AliHBTReaderITSv2::AliHBTReaderITSv2(const Char_t* trackfilename, } /********************************************************************/ -AliHBTReaderITSv2::AliHBTReaderITSv2(TObjArray* dirs, - const Char_t* trackfilename, - const Char_t* clusterfilename, - const Char_t* galicefilename): - AliHBTReader(dirs), - fTrackFileName(trackfilename), - fClusterFileName(clusterfilename), - fGAliceFileName(galicefilename) +AliHBTReaderITSv2::AliHBTReaderITSv2(TObjArray* dirs, const Char_t* galicefilename): + AliHBTReader(dirs), fFileName(galicefilename) { //constructor, //Defaults: - // trackfilename = "AliITStracksV2.root" - // clusterfilename = "AliITSclustersV2.root" // galicefilename = "galice.root" fParticles = new AliHBTRun(); @@ -71,40 +72,51 @@ AliHBTReaderITSv2::~AliHBTReaderITSv2() AliHBTEvent* AliHBTReaderITSv2::GetParticleEvent(Int_t n) { //returns Nth event with simulated particles - if (!fIsRead) + if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); if(Read(fParticles,fTracks)) { Error("GetParticleEvent","Error in reading"); return 0x0; } - - return fParticles->GetEvent(n); - } + } + return (fParticles)?fParticles->GetEvent(n):0x0; +} /********************************************************************/ AliHBTEvent* AliHBTReaderITSv2::GetTrackEvent(Int_t n) { //returns Nth event with reconstructed tracks - if (!fIsRead) + if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); if(Read(fParticles,fTracks)) { Error("GetTrackEvent","Error in reading"); return 0x0; } - return fTracks->GetEvent(n); + } + return (fTracks)?fTracks->GetEvent(n):0x0; } /********************************************************************/ Int_t AliHBTReaderITSv2::GetNumberOfPartEvents() { //returns number of events of particles - if (!fIsRead) + if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); if(Read(fParticles,fTracks)) { Error("GetNumberOfPartEvents","Error in reading"); return 0; } - return fParticles->GetNumberOfEvents(); + } + return (fParticles)?fParticles->GetNumberOfEvents():0; } /********************************************************************/ @@ -112,30 +124,31 @@ Int_t AliHBTReaderITSv2::GetNumberOfTrackEvents() { //returns number of events of tracks if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); if(Read(fParticles,fTracks)) { Error("GetNumberOfTrackEvents","Error in reading"); return 0; } - return fTracks->GetNumberOfEvents(); + } + return (fTracks)?fTracks->GetNumberOfEvents():0; } - - /********************************************************************/ /********************************************************************/ + + Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) { +//reads data Int_t Nevents = 0; //number of events found in given directory Int_t Ndirs; //number of the directories to be read Int_t Ntracks; //number of tracks in current event Int_t currentdir = 0; //number of events in the current directory Int_t totalNevents = 0; //total number of events read from all directories up to now - register Int_t i; //iterator + register Int_t i = 0; //iterator - TFile *aTracksFile;//file with tracks - TFile *aClustersFile;//file with clusters - TFile *aGAliceFile;//file name with galice - // AliITStrackerV2 *tracker; // ITS tracker - used for cooking labels TTree *tracktree; // tree for tracks @@ -144,8 +157,7 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) Float_t phi, lam, pt;//angles and transverse momentum Int_t label; //label of the current track - char tname[100]; //buffer for tree name - AliITStrackV2 *iotrack= 0x0; //buffer track for reading data from tree + AliITStrackV2 *iotrack = 0x0; //buffer track for reading data from tree if (!particles) //check if an object is instatiated { @@ -171,16 +183,42 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) do //do while is good even if Ndirs==0 (than read from current directory) { - if( (i=OpenFiles(aTracksFile,aClustersFile,aGAliceFile,currentdir)) ) + TString filename = GetDirName(currentdir); + if (filename.IsNull()) { - Error("Read","Exiting due to problems with opening files. Errorcode %d",i); + Error("Read","Can not get directory name"); currentdir++; continue; } + filename = filename +"/"+ fFileName; + AliRunLoader* rl = AliRunLoader::Open(filename); + if( rl == 0x0) + { + Error("Read","Exiting due to problems with opening files."); + currentdir++; + continue; + } + + rl->LoadHeader(); + rl->LoadKinematics(); + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + AliITS* its = (AliITS*)gAlice->GetModule("ITS"); + + AliLoader* itsl = rl->GetLoader("ITSLoader"); - if (gAlice->TreeE())//check if tree E exists + if ((its == 0x0) || ( itsl== 0x0)) + { + Error("Read","Can not found ITS in this run"); + delete rl; + rl = 0x0; + currentdir++; + continue; + } + Nevents = rl->GetNumberOfEvents(); + + if (Nevents > 0)//check if tree E exists { - Nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice Info("Read","________________________________________________________"); Info("Read","Found %d event(s) in directory %s",Nevents,GetDirName(currentdir).Data()); Float_t mf; @@ -199,37 +237,37 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) } else {//if not return an error - Error("Read","Can not find Header tree (TreeE) in gAlice"); + Error("Read","No events in this run"); + delete rl; + rl = 0x0; currentdir++; continue; } - AliITSgeom *geom=(AliITSgeom*)aClustersFile->Get("AliITSgeom"); + AliITSgeom *geom= its->GetITSgeom(); if (!geom) { Error("Read","Can't get the ITS geometry!"); + delete rl; + rl = 0x0; currentdir++; continue; } + itsl->LoadTracks(); + for(Int_t currentEvent =0; currentEventGetEvent(currentEvent); + tracktree=itsl->TreeT(); - aGAliceFile->cd(); - gAlice->GetEvent(currentEvent); - - aClustersFile->cd(); - sprintf(tname,"TreeT_ITS_%d",currentEvent); - - tracktree=(TTree*)aTracksFile->Get(tname); if (!tracktree) { Error("Read","Can't get a tree with ITS tracks"); continue; } TBranch *tbranch=tracktree->GetBranch("tracks"); - Ntracks=(Int_t)tracktree->GetEntries(); Int_t accepted = 0; @@ -260,7 +298,6 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts //if it does not delete it and take next good track - iotrack->PropagateTo(3.,0.0028,65.19); iotrack->PropagateToVertex(); @@ -290,16 +327,12 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks) tracks->AddParticle(totalNevents,track); accepted++; }//end of loop over tracks in the event - - aTracksFile->Delete(tname); - aTracksFile->Delete("tracks"); -// delete tracker; totalNevents++; cout<<"all: "<IsOpen()) - { - Error("OpenFiles","Can't open file with tacks named %s",filename.Data()); - return 1; - } - - filename = dirname +"/"+ fClusterFileName; - aClustersFile = TFile::Open(filename.Data()); - if ( aClustersFile == 0x0 ) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 2; - } - if (!aClustersFile->IsOpen()) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 2; - } - - filename = dirname +"/"+ fGAliceFileName; - agAliceFile = TFile::Open(filename.Data()); - if ( agAliceFile== 0x0) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 3; - } - if (!agAliceFile->IsOpen()) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 3; - } - - if (!(gAlice=(AliRun*)agAliceFile->Get("gAlice"))) - { - Error("OpenFiles","gAlice have not been found on %s !\n",filename.Data()); - return 5; - } - - return 0; -} -/********************************************************************/ - -/********************************************************************/ - -void AliHBTReaderITSv2::CloseFiles(TFile*& tracksFile, TFile*& clustersFile, TFile*& gAliceFile) -{ - //closes the files - tracksFile->Close(); - delete tracksFile; - tracksFile = 0x0; - - clustersFile->Close(); - delete clustersFile; - clustersFile = 0x0; - - delete gAlice; - gAlice = 0; - - if (gAliceFile) - { - gAliceFile->Close(); - delete gAliceFile; - gAliceFile = 0x0; - } -} - /********************************************************************/ diff --git a/HBTAN/AliHBTReaderITSv2.h b/HBTAN/AliHBTReaderITSv2.h index 7e308366204..75d6d5ea9f6 100644 --- a/HBTAN/AliHBTReaderITSv2.h +++ b/HBTAN/AliHBTReaderITSv2.h @@ -9,15 +9,12 @@ class TFile; class AliHBTReaderITSv2: public AliHBTReader { - public: - AliHBTReaderITSv2(const Char_t* trackfilename = "AliITStracksV2.root", - const Char_t* clusterfilename = "AliITSclustersV2.root", - const Char_t* galicefilename = "galice.root"); - - AliHBTReaderITSv2(TObjArray* dirs, - const Char_t* trackfilename = "AliITStracksV2.root", - const Char_t* clusterfilename = "AliITSclustersV2.root", - const Char_t* galicefilename = "galice.root"); + public: + + AliHBTReaderITSv2(); + AliHBTReaderITSv2(const Char_t* galicefilename); + AliHBTReaderITSv2(TObjArray* dirs, const Char_t* galicefilename = "galice.root"); + virtual ~AliHBTReaderITSv2(); Int_t Read(AliHBTRun*, AliHBTRun*);//reads tracks and particles and puts them in runs @@ -31,23 +28,17 @@ class AliHBTReaderITSv2: public AliHBTReader void UseMagneticFieldFromRun(Bool_t flag = kTRUE){fUseMagFFromRun=flag;} protected: - - Int_t OpenFiles(TFile*&,TFile*&,TFile*&,Int_t);//opens files to be read for given event - void CloseFiles(TFile*&,TFile*&,TFile*&);//close files AliHBTRun* fParticles; //!simulated particles AliHBTRun* fTracks; //!reconstructed tracks (particles) - TString fTrackFileName;//name of the file with tracks - TString fClusterFileName;//name of the file with clusters - TString fGAliceFileName;//name of the file with galice.root + TString fFileName;//name of the file with galice.root Bool_t fIsRead;//!flag indicating if the data are already read Float_t fMagneticField;//magnetic field value that was enforced while reading Bool_t fUseMagFFromRun;//flag indicating if using field specified in gAlice (kTRUE) // or enforece other defined by fMagneticField - private: ClassDef(AliHBTReaderITSv2,1) }; diff --git a/HBTAN/AliHBTReaderKineTree.cxx b/HBTAN/AliHBTReaderKineTree.cxx index 28fd868cd62..24f844390a2 100644 --- a/HBTAN/AliHBTReaderKineTree.cxx +++ b/HBTAN/AliHBTReaderKineTree.cxx @@ -1,7 +1,6 @@ #include "AliHBTReaderKineTree.h" #include -//#include #include #include #include @@ -9,6 +8,7 @@ #include #include +#include #include #include @@ -19,9 +19,9 @@ ClassImp(AliHBTReaderKineTree) /**********************************************************/ +const TString AliHBTReaderKineTree::fgkEventFolderName("HBTReaderKineTree"); -AliHBTReaderKineTree:: -AliHBTReaderKineTree():fFileName("galice.root") +AliHBTReaderKineTree::AliHBTReaderKineTree():fFileName("galice.root") { fParticles = new AliHBTRun(); fIsRead = kFALSE; @@ -101,24 +101,22 @@ Read(AliHBTRun* particles, AliHBTRun *tracks) do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./" { cout<<"________________________________________________________\n"; - TFile* fileK = OpenFile(currentdir); - TTree* treeE = (TTree*)fileK->Get("TE"); - if(treeE) - { - Nevents = (Int_t)treeE->GetEntries(); - cout<<"Found "<Delete("TE"); - } - else + AliRunLoader * rl = OpenFile(currentdir); + + if (rl == 0x0) { - Error("Read","Cannot find Header Tree (TE)"); - Nevents = 0; + Error("Read","Cannot open session"); + return 2; } + rl->LoadHeader(); + rl->LoadKinematics("READ"); + Nevents = rl->GetNumberOfEvents(); for(Int_t currentEvent =0; currentEventGetEvent(currentEvent); + AliStack* stack = rl->Stack(); if (!stack) { Error("Read","Can not get stack for event %d",currentEvent); @@ -130,10 +128,10 @@ Read(AliHBTRun* particles, AliHBTRun *tracks) { TParticle * p = stack->Particle(i); - if (p->GetFirstMother() >= 0) continue; +// if (p->GetFirstMother() >= 0) continue; do not apply with pythia etc if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type - //if not take next partilce + //if not take next partilce AliHBTParticle* part = new AliHBTParticle(*p,i); if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts @@ -148,63 +146,16 @@ Read(AliHBTRun* particles, AliHBTRun *tracks) nnn++; } cout<<"Total read "<Close(); - delete fileK; - fileK = 0; - } - - currentdir++; + delete rl; + currentdir++; }while(currentdir < Ndirs);//end of loop over directories specified in fDirs Obj Array fIsRead = kTRUE; return 0; } -/**********************************************************/ -AliStack* AliHBTReaderKineTree::GetStack(Int_t n, TFile* file) -{ - AliHeader *header = new AliHeader(); - TTree* treeE = (TTree*)file->Get("TE"); - if(treeE) - { - treeE->SetBranchAddress("Header", &header); - if (!treeE->GetEntry(n)) - { - Error("GetEvent","Cannot find event:%dn",n); - delete header; - treeE->Delete("TE"); - return 0x0; - } - } - else - { - Error("GetStack","Cannot find Header Tree (TE)n"); - delete header; - return 0x0; - } - - AliStack* stack = header->Stack(); - if (stack) - { - if (!stack->GetEvent(n)) - { - delete header; - treeE->Delete("TE"); - return 0x0; - } - } - delete header; - treeE->Delete("TE"); - return stack; -} - -TFile* AliHBTReaderKineTree::OpenFile(Int_t n) +AliRunLoader* AliHBTReaderKineTree::OpenFile(Int_t n) { //opens file with kine tree @@ -215,16 +166,12 @@ TFile* AliHBTReaderKineTree::OpenFile(Int_t n) return 0x0; } TString filename = dirname +"/"+ fFileName; - TFile *ret = TFile::Open(filename.Data()); + + AliRunLoader *ret = AliRunLoader::Open(filename.Data(),fgkEventFolderName,"READ"); if ( ret == 0x0) { - Error("OpenFiles","Can't open file %s",filename.Data()); - return 0x0; - } - if (!ret->IsOpen()) - { - Error("OpenFiles","Can't open file %s",filename.Data()); + Error("OpenFiles","Can't open session from file %s",filename.Data()); return 0x0; } diff --git a/HBTAN/AliHBTReaderKineTree.h b/HBTAN/AliHBTReaderKineTree.h index 638e66c03a5..447578304a1 100644 --- a/HBTAN/AliHBTReaderKineTree.h +++ b/HBTAN/AliHBTReaderKineTree.h @@ -6,6 +6,7 @@ class TFile; class AliStack; +class AliRunLoader; class AliHBTReaderKineTree: public AliHBTReader { @@ -26,13 +27,15 @@ class AliHBTReaderKineTree: public AliHBTReader protected: - TString fFileName; - AliHBTRun* fParticles; //!simulated particles + TString fFileName; + AliHBTRun* fParticles; //!simulated particles - TFile* OpenFile(Int_t); - AliStack* GetStack(Int_t,TFile*); + AliRunLoader* OpenFile(Int_t); Bool_t fIsRead;//!flag indicating if the data are already read + + static const TString fgkEventFolderName; + private: public: diff --git a/HBTAN/AliHBTReaderPPprod.cxx b/HBTAN/AliHBTReaderPPprod.cxx index 945ab8c19b9..33ce438b836 100644 --- a/HBTAN/AliHBTReaderPPprod.cxx +++ b/HBTAN/AliHBTReaderPPprod.cxx @@ -88,6 +88,9 @@ Int_t AliHBTReaderPPprod::Read(AliHBTRun* particles, AliHBTRun *tracks) //reads data and puts put to the particles and tracks objects //reurns 0 if everything is OK // + cout<<"New I/O not implemented\n"; + return 0; + Int_t i; //iterator and some temprary values Int_t Nevents; if (!particles) //check if an object is instatiated @@ -160,17 +163,14 @@ Int_t AliHBTReaderPPprod::Read(AliHBTRun* particles, AliHBTRun *tracks) AliTPCtrack *iotrack=0; fClustersFile->cd(); - //AliTPCtracker *tracker=new AliTPCtracker(TPCParam,currentEvent);//I.B. - AliTPCtracker *tracker=new AliTPCtracker(TPCParam); //I.B. - tracker->SetEventNumber(currentEvent); //I.B. + AliTPCtracker *tracker = new AliTPCtracker(TPCParam,currentEvent,""); if (!tracker) { Error("AliHBTReaderPPprod::Read","Can't get a tracker !\n"); return 3; } - //tracker->LoadInnerSectors(); //I.B. - //tracker->LoadOuterSectors(); //I.B. - tracker->LoadClusters(); //I.B. + tracker->LoadInnerSectors(); + tracker->LoadOuterSectors(); for (i=0; iGetParticle(gt.code)->Mass(); Double_t pEtot = TMath::Sqrt(gt.px*gt.px + gt.py*gt.py + gt.pz*gt.pz + mass*mass); - AliHBTParticle* part = new AliHBTParticle(gt.code, i, gt.px, gt.py, gt.pz, pEtot, gt.x, gt.y, gt.z, 0.0); + AliHBTParticle* part = new AliHBTParticle(gt.code,i, gt.px, gt.py, gt.pz, pEtot, gt.x, gt.y, gt.z, 0.0); if(Pass(part)) continue; @@ -244,7 +244,7 @@ Int_t AliHBTReaderPPprod::Read(AliHBTRun* particles, AliHBTRun *tracks) Double_t tEtot = TMath::Sqrt( tpx*tpx + tpy*tpy + tpz*tpz + mass*mass); - AliHBTParticle* track = new AliHBTParticle(gt.code, i, tpx, tpy , tpz, tEtot, 0., 0., 0., 0.); + AliHBTParticle* track = new AliHBTParticle(gt.code,i, tpx, tpy , tpz, tEtot, 0., 0., 0., 0.); if(Pass(track)) continue; particles->AddParticle(currentEvent,part); diff --git a/HBTAN/AliHBTReaderTPC.cxx b/HBTAN/AliHBTReaderTPC.cxx index aee2bd74e92..92dbd82ae3d 100644 --- a/HBTAN/AliHBTReaderTPC.cxx +++ b/HBTAN/AliHBTReaderTPC.cxx @@ -1,13 +1,16 @@ #include "AliHBTReaderTPC.h" - + #include #include #include #include +#include +#include #include #include #include +#include #include "AliHBTRun.h" #include "AliHBTEvent.h" @@ -21,56 +24,46 @@ ClassImp(AliHBTReaderTPC) // class AliHBTReaderTPC // //reader for TPC tracking -//needs galice.root, AliTPCtracks.root +//needs galice.root, AliTPCtracks.root, AliTPCclusters.root // //more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html //Piotr.Skowronski@cern.ch -// - +AliHBTReaderTPC::AliHBTReaderTPC():fFileName("galice.root") +{ + //constructor, + //Defaults: + // galicefilename = "" - this means: Do not open gAlice file - + // just leave the global pointer untouched + + fParticles = 0x0; + fTracks = 0x0; + fIsRead = kFALSE; +} -AliHBTReaderTPC:: AliHBTReaderTPC(const Char_t* trackfilename, - const Char_t* clusterfilename, - const Char_t* galicefilename): - fParticles(new AliHBTRun()), - fTracks(new AliHBTRun()), - fTrackFileName(trackfilename), - fClusterFileName(clusterfilename), - fGAliceFileName(galicefilename), - fIsRead(kFALSE), - fMagneticField(0.4), - fUseMagFFromRun(kTRUE) +AliHBTReaderTPC::AliHBTReaderTPC(const Char_t* galicefilename):fFileName(galicefilename) { //constructor, //Defaults: - // trackfilename = "AliTPCtracks.root" - // clusterfilename = "AliTPCclusters.root" // galicefilename = "" - this means: Do not open gAlice file - - // just leave the global pointer untached - //this class is not supposed to be written, that is why I let myself and user - //for comfort of having default constructor which allocates dynamic memmory - //in case it is going to be written, it should be changed + // just leave the global pointer untouched + fParticles = new AliHBTRun(); + fTracks = new AliHBTRun(); + fIsRead = kFALSE; } /********************************************************************/ -AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs, - const Char_t* trackfilename, const Char_t* clusterfilename, - const Char_t* galicefilename): - AliHBTReader(dirs), - fParticles(new AliHBTRun()), - fTracks(new AliHBTRun()), - fTrackFileName(trackfilename), - fClusterFileName(clusterfilename), - fGAliceFileName(galicefilename), - fIsRead(kFALSE), - fMagneticField(0.4), - fUseMagFFromRun(kTRUE) +AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs, const Char_t* galicefilename): + AliHBTReader(dirs), fFileName(galicefilename) + { //constructor, //Defaults: - // trackfilename = "AliTPCtracks.root" - // clusterfilename = "AliTPCclusters.root" // galicefilename = "" - this means: Do not open gAlice file - // just leave the global pointer untached + + fParticles = new AliHBTRun(); + fTracks = new AliHBTRun(); + fIsRead = kFALSE; } /********************************************************************/ @@ -85,13 +78,18 @@ AliHBTReaderTPC::~AliHBTReaderTPC() AliHBTEvent* AliHBTReaderTPC::GetParticleEvent(Int_t n) { //returns Nth event with simulated particles - if (!fIsRead) - if(Read(fParticles,fTracks)) - { - Error("GetParticleEvent","Error in reading"); - return 0x0; - } - return fParticles->GetEvent(n); + if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); + + if(Read(fParticles,fTracks)) + { + Error("GetParticleEvent","Error in reading"); + return 0x0; + } + } + return (fParticles)?fParticles->GetEvent(n):0x0; } /********************************************************************/ @@ -99,12 +97,16 @@ AliHBTEvent* AliHBTReaderTPC::GetTrackEvent(Int_t n) { //returns Nth event with reconstructed tracks if (!fIsRead) - if(Read(fParticles,fTracks)) - { - Error("GetTrackEvent","Error in reading"); - return 0x0; - } - return fTracks->GetEvent(n); + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); + if(Read(fParticles,fTracks)) + { + Error("GetTrackEvent","Error in reading"); + return 0x0; + } + } + return (fTracks)?fTracks->GetEvent(n):0x0; } /********************************************************************/ @@ -112,12 +114,16 @@ Int_t AliHBTReaderTPC::GetNumberOfPartEvents() { //returns number of events of particles if (!fIsRead) - if ( Read(fParticles,fTracks)) - { - Error("GetNumberOfPartEvents","Error in reading"); - return 0; - } - return fParticles->GetNumberOfEvents(); + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); + if ( Read(fParticles,fTracks)) + { + Error("GetNumberOfPartEvents","Error in reading"); + return 0; + } + } + return (fParticles)?fParticles->GetNumberOfEvents():0; } /********************************************************************/ @@ -125,12 +131,16 @@ Int_t AliHBTReaderTPC::GetNumberOfTrackEvents() { //returns number of events of tracks if (!fIsRead) + { + if (fParticles == 0x0) fParticles = new AliHBTRun(); + if (fTracks == 0x0) fTracks = new AliHBTRun(); if(Read(fParticles,fTracks)) { Error("GetNumberOfTrackEvents","Error in reading"); return 0; } - return fTracks->GetNumberOfEvents(); + } + return (fTracks)?fTracks->GetNumberOfEvents():0; } /********************************************************************/ @@ -141,12 +151,8 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) //reurns 0 if everything is OK // Info("Read",""); - Int_t i; //iterator and some temprary values Int_t Nevents = 0; Int_t totalNevents = 0; - TFile *aTracksFile;//file with tracks - TFile *aClustersFile;//file with clusters - TFile *aGAliceFile;//!ile name with galice if (!particles) //check if an object is instatiated { @@ -177,32 +183,41 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./" { - - if( (i=OpenFiles(aTracksFile,aClustersFile,aGAliceFile,currentdir)) ) + TString filename = GetDirName(currentdir); + if (filename.IsNull()) { - Error("Read","Exiting due to problems with opening files. Errorcode %d",i); + Error("Read","Can not get directory name"); + return 4; + } + filename = filename +"/"+ fFileName; + AliRunLoader* rl = AliRunLoader::Open(filename,AliConfig::fgkDefaultEventFolderName); + if( rl == 0x0) + { + Error("Read","Can not open session."); currentdir++; continue; } - - if (gAlice->TreeE())//check if tree E exists + rl->LoadHeader(); + rl->LoadKinematics(); + AliLoader* tpcl = rl->GetLoader("TPCLoader"); + + if ( tpcl== 0x0) + { + Error("Read","Exiting due to problems with opening files."); + currentdir++; + continue; + } + Nevents = rl->GetNumberOfEvents(); + + if (Nevents > 0)//check if tree E exists { - Nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice Info("Read","________________________________________________________"); Info("Read","Found %d event(s) in directory %s",Nevents,GetDirName(currentdir).Data()); - Float_t mf; - if (fUseMagFFromRun) - { - mf = gAlice->Field()->SolenoidField(); - Info("Read","Setting Magnetic Field from run: B=%fT",mf/10.); - } - else - { - Info("Read","Setting Own Magnetic Field: B=%fT",fMagneticField); - mf = fMagneticField*10.; - } - AliKalmanTrack::SetConvConst(1000/0.299792458/mf); + rl->LoadgAlice(); + Info("Read","Setting Magnetic Field: B=%fT",rl->GetAliRun()->Field()->SolenoidField()); + AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()); + rl->UnloadgAlice(); } else {//if not return an error @@ -210,20 +225,24 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) currentdir++; continue; } - - aGAliceFile->cd();//set cluster file active - AliTPCParam *TPCParam= (AliTPCParam*)aGAliceFile->Get("75x40_100x60_150x60"); - if (!TPCParam) + + rl->CdGAFile(); + AliTPCParam *TPCParam= (AliTPCParam*)gDirectory->Get("75x40_100x60"); + + if (!TPCParam) + { + TPCParam=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!TPCParam) { - TPCParam= (AliTPCParam*)aGAliceFile->Get("75x40_100x60"); - if (!TPCParam) - { - Error("Read","TPC parameters have not been found !\n"); - currentdir++; - continue; - } + Error("Read","TPC parameters have not been found !\n"); + delete rl; + rl = 0x0; + currentdir++; + continue; } + } + tpcl->LoadTracks(); for(Int_t currentEvent =0; currentEventcd();//set track file active - - Char_t treename[100]; - sprintf(treename,"TreeT_TPC_%d",currentEvent);//prepare name of the tree - - TTree *tracktree=0; - - tracktree=(TTree*)aTracksFile->Get(treename);//get the tree + rl->GetEvent(currentEvent); + TTree *tracktree = tpcl->TreeT();//get the tree if (!tracktree) //check if we got the tree {//if not return with error Error("Read","Can't get a tree with TPC tracks !\n"); @@ -258,19 +270,28 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) AliTPCtrack *iotrack=0; -// aClustersFile->cd();//set cluster file active + AliTPCtracker *tracker = new AliTPCtracker(TPCParam,currentEvent,AliConfig::fgkDefaultEventFolderName);//create the tacker for this event + if (!tracker) //check if it has created succeffuly + {//if not return with error + Error("Read","Can't get a tracker !\n"); + continue; + } + tracker->LoadInnerSectors(); + tracker->LoadOuterSectors(); - for (i=0; iSetAddress(&iotrack); //tell the branch ehere to put track data from tree(file) tracktree->GetEvent(i); //stream track i to the iotrack + tracker->CookLabel(iotrack,0.1); //calculate (cook) the label of the tpc track + //which is the label of corresponding simulated particle tarray->AddLast(iotrack); //put the track in the array } - aTracksFile->Delete(treename);//delete tree from memmory (and leave untached on disk)- we do not need it any more - aTracksFile->Delete("tracks");//delete branch from memmory + delete tracker; //delete tracker + tracker = 0x0; trackbranch = 0x0; tracktree = 0x0; @@ -278,27 +299,24 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) Double_t par[5]; Float_t phi, lam, pt;//angles and transverse momentum Int_t label; //label of the current track - - aGAliceFile->cd(); - gAlice->GetEvent(currentEvent); - gAlice->Particles(); + rl->Stack()->Particles(); - for (i=0; iAt(i); label = iotrack->GetLabel(); - + if (label < 0) continue; - - TParticle *p = (TParticle*)gAlice->Particle(label); - + TParticle *p = (TParticle*)rl->Stack()->Particle(label); + if(p == 0x0) continue; //if returned pointer is NULL if(p->GetPDG() == 0x0) continue; //if particle has crezy PDG code (not known to our database) - + if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type //if not take next partilce + AliHBTParticle* part = new AliHBTParticle(*p,i); if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts //if it does not delete it and take next good track @@ -319,7 +337,7 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) Double_t mass = p->GetMass(); Double_t tEtot = TMath::Sqrt( tpx*tpx + tpy*tpy + tpz*tpz + mass*mass);//total energy of the track - AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), i, tpx, tpy , tpz, tEtot, 0., 0., 0., 0.); + AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(),i, tpx, tpy , tpz, tEtot, 0., 0., 0., 0.); if(Pass(track))//check if meets all criteria of any of our cuts //if it does not delete it and take next good track { @@ -329,6 +347,7 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) } particles->AddParticle(totalNevents,part);//put track and particle on the run tracks->AddParticle(totalNevents,track); + } tarray->Clear(); //clear the array @@ -337,107 +356,19 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks) /**************************************/ totalNevents++; } + //save environment (resouces) -- //clean your place after the work - CloseFiles(aTracksFile,aClustersFile,aGAliceFile); + delete rl; currentdir++; }while(currentdir < Ndirs); - delete tarray; fIsRead = kTRUE; + return 0; } -/********************************************************************/ -Int_t AliHBTReaderTPC::OpenFiles -(TFile*& aTracksFile, TFile*& aClustersFile, TFile*& agAliceFile,Int_t event) -{ - //opens all the files - - - const TString& dirname = GetDirName(event); - if (dirname == "") - { - Error("OpenFiles","Can not get directory name"); - return 4; - } - - TString filename = dirname +"/"+ fTrackFileName; - aTracksFile = TFile::Open(filename.Data()); - if ( aTracksFile == 0x0 ) - { - Error("OpenFiles","Can't open file with tacks named %s",filename.Data()); - return 1; - } - if (!aTracksFile->IsOpen()) - { - Error("OpenFiles","Can't open file with tacks named %s",filename.Data()); - return 1; - } - -/* - filename = dirname +"/"+ fClusterFileName; - aClustersFile = TFile::Open(filename.Data()); - if ( aClustersFile == 0x0 ) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 2; - } - if (!aClustersFile->IsOpen()) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 2; - } -*/ - filename = dirname +"/"+ fGAliceFileName; - agAliceFile = TFile::Open(filename.Data()); - if ( agAliceFile== 0x0) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 3; - } - if (!agAliceFile->IsOpen()) - { - Error("OpenFiles","Can't open file with TPC clusters named %s",filename.Data()); - return 3; - } - - if (!(gAlice=(AliRun*)agAliceFile->Get("gAlice"))) - { - Error("OpenFiles","gAlice have not been found on %s !\n",filename.Data()); - return 5; - } - - return 0; -} -/********************************************************************/ - -/********************************************************************/ - -void AliHBTReaderTPC::CloseFiles(TFile*& tracksFile, TFile*& clustersFile, TFile*& gAliceFile) -{ - //closes the files - tracksFile->Close(); - delete tracksFile; - tracksFile = 0x0; - -// clustersFile->Close(); -// delete clustersFile; -// clustersFile = 0x0; - - delete gAlice; - gAlice = 0; - - if (gAliceFile) - { - gAliceFile->Close(); - delete gAliceFile; - gAliceFile = 0x0; - } -} - -/********************************************************************/ /********************************************************************/ /********************************************************************/ diff --git a/HBTAN/AliHBTReaderTPC.h b/HBTAN/AliHBTReaderTPC.h index 6d02375b857..43b64b531ab 100644 --- a/HBTAN/AliHBTReaderTPC.h +++ b/HBTAN/AliHBTReaderTPC.h @@ -16,14 +16,9 @@ class TFile; class AliHBTReaderTPC: public AliHBTReader { public: - AliHBTReaderTPC(const Char_t* trackfilename = "AliTPCtracks.root", - const Char_t* clusterfilename = "AliTPCclusters.root", - const Char_t* galicefilename = "galice.root"); - - AliHBTReaderTPC(TObjArray* dirs, - const Char_t* trackfilename = "AliTPCtracks.root", - const Char_t* clusterfilename = "AliTPCclusters.root", - const Char_t* galicefilename = "galice.root"); + AliHBTReaderTPC(); + AliHBTReaderTPC(const Char_t* galicefilename); + AliHBTReaderTPC(TObjArray* dirs, const Char_t* galicefilename = "galice.root"); virtual ~AliHBTReaderTPC(); @@ -34,31 +29,17 @@ class AliHBTReaderTPC: public AliHBTReader Int_t GetNumberOfPartEvents();//returns number of particle events Int_t GetNumberOfTrackEvents();//returns number of track events - void SetMagneticField(Float_t mf){fMagneticField=mf;} - void UseMagneticFieldFromRun(Bool_t flag = kTRUE){fUseMagFFromRun=flag;} protected: //in the future this class is will read global tracking - - - Int_t OpenFiles(TFile*&,TFile*&,TFile*&,Int_t);//opens files to be read for given event - void CloseFiles(TFile*&,TFile*&,TFile*&);//close files - - AliHBTRun* fParticles; //!simulated particles AliHBTRun* fTracks; //!reconstructed tracks (particles) - - TString fTrackFileName;//name of the file with tracks - TString fClusterFileName;//name of the file with clusters - TString fGAliceFileName;//name of the file with galice.root + TString fFileName;//name of the file with galice.root - Bool_t fIsRead;//!flag indicating if the data are already read - - Float_t fMagneticField;//magnetic field value that was enforced while reading - Bool_t fUseMagFFromRun;//flag indicating if using field specified in gAlice (kTRUE) - // or enforece other defined by fMagneticField + Bool_t fIsRead;//!flag indicating if the data are already read private: + public: ClassDef(AliHBTReaderTPC,2) }; diff --git a/HBTAN/HBTAnalysisLinkDef.h b/HBTAN/HBTAnalysisLinkDef.h index dc0eccba2f3..e08be777e07 100644 --- a/HBTAN/HBTAnalysisLinkDef.h +++ b/HBTAN/HBTAnalysisLinkDef.h @@ -112,6 +112,10 @@ #pragma link C++ class AliHBTMonPtDistributionFctn+; #pragma link C++ class AliHBTMonPhiDistributionFctn+; #pragma link C++ class AliHBTMonThetaDistributionFctn+; +#pragma link C++ class AliHBTMonVxDistributionFctn+; +#pragma link C++ class AliHBTMonVyDistributionFctn+; +#pragma link C++ class AliHBTMonVzDistributionFctn+; +#pragma link C++ class AliHBTMonRDistributionFctn+; #pragma link C++ class AliHBTMonPxDistributionVsPtFctn+; #pragma link C++ class AliHBTMonPyDistributionVsPtFctn+; @@ -147,6 +151,12 @@ #pragma link C++ class AliHBTLLWeightTwoKStarFctn+; #pragma link C++ class AliHBTLLWeightTheorQInvFctn+; #pragma link C++ class AliHBTLLWeightsPID+; +#pragma link C++ class AliHBTPositionRandomizer+; +#pragma link C++ class AliHBTRndm+; +#pragma link C++ class AliHBTRndmGaussBall+; +#pragma link C++ class AliHBTRndmCyllSurf+; +#pragma link C++ class AliHBTMonVyDistributionVsVxFctn+; +#pragma link C++ class AliHBTMonRtDistributionVsVzFctn+; //#pragma link C++ class AliHBTGoComPair+; //#pragma link C++ class AliHBTCorrectQ3DCorrelFctn+; //#pragma link C++ class AliHBTCorrectQInvCorrelFctn+; diff --git a/HBTAN/libHBTAN.pkg b/HBTAN/libHBTAN.pkg index cd504c583ea..5706193471c 100644 --- a/HBTAN/libHBTAN.pkg +++ b/HBTAN/libHBTAN.pkg @@ -9,7 +9,8 @@ AliHBTTwoTrackEffFctn.cxx AliHBTReaderInternal.cxx\ AliHBTQResolutionFctns.cxx AliHBTQDistributionFctns.cxx \ AliHBTLLWeights.cxx AliHBTLLWeightFctn.cxx\ AliHBTMonDistributionFctns.cxx AliHBTMonResolutionFctns.cxx \ -AliHBTLLWeightsPID.cxx AliHBTLLWeightTheorFctn.cxx +AliHBTLLWeightsPID.cxx AliHBTLLWeightTheorFctn.cxx \ +AliHBTPositionRandomizer.cxx FSRCS = fsiini.F fsiw.F led_bldata.F ltran12.F @@ -18,5 +19,3 @@ HDRS:= $(SRCS:.cxx=.h) DHDR= HBTAnalysisLinkDef.h EINCLUDE:= TPC CONTAINERS ITS - - diff --git a/HBTAN/ltran12.F b/HBTAN/ltran12.F index de694d7e939..c3fa195317d 100644 --- a/HBTAN/ltran12.F +++ b/HBTAN/ltran12.F @@ -98,12 +98,12 @@ C---> Coordinates ----------------------------- RS12=XS*P12X+YS*P12Y+ZS*P12Z H1=(RS12/EPM-TS)/AM12 -cmlv X=XS+P12X*H1 -cmlv Y=YS+P12Y*H1 -cmlv Z=ZS+P12Z*H1 -cmlv T=(E12*TS-RS12)/AM12 -cmlv RPS=X*X+Y*Y+Z*Z -cmlv RP=DSQRT(RPS) + X=XS+P12X*H1 + Y=YS+P12Y*H1 + Z=ZS+P12Z*H1 + T=(E12*TS-RS12)/AM12 + RPS=X*X+Y*Y+Z*Z + RP=DSQRT(RPS) RETURN @@ -121,6 +121,7 @@ C==== =============================================================== RETURN END C==== + SUBROUTINE LTR4(Z,T,BETA,GAMMA,ZT,TT) C===> Lorentz Transf. of Z(Pz) and T(E) to moving ref. frame.(real*4) CInp: Z,T-Zcoord,Time before tr., BETA,GAMMA- velocity, Lor.fact. @@ -144,6 +145,16 @@ C==== ================================================= RETURN !------> END ! X + SUBROUTINE SETPDIST(R) +C=====Just sets distance between particles + IMPLICIT REAL*8 (A-H,O-Z) + COMMON/FSI_PRF/PPX,PPY,PPZ,AK,AKS, ! momenta in PRF + 1 X,Y,Z,T,RP,RPS + RPS=R + RP=R*R + RETURN + END + @@ -154,4 +165,4 @@ C==== ================================================= - \ No newline at end of file + diff --git a/HBTP/common_event_summary.inc b/HBTP/common_event_summary.inc index 493aea0d931..916cc816066 100644 --- a/HBTP/common_event_summary.inc +++ b/HBTP/common_event_summary.inc @@ -9,7 +9,7 @@ C o Chi-Square values C ! a limit on the number of events that C ! can be processed in the input event C ! text file. - parameter (max_events = 100) + parameter (max_events = 10000) common/event_summary/ 1num_iter(max_events), niter_mean, niter_rms, diff --git a/HBTP/hbt_event_processor.f b/HBTP/hbt_event_processor.f index 9ade4ca88ea..36b5bdcc4e8 100644 --- a/HBTP/hbt_event_processor.f +++ b/HBTP/hbt_event_processor.f @@ -2717,7 +2717,7 @@ CCC table 'trk' and table 'trk2': sign_toggle = 1 CCC Start Event Loop: - +C write(*,*) 'REF HISTO N Ev = ', n_events do i = 1,n_events If(ALICE .eq. 1) Then Call AliHbtp_SetActiveEventNumber(i) @@ -2732,14 +2732,23 @@ CCC Start Event Loop: do ipt = 1,n_pt_bins href1_pt_1(ipt) = href1_pt_1(ipt) + hist1_pt_1(ipt) + if (href1_pt_1(ipt) .lt. 0 ) then + write(*,*) 'href1_pt_1 bin ',ipt,'is less then 0' + endif end do do iphi = 1,n_phi_bins href1_phi_1(iphi) = href1_phi_1(iphi) + hist1_phi_1(iphi) + if (href1_phi_1(iphi) .lt. 0 ) then + write(*,*) 'href1_phi_1 bin ',iphi,'is less then 0' + endif end do do ieta = 1,n_eta_bins href1_eta_1(ieta) = href1_eta_1(ieta) + hist1_eta_1(ieta) + if (href1_eta_1(ieta) .lt. 0 ) then + write(*,*) 'href1_eta_1 bin ',ieta,'is less then 0' + endif end do end if @@ -2810,6 +2819,8 @@ CCC Start Event Loop: num_pairs_unlike_ref = num_pairs_unlike_ref 1 + n_part_used_1_trk * n_part_used_2_trk2 2 + n_part_used_2_trk * n_part_used_1_trk2 +C write(*,*) 'num_pairs_like_ref',num_pairs_like_ref +C write(*,*) 'num_pairs_unlike_ref',num_pairs_unlike_ref end if end do ! End of Event Loop @@ -3617,7 +3628,7 @@ CCC Local Variable Type Declarations: integer*4 control real*4 px,py,pz,E,pt,phi,eta,mass - real*4 theta,pi,rad,pcut + real*4 theta,pi,rad,pcut,x,y parameter (pi = 3.141592654) parameter (pcut = 0.000001) @@ -3658,7 +3669,10 @@ CCC Compute pseudorapidity: if(abs(eta) .le. pcut) then pz = 0.0 else - theta = 2.0*atan(exp(-eta)) + x = exp(-eta) + y = atan(x) + theta = 2.0*y +C theta = 2.0*atan(exp(-eta)) pz = pt/tan(theta) end if @@ -4898,6 +4912,14 @@ C write(*,*) 'NEXT EVENT:', ievent num_pairs_unlike_inc = num_pairs_unlike_inc + num_pairs_unlike n_part_used_1_inc = n_part_used_1_inc + n_part_used_1_trk n_part_used_2_inc = n_part_used_2_inc + n_part_used_2_trk + +C write (*,*) 'num_pairs_like = ',num_pairs_like +C write (*,*) 'num_pairs_unlike = ',num_pairs_unlike +C write (*,*) 'num_pairs_like_inc = ',num_pairs_like_inc +c write (*,*) 'num_pairs_unlike_inc = ',num_pairs_unlike_inc +c write (*,*) 'n_part_used_1_inc = ',n_part_used_1_inc +C write (*,*) 'n_part_used_2_inc = ',n_part_used_2_inc + if(pid(1).gt.0) Call histog1(1,0,1,pid(1),0.,0.,0.) if(pid(2).gt.0) Call histog1(1,0,2,pid(2),0.,0.,0.) Call histog2(1,0,0,0,0,0.0,0.0,0.0,0.0) @@ -6661,7 +6683,8 @@ CCC END MODE = 4 OUTPUT AND FORMATS C------------------------------ Else If(mode.eq.5) Then ! Optional Output for 1- and 2-Body Fits C------------------------------ ! for each event. - +C write(*,*)'Event ', ievent +C write(*,*)'chisq_total_store(event) ',chisq_total_store(ievent) write(8,500) ievent write(8,501) n_part_1_trk,n_part_2_trk,n_part_tot_trk write(8,502) n_part_used_1_trk, n_part_used_2_trk diff --git a/ITS/AliITS.cxx b/ITS/AliITS.cxx index 334c77f434a..612d69c307a 100644 --- a/ITS/AliITS.cxx +++ b/ITS/AliITS.cxx @@ -13,244 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.76 2002/11/21 23:05:27 alibrary -Removing AliMC and AliMCProcess - -Revision 1.75 2002/10/22 14:45:25 alibrary -Introducing Riostream.h - -Revision 1.74 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.67.4.3 2002/10/14 13:14:07 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.73 2002/09/09 17:14:25 nilsen -Update of documentation to reflect changes in AliITSdigitS?D classes. - -Revision 1.72 2002/06/10 17:28:55 nilsen -Added new FillModules routine and cleaned up the old one. - -Revision 1.71 2002/05/13 14:27:56 hristov -TreeC created once per event (M.Masera) - -Revision 1.70 2002/05/10 22:28:30 nilsen -Changes by Massimo Masera to allow the TTree of clusters to be written to a -file otherthan the one with digits in it. - -Revision 1.69 2002/05/05 21:06:55 nilsen -Added GetSimulationMoel, and fixed up SetDefaultSimulation to do the -proper initilization when a simulation has already been defined. - -Revision 1.68 2002/05/02 18:51:53 nilsen -AliITS.h - Method MakeBranchR has now a second argument, with a default value: - Option_t *opt=" ". Opt="Fast" is to create a separate branch - for fast points in TreeR - New method MakeBranchRF: it a separate branch in TreeR for Fast Points - -AliITS.cxx -1) TTree->Write() replaced with TTree->AutoSave for TreeS, TreeD and - TreeR -2) Changes in MakeBranchR to allow the creation of a special branch - for fast points - -Revision 1.67 2002/03/15 17:22:51 nilsen -Intoduced SDigits2Digits and SDigitsToDigits functions. - -Revision 1.66 2001/11/28 01:35:45 nilsen -Using standard constructors instead of default constructors for Clusterfinder, -Response, and FastSimulator. - -Revision 1.65 2001/11/27 16:27:28 nilsen -Adding AliITSDigitizer class to do merging and digitization . Based on the -TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h -file. The following files required minor changes. AliITS, added functions -SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD. -AliITSsimulationSDD.cxx needed a Tree indepenent way of returning back to -the original Root Directory in function Compress1D. Now it uses gDirectory. - -Revision 1.64 2001/11/19 16:17:02 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.63 2001/10/24 21:16:34 nilsen -Removed some dead code and improved comments/documntation. - -Revision 1.62 2001/10/21 19:23:21 nilsen -Added function to allow to limit which detectors to digitize and reconstruct. -The default is All. This change makes no changes to any root file. - -Revision 1.61 2001/10/11 15:26:07 mariana -Correct HitsToFastRecPoints - -Revision 1.60 2001/10/04 22:38:10 nilsen -Changes made to support PreDigits (SDigits) plus other helpful changes. - -Revision 1.59 2001/08/30 09:56:18 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. - -Revision 1.58 2001/07/26 15:05:29 hristov -Use global gRandom generator (M.Ivanov) - -Revision 1.57 2001/07/24 14:26:11 mariana -Introduce the function Digits2Reco() and write the defaults for simulation and reconstruction - -Revision 1.56 2001/07/05 12:49:49 mariana -Temporary patches required by root.v3.01.05 - -Revision 1.55 2001/06/14 14:59:00 barbera -Tracking V1 decoupled from AliITS - -Revision 1.54 2001/05/31 20:37:56 barbera -Bari/Salerno model set as defaault SPD simulation - -Revision 1.53 2001/05/31 18:52:24 barbera -Bari model becomes the default - -Revision 1.53 2001/05/30 07:52:24 hristov -TPC and CONTAINERS included in the search path - -Revision 1.52 2001/05/30 06:04:58 hristov -Changes made to be consitant with changes in TPC tracking classes (B.Nilsen) - -Revision 1.51 2001/05/16 14:57:15 alibrary -New files for folders and Stack - -Revision 1.50 2001/05/11 09:15:21 barbera -Corrected to make fast point creation working with PPR geometry - -Revision 1.49 2001/05/11 07:37:49 hristov -Legacy lines commented - -Revision 1.48 2001/05/10 18:14:25 barbera -A typo corrected - -Revision 1.47 2001/05/10 17:55:59 barbera -Modified to create rec points also for PPR geometries - -Revision 1.46 2001/05/10 00:05:28 nilsen -Allowed for HitsToDigits function to work with versions 5, 7, 8, and 9. This -should probably be cleaned up to only check to make sure that fITSgeom has -been properly defined. - -Revision 1.45 2001/05/01 22:35:48 nilsen -Remove/commented a number of cout<< statements. and made change needed by -SSD code. - -Revision 1.44 2001/04/26 22:44:01 nilsen -Removed dependence on layer 5/6 in AliITS::HitsToDigits. This will be -done properly in AliITSv???.cxx via SetDefaults. - -Revision 1.43 2001/04/26 13:22:52 barbera -TMatrix and TVector elimininated to speed up the code - -Revision 1.42 2001/04/25 21:55:12 barbera -Updated version to be compatible with actual verion of STEER and TPC - -Revision 1.41 2001/04/21 15:16:51 barbera -Updated with the new SSD reconstruction code - -Revision 1.40 2001/03/17 15:07:06 mariana -Update SDD response parameters - -Revision 1.39 2001/03/12 17:45:32 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.38 2001/03/07 14:04:51 barbera -Some vector dimensions increased to cope with full events - -Revision 1.37 2001/03/07 12:36:35 barbera -A change added in the tracking part to manage delta rays - -Revision 1.36 2001/03/02 19:44:11 barbera - modified to taking into account new version tracking v1 - -Revision 1.35 2001/02/28 18:16:46 mariana -Make the code compatible with the new AliRun - -Revision 1.34 2001/02/11 15:51:39 mariana -Set protection in MakeBranch - -Revision 1.33 2001/02/10 22:26:39 mariana -Move the initialization of the containers for raw clusters in MakeTreeC() - -Revision 1.32 2001/02/08 23:55:31 nilsen -Removed fMajor/MinorVersion variables in favor of variables in derived classes. -Set arrays char *det[3] = {"SPD","SDD","SSD"} as const. - -Revision 1.31 2001/02/02 23:57:28 nilsen -Added include file that are no londer included in AliITSgeom.h - -Revision 1.30 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.29 2001/01/26 20:01:09 hristov -Major upgrade of AliRoot code - -Revision 1.28 2000/12/18 14:02:00 barbera -new version of the ITS tracking to take into account the new TPC track parametrization +/* $Id$ */ -Revision 1.27 2000/12/08 13:49:27 barbera -Hidden declaration in a for loop removed to be compliant with HP-UX compiler - -Revision 1.26 2000/11/27 13:12:13 barbera -New version containing the files for tracking - -Revision 1.25 2000/11/12 22:38:05 barbera -Added header file for the SPD Bari model - -Revision 1.24 2000/10/09 22:18:12 barbera -Bug fixes from MAriana to le AliITStest.C run correctly - -Revision 1.23 2000/10/05 20:47:42 nilsen -fixed dependencies of include files. Tryed but failed to get a root automaticly -generates streamer function to work. Modified SetDefaults. - -Revision 1.9.2.15 2000/10/04 16:56:40 nilsen -Needed to include stdlib.h - -======= -Revision 1.22 2000/10/04 19:45:52 barbera -Corrected by F. Carminati for v3.04 - -Revision 1.21 2000/10/02 21:28:08 fca -Removal of useless dependecies via forward declarations - -Revision 1.20 2000/10/02 16:31:39 barbera -General code clean-up - -Revision 1.9.2.14 2000/10/02 15:43:51 barbera -General code clean-up (e.g., printf -> cout) - -Revision 1.19 2000/09/22 12:13:25 nilsen -Patches and updates for fixes to this and other routines. - -Revision 1.18 2000/07/12 05:32:20 fca -Correcting several syntax problem with static members - -Revision 1.17 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.9.2.3 2000/02/02 13:42:09 barbera -fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated - -Revision 1.9.2.2 2000/01/23 03:03:13 nilsen -//fixed FillModule. Removed fi(fabs(xl) #include -#include -#include + #include -#include #include -#include -#include #include -#include +#include +#include +#include +#include #include +#include +#include +#include +#include "AliConfig.h" #include "AliHeader.h" - #include "AliITS.h" +#include "AliITSClusterFinderSDD.h" +#include "AliITSClusterFinderSPD.h" +#include "AliITSClusterFinderSSD.h" #include "AliITSDetType.h" -#include "AliITSresponseSPD.h" +#include "AliITSLoader.h" +#include "AliITSRawCluster.h" +#include "AliITSRecPoint.h" +#include "AliITSdigit.h" +#include "AliITSgeom.h" +#include "AliITShit.h" +#include "AliITSmodule.h" +#include "AliITSpList.h" #include "AliITSresponseSDD.h" +#include "AliITSresponseSPD.h" #include "AliITSresponseSSD.h" -#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" +#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSSD.h" -#include "AliITSsimulationSPD.h" #include "AliITSsimulationSDD.h" +#include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" -#include "AliITSClusterFinderSPD.h" -#include "AliITSClusterFinderSDD.h" -#include "AliITSClusterFinderSSD.h" -#include "AliITShit.h" -#include "AliITSgeom.h" -#include "AliITSpList.h" -#include "AliITSdigit.h" -#include "AliITSmodule.h" -#include "AliITSRecPoint.h" -#include "AliITSRawCluster.h" ClassImp(AliITS) @@ -378,7 +146,6 @@ AliITS::AliITS() : AliDetector() { fCtype = 0; fNctype = 0; - fTreeC = 0; fRecPoints = 0; fNRecPoints = 0; @@ -430,19 +197,19 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ fCtype = new TObjArray(fNDetTypes); fNctype = new Int_t[fNDetTypes]; - fTreeC = 0; fRecPoints = new TClonesArray("AliITSRecPoint",1000); fNRecPoints = 0; Int_t i; for(i=0;iAddAt(new AliITSDetType(),i); - fNdtype[i] = 0; - fNctype[i] = 0; + fDetTypes->AddAt(new AliITSDetType(),i); + fNdtype[i] = 0; + fNctype[i] = 0; } // end for i SetMarkerColor(kRed); + } //______________________________________________________________________ AliITS::~AliITS(){ @@ -458,49 +225,54 @@ AliITS::~AliITS(){ // Return: // none. - if (fHits) { - fHits->Delete(); - delete fHits; - fHits=0; - } - if (fSDigits) { - fSDigits->Delete(); - delete fSDigits; - fSDigits=0; - } -// delete fDigits; fDigits=0; - if (fRecPoints) { - fRecPoints->Delete(); - delete fRecPoints; - fRecPoints=0; - } - delete[] fIdName; // Array of TStrings - delete[] fIdSens; - if(fITSmodules) { - this->ClearModules(); - delete fITSmodules; + if (fHits) { + fHits->Delete(); + delete fHits; + fHits=0; + } + if (fSDigits) { + fSDigits->Delete(); + delete fSDigits; + fSDigits=0; + } + if (fDigits) { + fDigits->Delete(); + delete fDigits; + fDigits=0; + } + if (fRecPoints) { + fRecPoints->Delete(); + delete fRecPoints; + fRecPoints=0; + } + delete[] fIdName; // Array of TStrings + delete[] fIdSens; + if(fITSmodules) { + this->ClearModules(); + delete fITSmodules; fITSmodules = 0; - }// end if fITSmodules!=0 - - if(fDtype) { - fDtype->Delete(); - delete fDtype; - } // end if fDtype - delete [] fNdtype; - if (fCtype) { - fCtype->Delete(); - delete fCtype; - } // end if fCtype - delete [] fNctype; - - if (fDetTypes) { - fDetTypes->Delete(); - delete fDetTypes; - } // end if fDetTypes - - if (fTreeC) delete fTreeC; - - if (fITSgeom) delete fITSgeom; + }// end if fITSmodules!=0 + + if(fDtype) { + fDtype->Delete(); + delete fDtype; + } // end if fDtype + delete [] fNdtype; + if (fCtype) { + fCtype->Delete(); + delete fCtype; + fCtype = 0; + } // end if fCtype + delete [] fNctype; + + if (fDetTypes) { + fDetTypes->Delete(); + delete fDetTypes; + fDetTypes = 0; + } // end if fDetTypes + + + if (fITSgeom) delete fITSgeom; } //______________________________________________________________________ AliITS::AliITS(AliITS &source){ @@ -515,7 +287,7 @@ AliITS::AliITS(AliITS &source){ if(this==&source) return; Error("Copy constructor", - "You are not allowed to make a copy of the AliITS"); + "You are not allowed to make a copy of the AliITS"); exit(1); } //______________________________________________________________________ @@ -588,52 +360,52 @@ void AliITS::SetDefaults(){ //SPD iDetType=DetType(0); if (!iDetType->GetSegmentationModel()) { - AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); - SetSegmentationModel(0,seg0); + AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); + SetSegmentationModel(0,seg0); } // end if if (!iDetType->GetResponseModel()) { - SetResponseModel(0,new AliITSresponseSPD()); + SetResponseModel(0,new AliITSresponseSPD()); } // end if // set digit and raw cluster classes to be used const char *kData0=(iDetType->GetResponseModel())->DataType(); if (strstr(kData0,"real")) { - iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); + iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); // SDD iDetType=DetType(1); if (!iDetType->GetResponseModel()) { - SetResponseModel(1,new AliITSresponseSDD("simulated")); + SetResponseModel(1,new AliITSresponseSDD("simulated")); } // end if AliITSresponse *resp1=iDetType->GetResponseModel(); if (!iDetType->GetSegmentationModel()) { - AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1); - SetSegmentationModel(1,seg1); + AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1); + SetSegmentationModel(1,seg1); } // end if const char *kData1=(iDetType->GetResponseModel())->DataType(); const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption(); if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){ - iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); + iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); // SSD iDetType=DetType(2); if (!iDetType->GetSegmentationModel()) { - AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom); - SetSegmentationModel(2,seg2); + AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom); + SetSegmentationModel(2,seg2); } // end if if (!iDetType->GetResponseModel()) { - SetResponseModel(2,new AliITSresponseSSD("simulated")); + SetResponseModel(2,new AliITSresponseSSD("simulated")); } // end if const char *kData2=(iDetType->GetResponseModel())->DataType(); if (strstr(kData2,"real")) { - iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); + iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); if (kNTYPES>3) { - Warning("SetDefaults", - "Only the three basic detector types are initialized!"); + Warning("SetDefaults", + "Only the three basic detector types are initialized!"); } // end if } //______________________________________________________________________ @@ -651,53 +423,53 @@ void AliITS::SetDefaultSimulation(){ iDetType=DetType(0); sim = iDetType->GetSimulationModel(); if (!sim) { - AliITSsegmentation *seg0= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); - SetSimulationModel(0,sim0); + AliITSsegmentation *seg0= + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel(); + AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); + SetSimulationModel(0,sim0); }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSPD*)sim)->Init( - (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(), - (AliITSresponseSPD*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); + ((AliITSsimulationSPD*)sim)->Init( + (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(), + (AliITSresponseSPD*) iDetType->GetResponseModel()); +// if(sim->GetResponseModel()==0) sim->SetResponseModel( +// (AliITSresponse*)iDetType->GetResponseModel()); +// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( +// (AliITSsegmentation*)iDetType->GetSegmentationModel()); } // end if iDetType=DetType(1); sim = iDetType->GetSimulationModel(); if (!sim) { - AliITSsegmentation *seg1= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); - SetSimulationModel(1,sim1); + AliITSsegmentation *seg1= + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); + AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); + SetSimulationModel(1,sim1); }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSDD*)sim)->Init( - (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(), - (AliITSresponseSDD*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); + ((AliITSsimulationSDD*)sim)->Init( + (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(), + (AliITSresponseSDD*) iDetType->GetResponseModel()); +// if(sim->GetResponseModel()==0) sim->SetResponseModel( +// (AliITSresponse*)iDetType->GetResponseModel()); +// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( +// (AliITSsegmentation*)iDetType->GetSegmentationModel()); } //end if iDetType=DetType(2); sim = iDetType->GetSimulationModel(); if (!sim) { - AliITSsegmentation *seg2= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); - SetSimulationModel(2,sim2); + AliITSsegmentation *seg2= + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel(); + AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); + SetSimulationModel(2,sim2); }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSSD*)sim)->Init( - (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(), - (AliITSresponseSSD*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); + ((AliITSsimulationSSD*)sim)->Init( + (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(), + (AliITSresponseSSD*) iDetType->GetResponseModel()); +// if(sim->GetResponseModel()==0) sim->SetResponseModel( +// (AliITSresponse*)iDetType->GetResponseModel()); +// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( +// (AliITSsegmentation*)iDetType->GetSegmentationModel()); } // end if } //______________________________________________________________________ @@ -716,40 +488,40 @@ void AliITS::SetDefaultClusterFinders(){ // SPD iDetType=DetType(0); if (!iDetType->GetReconstructionModel()) { - AliITSsegmentation *seg0 = - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - TClonesArray *dig0=DigitsAddress(0); - TClonesArray *recp0=ClustersAddress(0); - AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0, - recp0); - SetReconstructionModel(0,rec0); + AliITSsegmentation *seg0 = + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + TClonesArray *dig0=DigitsAddress(0); + TClonesArray *recp0=ClustersAddress(0); + AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0, + recp0); + SetReconstructionModel(0,rec0); } // end if // SDD iDetType=DetType(1); if (!iDetType->GetReconstructionModel()) { - AliITSsegmentation *seg1 = - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); - TClonesArray *dig1=DigitsAddress(1); - TClonesArray *recp1=ClustersAddress(1); - AliITSClusterFinderSDD *rec1 = - new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); + AliITSsegmentation *seg1 = + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); + TClonesArray *dig1=DigitsAddress(1); + TClonesArray *recp1=ClustersAddress(1); + AliITSClusterFinderSDD *rec1 = + new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); SetReconstructionModel(1,rec1); } // end if // SSD iDetType=DetType(2); if (!iDetType->GetReconstructionModel()) { - AliITSsegmentation *seg2= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - TClonesArray *dig2=DigitsAddress(2); - AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2); - SetReconstructionModel(2,rec2); + AliITSsegmentation *seg2= + (AliITSsegmentation*)iDetType->GetSegmentationModel(); + TClonesArray *dig2=DigitsAddress(2); + AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2); + SetReconstructionModel(2,rec2); } // end if } //______________________________________________________________________ -void AliITS::MakeBranch(Option_t* option, const char *file){ +void AliITS::MakeBranch(Option_t* option){ // Creates Tree branches for the ITS. // Inputs: // Option_t *option String of Tree types S,D, and/or R. @@ -761,18 +533,21 @@ void AliITS::MakeBranch(Option_t* option, const char *file){ // none. // Return: // none. + Bool_t cH = (strstr(option,"H")!=0); Bool_t cS = (strstr(option,"S")!=0); Bool_t cD = (strstr(option,"D")!=0); Bool_t cR = (strstr(option,"R")!=0); Bool_t cRF = (strstr(option,"RF")!=0); + if(cRF)cR = kFALSE; + if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); + + AliDetector::MakeBranch(option); - AliDetector::MakeBranch(option,file); - - if(cS) MakeBranchS(file); - if(cD) MakeBranchD(file); - if(cR) MakeBranchR(file); - if(cRF) MakeBranchRF(file); + if(cS) MakeBranchS(0); + if(cD) MakeBranchD(0); + if(cR) MakeBranchR(0); + if(cRF) MakeBranchRF(0); } //______________________________________________________________________ void AliITS::SetTreeAddress(){ @@ -783,10 +558,11 @@ void AliITS::SetTreeAddress(){ // none. // Return: // none. - TTree *treeS = gAlice->TreeS(); - TTree *treeD = gAlice->TreeD(); - TTree *treeR = gAlice->TreeR(); - + TTree *treeS = fLoader->TreeS(); + TTree *treeD = fLoader->TreeD(); + TTree *treeR = fLoader->TreeR(); + if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); + AliDetector::SetTreeAddress(); SetTreeAddressS(treeS); @@ -912,37 +688,37 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){ // none. if(fITSmodules){ - fITSmodules->Delete(); - delete fITSmodules; + fITSmodules->Delete(); + delete fITSmodules; } // end fir fITSmoudles Int_t nl,indexMAX,index; if(size<=0){ // default to using data stored in AliITSgeom - if(fITSgeom==0) { - Error("InitModules","fITSgeom not defined"); - return; - } // end if fITSgeom==0 - nl = fITSgeom->GetNlayers(); - indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), - fITSgeom->GetNdetectors(nl))+1; - nmodules = indexMAX; - fITSmodules = new TObjArray(indexMAX); - for(index=0;indexAddAt( new AliITSmodule(index),index); - } // end for index + if(fITSgeom==0) { + Error("InitModules","fITSgeom not defined"); + return; + } // end if fITSgeom==0 + nl = fITSgeom->GetNlayers(); + indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), + fITSgeom->GetNdetectors(nl))+1; + nmodules = indexMAX; + fITSmodules = new TObjArray(indexMAX); + for(index=0;indexAddAt( new AliITSmodule(index),index); + } // end for index }else{ - fITSmodules = new TObjArray(size); - for(index=0;indexAddAt( new AliITSmodule(index),index); - } // end for index + fITSmodules = new TObjArray(size); + for(index=0;indexAddAt( new AliITSmodule(index),index); + } // end for index nmodules = size; } // end i size<=0 } //______________________________________________________________________ void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, - Option_t *option,Text_t *filename){ + Option_t *option,Text_t *filename){ // fill the modules with the sorted by module hits; add hits from // background if option=Add. // Inputs: @@ -958,96 +734,38 @@ void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, // Return: // none. static TTree *trH1; //Tree with background hits -// static TClonesArray *fHits2; //List of hits for one track only static Bool_t first=kTRUE; static TFile *file; const char *addBgr = strstr(option,"Add"); if (addBgr ) { - if(first) { - file=new TFile(filename); -// fHits2 = new TClonesArray("AliITShit",1000 ); - } // end if first - first=kFALSE; - file->cd(); - file->ls(); - // Get Hits Tree header from file -// if(fHits2) fHits2->Clear(); - if(trH1) delete trH1; - trH1=0; - - char treeName[20]; - sprintf(treeName,"TreeH%d",bgrev); - trH1 = (TTree*)gDirectory->Get(treeName); - if (!trH1) { - Error("FillModules","cannot find Hits Tree for event:%d",bgrev); - } // end if !trH1 - // Set branch addresses -/* - TBranch *branch; - char branchname[20]; - sprintf(branchname,"%s",GetName()); - if (trH1 && fHits2) { - branch = trH1->GetBranch(branchname); - if (branch) branch->SetAddress(&fHits2); - } // end if trH1 && fHits -*/ + if(first) { + file=new TFile(filename); + } // end if first + first=kFALSE; + file->cd(); + file->ls(); + // Get Hits Tree header from file + if(trH1) delete trH1; + trH1=0; + + char treeName[20]; + sprintf(treeName,"TreeH%d",bgrev); + trH1 = (TTree*)gDirectory->Get(treeName); + if (!trH1) { + Error("FillModules","cannot find Hits Tree for event:%d",bgrev); + } // end if !trH1 + // Set branch addresses } // end if addBgr - FillModules(gAlice->TreeH(),0); // fill from this file's tree. -/* - TClonesArray *itsHits = this->Hits(); - Int_t lay,lad,det,index; - AliITShit *itsHit=0; - AliITSmodule *mod=0; - TTree *iTH = gAlice->TreeH(); - Int_t ntracks =(Int_t) iTH->GetEntries(); - Int_t t,h; - for(t=0; tResetHits(); - iTH->GetEvent(t); - Int_t nhits = itsHits->GetEntriesFast(); - if (!nhits) continue; - for(h=0; hUncheckedAt(h); - itsHit->GetDetectorID(lay,lad,det); - // temporarily index=det-1 !!! - if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); - else index=det-1; - // - mod = this->GetModule(index); - mod->AddHit(itsHit,t,h); - } // end loop over hits - } // end loop over tracks -*/ - // open the file with background + FillModules(fLoader->TreeH(),0); // fill from this file's tree. if (addBgr ) { - FillModules(trH1,10000000); // Default mask 10M. -/* - Int_t track,i; - ntracks =(Int_t)trH1->GetEntries(); - // Loop over tracks - for (track=0; trackClear(); - trH1->GetEvent(track); - // Loop over hits - for(i=0;iGetEntriesFast();++i) { - itsHit=(AliITShit*) (*fHits2)[i]; - itsHit->GetDetectorID(lay,lad,det); - // temporarily index=det-1 !!! - if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det); - else index=det-1; - // - mod = this->GetModule(index); - mod->AddHit(itsHit,track,i); - } // end loop over hits - } // end loop over tracks -*/ - TTree *fAli=gAlice->TreeK(); - TFile *fileAli=0; - if (fAli) fileAli =fAli->GetCurrentFile(); - fileAli->cd(); + FillModules(trH1,10000000); // Default mask 10M. + TTree *fAli=fLoader->GetRunLoader()->TreeK(); + TFile *fileAli=0; + if (fAli) fileAli =fAli->GetCurrentFile(); + fileAli->cd(); } // end if add } //______________________________________________________________________ @@ -1064,6 +782,10 @@ void AliITS::FillModules(TTree *treeH, Int_t mask) { // Return: // none. + if (treeH == 0x0) + { + Error("FillModules","Tree is NULL"); + } Int_t lay,lad,det,index; AliITShit *itsHit=0; AliITSmodule *mod=0; @@ -1071,29 +793,29 @@ void AliITS::FillModules(TTree *treeH, Int_t mask) { sprintf(branchname,"%s",GetName()); TBranch *branch = treeH->GetBranch(branchname); if (!branch) { - Error("FillModules","%s branch in TreeH not found",branchname); - return; + Error("FillModules","%s branch in TreeH not found",branchname); + return; } // end if !branch branch->SetAddress(&fHits); Int_t nTracks =(Int_t) treeH->GetEntries(); Int_t iPrimTrack,h; for(iPrimTrack=0; iPrimTrackGetEvent(iPrimTrack); - if (nBytes <= 0) continue; - Int_t nHits = fHits->GetEntriesFast(); - for(h=0; hUncheckedAt(h); - itsHit->GetDetectorID(lay,lad,det); - if (fITSgeom) { - index = fITSgeom->GetModuleIndex(lay,lad,det); - } else { - index=det-1; // This should not be used. - } // end if [You must have fITSgeom for this to work!] - mod = GetModule(index); - itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask. - mod->AddHit(itsHit,iPrimTrack,h); - } // end loop over hits + ResetHits(); + Int_t nBytes = treeH->GetEvent(iPrimTrack); + if (nBytes <= 0) continue; + Int_t nHits = fHits->GetEntriesFast(); + for(h=0; hUncheckedAt(h); + itsHit->GetDetectorID(lay,lad,det); + if (fITSgeom) { + index = fITSgeom->GetModuleIndex(lay,lad,det); + } else { + index=det-1; // This should not be used. + } // end if [You must have fITSgeom for this to work!] + mod = GetModule(index); + itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask. + mod->AddHit(itsHit,iPrimTrack,h); + } // end loop over hits } // end loop over tracks } //______________________________________________________________________ @@ -1122,8 +844,11 @@ void AliITS::MakeBranchS(const char *fl){ // only one branch for SDigits. sprintf(branchname,"%s",GetName()); - if(fSDigits && gAlice->TreeS()){ - MakeBranchInTree(gAlice->TreeS(),branchname,&fSDigits,buffersize,fl); + + + if(fSDigits && fLoader->TreeS()){ + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); + MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl); } // end if } //______________________________________________________________________ @@ -1138,6 +863,7 @@ void AliITS::SetTreeAddressS(TTree *treeS){ char branchname[30]; if(!treeS) return; + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); TBranch *branch; sprintf(branchname,"%s",GetName()); branch = treeS->GetBranch(branchname); @@ -1165,18 +891,18 @@ void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){ char clclass[40]; Int_t i; for (i=0; iGetClassNames(digclass,clclass); - // digits - if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); - else ResetDigits(i); + DetType(i)->GetClassNames(digclass,clclass); + // digits + if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); + if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); + else ResetDigits(i); } // end for i for (i=0; iGetClassNames(digclass,clclass); - // digits - if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); - else ResetDigits(i); - if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); - else sprintf(branchname,"%sDigits%d",GetName(),i+1); - if (fDtype) { - branch = treeD->GetBranch(branchname); - if (branch) branch->SetAddress(&((*fDtype)[i])); - } // end if fDtype + DetType(i)->GetClassNames(digclass,clclass); + // digits + if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); + if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); + else ResetDigits(i); + if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); + else sprintf(branchname,"%sDigits%d",GetName(),i+1); + if (fDtype) { + branch = treeD->GetBranch(branchname); + if (branch) branch->SetAddress(&((*fDtype)[i])); + } // end if fDtype } // end for i } //______________________________________________________________________ @@ -1218,11 +945,19 @@ void AliITS::Hits2SDigits(){ // none. // return; // Using Hits in place of the larger sDigits. - AliHeader *header=gAlice->GetHeader(); // Get event number from this file. + AliRunLoader* rl = fLoader->GetRunLoader(); + AliHeader *header=rl->GetHeader(); // Get event number from this file. + if (header == 0x0) + { + rl->LoadHeader(); + header=rl->GetHeader(); + if (header == 0x0) return; + } // Do the Hits to Digits operation. Use Standard input values. // Event number from file, no background hit merging , use size from // AliITSgeom class, option="All", input from this file only. HitsToSDigits(header->GetEvent(),0,-1," ",fOpt," "); + } //______________________________________________________________________ void AliITS::Hits2PreDigits(){ @@ -1232,7 +967,7 @@ void AliITS::Hits2PreDigits(){ // Outputs: // none. - AliHeader *header=gAlice->GetHeader(); // Get event number from this file. + AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file. // Do the Hits to Digits operation. Use Standard input values. // Event number from file, no background hit merging , use size from // AliITSgeom class, option="All", input from this file only. @@ -1252,7 +987,7 @@ void AliITS::SDigitsToDigits(Option_t *opt){ const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), - strstr(opt,"SSD")}; + strstr(opt,"SSD")}; if( !det[0] && !det[1] && !det[2] ) all = "All"; else all = 0; static Bool_t setDef=kTRUE; @@ -1261,45 +996,45 @@ void AliITS::SDigitsToDigits(Option_t *opt){ AliITSsimulation *sim = 0; AliITSDetType *iDetType = 0; - TTree *trees = gAlice->TreeS(); + TTree *trees = fLoader->TreeS(); if( !(trees && this->GetSDigits()) ){ - Error("SDigits2Digits","Error: No trees or SDigits. Returning."); - return; + Error("SDigits2Digits","Error: No trees or SDigits. Returning."); + return; } // end if sprintf( name, "%s", this->GetName() ); TBranch *brchSDigits = trees->GetBranch( name ); Int_t id,module; for(module=0;moduleGetIndexMax();module++){ - id = geom->GetModuleType(module); + id = geom->GetModuleType(module); if (!all && !det[id]) continue; - iDetType = DetType(id); - sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if (!sim) { - Error("SDigit2Digits", - "The simulation class was not instanciated!"); - exit(1); - } // end if !sim - sim->InitSimulationModule(module,gAlice->GetEvNumber()); + iDetType = DetType(id); + sim = (AliITSsimulation*)iDetType->GetSimulationModel(); + if (!sim) { + Error("SDigit2Digits", + "The simulation class was not instanciated!"); + exit(1); + } // end if !sim + sim->InitSimulationModule(module,gAlice->GetEvNumber()); // - // add summable digits to module - this->GetSDigits()->Clear(); - brchSDigits->GetEvent(module); - sim->AddSDigitsToModule(GetSDigits(),0); + // add summable digits to module + this->GetSDigits()->Clear(); + brchSDigits->GetEvent(module); + sim->AddSDigitsToModule(GetSDigits(),0); // // Digitise current module sum(SDigits)->Digits sim->FinishSDigitiseModule(); // fills all branches - wasted disk space - gAlice->TreeD()->Fill(); + fLoader->TreeD()->Fill(); this->ResetDigits(); } // end for module - gAlice->TreeD()->GetEntries(); + fLoader->TreeD()->GetEntries(); - gAlice->TreeD()->AutoSave(); + fLoader->TreeD()->AutoSave(); // reset tree - gAlice->TreeD()->Reset(); + fLoader->TreeD()->Reset(); } //______________________________________________________________________ @@ -1310,7 +1045,7 @@ void AliITS::Hits2Digits(){ // Outputs: // none. - AliHeader *header=gAlice->GetHeader(); // Get event number from this file. + AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file. // Do the Hits to Digits operation. Use Standard input values. // Event number from file, no background hit merging , use size from // AliITSgeom class, option="All", input from this file only. @@ -1318,7 +1053,7 @@ void AliITS::Hits2Digits(){ } //______________________________________________________________________ void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size, - Option_t *option, Option_t *opt,Text_t *filename){ + Option_t *option, Option_t *opt,Text_t *filename){ // keep galice.root for signal and name differently the file for // background when add! otherwise the track info for signal will be lost ! // the condition below will disappear when the geom class will be @@ -1343,7 +1078,7 @@ void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size, } //______________________________________________________________________ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, - Option_t *option, Option_t *opt,Text_t *filename){ + Option_t *option, Option_t *opt,Text_t *filename){ // Keep galice.root for signal and name differently the file for // background when add! otherwise the track info for signal will be lost ! // the condition below will disappear when the geom class will be @@ -1367,7 +1102,7 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), - strstr(opt,"SSD")}; + strstr(opt,"SSD")}; static Bool_t setDef=kTRUE; if (setDef) SetDefaultSimulation(); setDef=kFALSE; @@ -1381,32 +1116,33 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, AliITSmodule *mod = 0; Int_t id,module; for(module=0;moduleGetIndexMax();module++){ - id = geom->GetModuleType(module); + id = geom->GetModuleType(module); if (!all && !det[id]) continue; - iDetType = DetType(id); - sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if (!sim) { - Error("HitsToSDigits", - "The simulation class was not instanciated!"); - exit(1); - } // end if !sim - mod = (AliITSmodule *)fITSmodules->At(module); - sim->SDigitiseModule(mod,module,evNumber); - // fills all branches - wasted disk space - gAlice->TreeS()->Fill(); - ResetSDigits(); + iDetType = DetType(id); + sim = (AliITSsimulation*)iDetType->GetSimulationModel(); + if (!sim) { + Error("HitsToSDigits", + "The simulation class was not instanciated!"); + exit(1); + } // end if !sim + mod = (AliITSmodule *)fITSmodules->At(module); + sim->SDigitiseModule(mod,module,evNumber); + // fills all branches - wasted disk space + fLoader->TreeS()->Fill(); + ResetSDigits(); } // end for module ClearModules(); - gAlice->TreeS()->GetEntries(); - gAlice->TreeS()->AutoSave(); + fLoader->TreeS()->GetEntries(); + fLoader->TreeS()->AutoSave(); + fLoader->WriteSDigits("OVERWRITE"); // reset tree - gAlice->TreeS()->Reset(); + fLoader->TreeS()->Reset(); } //______________________________________________________________________ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, - Option_t *option, Option_t *opt,Text_t *filename){ + Option_t *option, Option_t *opt,Text_t *filename){ // Keep galice.root for signal and name differently the file for // background when add! otherwise the track info for signal will be lost ! // the condition below will disappear when the geom class will be @@ -1430,7 +1166,7 @@ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), - strstr(opt,"SSD")}; + strstr(opt,"SSD")}; static Bool_t setDef=kTRUE; if (setDef) SetDefaultSimulation(); setDef=kFALSE; @@ -1444,28 +1180,28 @@ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, AliITSmodule *mod = 0; Int_t id,module; for(module=0;moduleGetIndexMax();module++){ - id = geom->GetModuleType(module); + id = geom->GetModuleType(module); if (!all && !det[id]) continue; - iDetType = DetType(id); - sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if (!sim) { - Error("HitsToDigits", - "The simulation class was not instanciated!"); - exit(1); - } // end if !sim - mod = (AliITSmodule *)fITSmodules->At(module); - sim->DigitiseModule(mod,module,evNumber); - // fills all branches - wasted disk space - gAlice->TreeD()->Fill(); - ResetDigits(); + iDetType = DetType(id); + sim = (AliITSsimulation*)iDetType->GetSimulationModel(); + if (!sim) { + Error("HitsToDigits", + "The simulation class was not instanciated!"); + exit(1); + } // end if !sim + mod = (AliITSmodule *)fITSmodules->At(module); + sim->DigitiseModule(mod,module,evNumber); + // fills all branches - wasted disk space + fLoader->TreeD()->Fill(); + ResetDigits(); } // end for module ClearModules(); - gAlice->TreeD()->GetEntries(); - gAlice->TreeD()->AutoSave(); + fLoader->TreeD()->GetEntries(); + fLoader->TreeD()->AutoSave(); // reset tree - gAlice->TreeD()->Reset(); + fLoader->TreeD()->Reset(); } //______________________________________________________________________ void AliITS::ResetSDigits(){ @@ -1490,8 +1226,8 @@ void AliITS::ResetDigits(){ Int_t i; for (i=0;iAt(i)) ((TClonesArray*)fDtype->At(i))->Clear(); - if (fNdtype) fNdtype[i]=0; + if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear(); + if (fNdtype) fNdtype[i]=0; } // end for i } //______________________________________________________________________ @@ -1549,19 +1285,19 @@ void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){ switch(id){ case 0: - new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); + break; case 1: - new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); + break; case 2: - new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); + break; } // end switch id } //______________________________________________________________________ void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks, - Int_t *hits,Float_t *charges){ + Int_t *hits,Float_t *charges){ // Add a simulated digit to the list. // Inputs: // Int_t id Detector type number. @@ -1584,116 +1320,132 @@ void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks, TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); switch(id){ case 0: - new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); + break; case 1: - new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks, - hits,charges); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks, + hits,charges); + break; case 2: - new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); - break; + new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); + break; } // end switch id } //______________________________________________________________________ void AliITS::MakeTreeC(Option_t *option){ - // Create a separate tree to store the clusters. - // Inputs: - // Option_t *option string which must contain "C" otherwise - // no Cluster Tree is created. - // Outputs: - // none. - // Return: - // none. - TDirectory *cwd = gDirectory; - TFile *fileRecPoints = gAlice->GetTreeRFile(); - if(fileRecPoints)fileRecPoints->cd(); - const char *optC = strstr(option,"C"); - char hname[30]; - Int_t cureve = gAlice->GetEvNumber(); - sprintf(hname,"TreeC%d",cureve); - if(fTreeC){ - const char *curname = fTreeC->GetName(); - char *exists = strstr(hname,curname); - if(!exists){ - delete fTreeC; - fTreeC=0; - } - } - if (optC && !fTreeC) fTreeC = new TTree(hname,"Clusters in ITS"); - else return; + // Create a separate tree to store the clusters. + // Inputs: + // Option_t *option string which must contain "C" otherwise + // no Cluster Tree is created. + // Outputs: + // none. + // Return: + // none. + + AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; + + if (pITSLoader == 0x0) { + Error("MakeTreeC","fLoader == 0x0"); + return; + } + if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C"); + MakeBranchC(); +} - Int_t buffersize = 4000; - char branchname[30]; - const char *det[3] = {"SPD","SDD","SSD"}; - char digclass[40]; - char clclass[40]; +void AliITS::MakeBranchC() +{ +//Makes barnches in treeC + AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; + if (pITSLoader == 0x0) + { + Error("MakeTreeC","fLoader == 0x0"); + return; + } + TTree * TC = pITSLoader->TreeC(); + if (TC == 0x0) + { + Error("MakeTreeC","Can not get TreeC from Loader"); + return; + } + + Int_t buffersize = 4000; + char branchname[30]; + const char *det[3] = {"SPD","SDD","SSD"}; + char digclass[40]; + char clclass[40]; // one branch for Clusters per type of detector - Int_t i; - for (i=0; iGetClassNames(digclass,clclass); - // clusters - if(!ClustersAddress(i)){ + // clusters + if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); + if(!ClustersAddress(i)) + { fCtype->AddAt(new TClonesArray(clclass,1000),i); - } + } if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); - else sprintf(branchname,"%sClusters%d",GetName(),i+1); - if (fCtype && fTreeC) { - TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize); - } // end if fCtype && fTreeC - } // end for i - cwd->cd(); + else sprintf(branchname,"%sClusters%d",GetName(),i+1); + if (fCtype && TC) + { + if (TC->GetBranch(branchname)) + { + Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname); + } + else + { + Info("MakeBranchC","Creating branch %s in TreeC",branchname); + TC->Branch(branchname,&((*fCtype)[i]), buffersize); + } + } // end if fCtype && TC + } // end for i } + //______________________________________________________________________ void AliITS::GetTreeC(Int_t event){ - // Get the clusters tree for this event and set the branch address. - // Inputs: - // Int_t event Event number for the cluster tree. - // Outputs: - // none. - // Return: - // none. - char treeName[20]; - char branchname[30]; - const char *det[3] = {"SPD","SDD","SSD"}; + // Get the clusters tree for this event and set the branch address. + // Inputs: + // Int_t event Event number for the cluster tree. + // Outputs: + // none. + // Return: + // none. + char branchname[30]; + const char *det[3] = {"SPD","SDD","SSD"}; - ResetClusters(); - if (fTreeC) { - delete fTreeC; - } // end if fTreeC - - sprintf(treeName,"TreeC%d",event); - TFile *fileRecPoints = gAlice->GetTreeRFile(); - if(!fileRecPoints){ - fTreeC = (TTree*)gDirectory->Get(treeName); - } - else { - fTreeC = (TTree*)fileRecPoints->Get(treeName); - } + AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; + TTree * TC = pITSLoader->TreeC(); - TBranch *branch; + ResetClusters(); + if (TC) { + pITSLoader->CleanRawClusters(); + } // end if TreeC() - if (fTreeC) { - Int_t i; - char digclass[40]; - char clclass[40]; - for (i=0; iGetClassNames(digclass,clclass); - // clusters - if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i); - if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); - else sprintf(branchname,"%sClusters%d",GetName(),i+1); - if (fCtype) { - branch = fTreeC->GetBranch(branchname); - if (branch) branch->SetAddress(&((*fCtype)[i])); - } // end if fCtype - } // end for i - } else { - Error("GetTreeC","cannot find Clusters Tree for event:%d",event); - } // end if fTreeC + + TBranch *branch; + + if (TC) { + Int_t i; + char digclass[40]; + char clclass[40]; + for (i=0; iGetClassNames(digclass,clclass); + // clusters + if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); + if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i); + if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); + else sprintf(branchname,"%sClusters%d",GetName(),i+1); + if (fCtype) { + branch = TC->GetBranch(branchname); + if (branch) branch->SetAddress(&((*fCtype)[i])); + } // end if fCtype + } // end for i + } else { + Error("GetTreeC","cannot find Clusters Tree for event:%d",event); + } // end if TC } //______________________________________________________________________ void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){ @@ -1711,14 +1463,14 @@ void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){ switch(id){ case 0: - new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); - break; + new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); + break; case 1: - new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); - break; + new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); + break; case 2: - new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); - break; + new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); + break; } // end switch id } //______________________________________________________________________ @@ -1766,8 +1518,12 @@ void AliITS::MakeBranchR(const char *file, Option_t *opt){ } else { sprintf(branchname,"%sRecPoints",GetName()); } - if (fRecPoints && gAlice->TreeR()) { - MakeBranchInTree(gAlice->TreeR(),branchname,&fRecPoints,buffsz,file); + + + + if (fRecPoints && fLoader->TreeR()) { + if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); + MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file); } // end if } //______________________________________________________________________ @@ -1782,6 +1538,7 @@ void AliITS::SetTreeAddressR(TTree *treeR){ char branchname[30]; if(!treeR) return; + if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); TBranch *branch; sprintf(branchname,"%sRecPoints",GetName()); branch = treeR->GetBranch(branchname); @@ -1812,7 +1569,7 @@ void AliITS::AddRecPoint(const AliITSRecPoint &r){ } //______________________________________________________________________ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, - Option_t *opt0,Option_t *opt1,Text_t *flnm){ + Option_t *opt0,Option_t *opt1,Text_t *flnm){ // keep galice.root for signal and name differently the file for // background when add! otherwise the track info for signal will be lost ! // the condition below will disappear when the geom class will be @@ -1836,7 +1593,7 @@ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, const char *all = strstr(opt1,"All"); const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"), - strstr(opt1,"SSD")}; + strstr(opt1,"SSD")}; Int_t nmodules; InitModules(size,nmodules); FillModules(evNumber,bgrev,nmodules,opt0,flnm); @@ -1848,29 +1605,32 @@ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, //m.b. : this change is nothing but a nice way to make sure //the CPU goes up ! - for(module=0;moduleGetIndexMax();module++){ - id = geom->GetModuleType(module); + + cout<<"HitsToFastRecPoints: N mod = "<GetIndexMax()<GetIndexMax();module++) + { + id = geom->GetModuleType(module); if (!all && !det[id]) continue; - iDetType = DetType(id); - sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if (!sim) { - Error("HitsToFastPoints", - "The simulation class was not instanciated!"); - exit(1); - } // end if !sim - mod = (AliITSmodule *)fITSmodules->At(module); - sim->CreateFastRecPoints(mod,module,gRandom); - // gAlice->TreeR()->Fill(); - TBranch *br=gAlice->TreeR()->GetBranch("ITSRecPointsF"); - br->Fill(); - ResetRecPoints(); + iDetType = DetType(id); + sim = (AliITSsimulation*)iDetType->GetSimulationModel(); + if (!sim) + { + Error("HitsToFastPoints","The simulation class was not instanciated!"); + exit(1); + } // end if !sim + mod = (AliITSmodule *)fITSmodules->At(module); + sim->CreateFastRecPoints(mod,module,gRandom); + cout<TreeR()->Fill(); + TBranch *br=fLoader->TreeR()->GetBranch("ITSRecPointsF"); + br->Fill(); + ResetRecPoints(); } // end for module ClearModules(); - - gAlice->TreeR()->AutoSave(); - // reset tree - gAlice->TreeR()->Reset(); + + fLoader->WriteRecPoints("OVERWRITE"); } //______________________________________________________________________ void AliITS::Digits2Reco(){ @@ -1880,74 +1640,75 @@ void AliITS::Digits2Reco(){ // Outputs: // none. - AliHeader *header=gAlice->GetHeader(); + AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // to Digits to RecPoints for event in file, all digits in file, and // all ITS detectors. DigitsToRecPoints(header->GetEvent(),0,fOpt); } //______________________________________________________________________ void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){ - // cluster finding and reconstruction of space points - // the condition below will disappear when the geom class will be - // initialized for all versions - for the moment it is only for v5 ! - // 7 is the SDD beam test version - // Inputs: - // Int_t evNumber Event number to be processed. - // Int_t lastentry Offset for module when not all of the modules - // are processed. - // Option_t *opt String indicating which ITS sub-detectors should - // be processed. If ="All" then all of the ITS - // sub detectors are processed. - // Outputs: - // none. - // Return: - // none. - - if(!GetITSgeom()) return; - AliITSgeom *geom = GetITSgeom(); + // cluster finding and reconstruction of space points + // the condition below will disappear when the geom class will be + // initialized for all versions - for the moment it is only for v5 ! + // 7 is the SDD beam test version + // Inputs: + // Int_t evNumber Event number to be processed. + // Int_t lastentry Offset for module when not all of the modules + // are processed. + // Option_t *opt String indicating which ITS sub-detectors should + // be processed. If ="All" then all of the ITS + // sub detectors are processed. + // Outputs: + // none. + // Return: + // none. + + if(!GetITSgeom()) return; + AliITSgeom *geom = GetITSgeom(); - const char *all = strstr(opt,"All"); - const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), - strstr(opt,"SSD")}; - static Bool_t setRec=kTRUE; - if (setRec) SetDefaultClusterFinders(); - setRec=kFALSE; - - TTree *treeC=TreeC(); - AliITSClusterFinder *rec = 0; - AliITSDetType *iDetType = 0; - Int_t id,module,first=0; - for(module=0;moduleGetIndexMax();module++){ - id = geom->GetModuleType(module); - if (!all && !det[id]) continue; - if(det[id]) first = geom->GetStartDet(id); - iDetType = DetType(id); - rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); - TClonesArray *itsDigits = this->DigitsAddress(id); - if (!rec) { - Error("DigitsToRecPoints", - "The reconstruction class was not instanciated!"); - exit(1); - } // end if !rec - this->ResetDigits(); - if (all) gAlice->TreeD()->GetEvent(lastentry+module); - else gAlice->TreeD()->GetEvent(lastentry+(module-first)); - Int_t ndigits = itsDigits->GetEntriesFast(); - if (ndigits) rec->FindRawClusters(module); - gAlice->TreeR()->Fill(); - ResetRecPoints(); - treeC->Fill(); - ResetClusters(); - } // end for module + const char *all = strstr(opt,"All"); + const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), + strstr(opt,"SSD")}; + static Bool_t setRec=kTRUE; + if (setRec) SetDefaultClusterFinders(); + setRec=kFALSE; + + AliITSLoader *pITSloader = (AliITSLoader*)fLoader; + TTree *treeC=pITSloader->TreeC(); + AliITSClusterFinder *rec = 0; + AliITSDetType *iDetType = 0; + Int_t id,module,first=0; + for(module=0;moduleGetIndexMax();module++){ + id = geom->GetModuleType(module); + if (!all && !det[id]) continue; + if(det[id]) first = geom->GetStartDet(id); + iDetType = DetType(id); + rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); + TClonesArray *itsDigits = this->DigitsAddress(id); + if (!rec) { + Error("DigitsToRecPoints", + "The reconstruction class was not instanciated!"); + exit(1); + } // end if !rec + this->ResetDigits(); + TTree *TD = pITSloader->TreeD(); + if (all) { + TD->GetEvent(lastentry+module); + } + else { + TD->GetEvent(lastentry+(module-first)); + } + Int_t ndigits = itsDigits->GetEntriesFast(); + if (ndigits) rec->FindRawClusters(module); + pITSloader->TreeR()->Fill(); + ResetRecPoints(); + treeC->Fill(); + ResetClusters(); + } // end for module - gAlice->TreeR()->GetEntries(); - treeC->GetEntries(); - gAlice->TreeR()->AutoSave(); - // reset tree - gAlice->TreeR()->Reset(); - treeC->AutoSave(); - treeC->Reset(); + pITSloader->WriteRecPoints("OVERWRITE"); + pITSloader->WriteRawClusters("OVERWRITE"); } //______________________________________________________________________ void AliITS::ResetRecPoints(){ @@ -1960,3 +1721,18 @@ void AliITS::ResetRecPoints(){ if (fRecPoints) fRecPoints->Clear(); fNRecPoints = 0; } +//______________________________________________________________________ +AliLoader* AliITS::MakeLoader(const char* topfoldername) +{ + //builds ITSgetter (AliLoader type) + //if detector wants to use castomized getter, it must overload this method + + cout<<"AliITS::MakeLoader: Creating standard getter for detector "< // used in inline function SetHitsAddressBranch #include "AliRun.h" +#include "AliLoader.h" #include "AliDetector.h" #include "AliITSDetType.h" @@ -23,6 +24,7 @@ class TFile; //class AliITSDetType; class AliITSsimulation; class AliITSClusterFinder; +class AliITSLoader; class AliITSsegmentation; class AliITSresponse; class AliITShit; @@ -65,12 +67,13 @@ class AliITS : public AliDetector { AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *) (fITSmodules->At(index));} - //================ Nessesary general Classes ======================= + //================ Necessary general Classes ======================= virtual void Init(); + virtual AliLoader* MakeLoader(const char* topfoldername); virtual void SetDefaults(); virtual void SetDefaultSimulation(); virtual void SetDefaultClusterFinders(); - virtual void MakeBranch(Option_t *opt=" ", const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void SetTreeAddress(); // For a give branch from the treeH sets the TClonesArray address. virtual void SetHitsAddressBranch(TBranch *b){b->SetAddress(&fHits);} @@ -157,8 +160,6 @@ class AliITS : public AliDetector { void AddCluster(Int_t branch, AliITSRawCluster *c); void ResetClusters(); // one of the methods in void ResetClusters(Int_t branch); // the pair will be kept - // Return pointer to the tree of clusters - TTree *TreeC() {return fTreeC;} // Return pointers to clusters TObjArray *Ctype() {return fCtype;} Int_t *Nctype() {return fNctype;} @@ -168,6 +169,7 @@ class AliITS : public AliDetector { //=================== Reconstruction =============================== void MakeBranchR(const char *file, Option_t *opt=" "); void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");} + void MakeBranchC(); void SetTreeAddressR(TTree *treeR); void AddRecPoint(const AliITSRecPoint &p); void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, @@ -177,7 +179,7 @@ class AliITS : public AliDetector { void ResetRecPoints(); // Return pointer to rec points TClonesArray *RecPoints() {return fRecPoints;} - + protected: //================== Data Members ================================== AliITSgeom *fITSgeom; // Pointer to ITS geometry @@ -192,20 +194,19 @@ class AliITS : public AliDetector { Int_t fNDetTypes; // Number of detector types TObjArray *fDetTypes; // List of detector types - TClonesArray *fSDigits; // List of Summable digits. + TClonesArray *fSDigits; //! List of Summable digits. Int_t fNSDigits; // Number of Summable Digits. - TObjArray *fDtype; // List of digits + TObjArray *fDtype; //! List of digits Int_t *fNdtype; //[fNDetTypes] Num. of digits per type of det. - TObjArray *fCtype; // List of clusters + TObjArray *fCtype; //! List of clusters Int_t *fNctype; //[fNDetTypes] Num. of clust. per type of det. - TTree *fTreeC; //! Tree for raw clusters - TClonesArray *fRecPoints; // List of reconstructed points + TClonesArray *fRecPoints; //! List of reconstructed points Int_t fNRecPoints; // Number of rec points - ClassDef(AliITS,2) // Base class for ITS + ClassDef(AliITS,3) // Base class for ITS }; #endif diff --git a/ITS/AliITSBaseGeometry.cxx b/ITS/AliITSBaseGeometry.cxx index 59ed0153380..07e4bd9a7c7 100644 --- a/ITS/AliITSBaseGeometry.cxx +++ b/ITS/AliITSBaseGeometry.cxx @@ -13,24 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2003/04/17 22:29:23 nilsen -Geometry bug fixes and the like. Work still progressing. - -Revision 1.3 2003/03/27 08:49:39 hristov -Initialization of static data members in the implementation file - -Revision 1.2 2003/03/25 23:27:19 nilsen -ITS new Geometry files. Not yet ready for uses, committed to allow additional -development. - -Revision 1.1 2003/02/10 17:03:52 nilsen -New version and structure of ITS V11 geometry. Work still in progress. - - -$Id$ -*/ +/* $Id$ */ /* A base geometry class defining all of the ITS volumes that make up an ITS diff --git a/ITS/AliITSBaseGeometry.h b/ITS/AliITSBaseGeometry.h index 7bbd93ca2be..2b831a5611b 100644 --- a/ITS/AliITSBaseGeometry.h +++ b/ITS/AliITSBaseGeometry.h @@ -49,12 +49,6 @@ istream &operator>>(istream &os,AliITSBaseVolParams &source); #ifndef ALIITSBOXDATA_H #define ALIITSBOXDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Box data structure. @@ -89,12 +83,6 @@ istream &operator>>(istream &os,AliITSBoxData &source); #ifndef ALIITSTRAPEZOID1DATA_H #define ALIITSTRAPEZOID1DATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Trapezoid 1 data structure. @@ -129,12 +117,6 @@ istream &operator>>(istream &os,AliITSTrapezoid1Data &source); #ifndef ALIITSTRAPEZOID2DATA_H #define ALIITSTRAPEZOID2DATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Trapezoid 2 data structure. @@ -169,12 +151,6 @@ istream &operator>>(istream &os,AliITSTrapezoid2Data &source); #ifndef ALIITSTRAPEZOIDDATA_H #define ALIITSTRAPEZOIDDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Trapezoid General data structure. @@ -228,12 +204,6 @@ istream &operator>>(istream &os,AliITSTrapezoidData &source); #ifndef ALIITSTRAPEZOIDTWISTEDDATA_H #define ALIITSTRAPEZOIDTWISTEDDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Trapezoid General data structure. @@ -291,12 +261,6 @@ istream &operator>>(istream &os,AliITSTrapezoidTwistedData &source); #ifndef ALIITSTUBEDATA_H #define ALIITSTUBEDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Tube data structure. @@ -331,12 +295,6 @@ istream &operator>>(istream &os,AliITSTubeData &source); #ifndef ALIITSTUBESEGDATA_H #define ALIITSTUBESEGDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Tube Segment data structure. @@ -376,12 +334,6 @@ istream &operator>>(istream &os,AliITSTubeSegData &source); #ifndef ALIITSTUBECUTDATA_H #define ALIITSTUBECUTDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ #include @@ -436,12 +388,6 @@ istream &operator>>(istream &os,AliITSTubeCutData &source); #ifndef ALIITSTUBEELLIPTICALDATA_H #define ALIITSTUBEELLIPTICALDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Tube Elliptical data structure. @@ -477,12 +423,6 @@ istream &operator>>(istream &os,AliITSTubeEllipticalData &source); #ifndef ALIITSTUBEHYPERBOLICDATA_H #define ALIITSTUBEHYPERBOLICDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Tube Hyperbolic data structure. @@ -520,12 +460,6 @@ istream &operator>>(istream &os,AliITSTubeHyperbolicData &source); #ifndef ALIITSCONEDATA_H #define ALIITSCONEDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Cone data structure. @@ -564,12 +498,6 @@ istream &operator>>(istream &os,AliITSConeData &source); #ifndef ALIITSCONESEGDATA_H #define ALIITSCONESEGDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Cone Segment data structure. @@ -613,12 +541,6 @@ istream &operator>>(istream &os,AliITSConeSegData &source); #ifndef ALIITSPCONEDATA_H #define ALIITSPCONEDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Poly-Cone data structure. @@ -700,12 +622,6 @@ istream &operator>>(istream &os,AliITSPConeData &source); #ifndef ALIITSSPHEREDATA_H #define ALIITSSPHEREDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Tube Segment data structure. @@ -747,12 +663,6 @@ istream &operator>>(istream &os,AliITSSphereData &source); #ifndef ALIITSPARALLELEPIPEDDATA_H #define ALIITSPARALLELEPIPEDDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Box data structure. @@ -800,12 +710,6 @@ istream &operator>>(istream &os,AliITSParallelpipedData &source); #ifndef ALIITSPGONDATA_H #define ALIITSPGONDATA_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // Geant 3 Poly-Gon data structure. @@ -889,12 +793,6 @@ istream &operator>>(istream &os,AliITSPGonData &source); #endif #ifndef ALIITSBASEGEOMETRY_H #define ALIITSBASEGEOMETRY_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* - $Id$ - */ ///////////////////////////////////////////////////////////////////////// // A basic geometry class for the ITS simulation geometry stucture diff --git a/ITS/AliITSClusterFinder.cxx b/ITS/AliITSClusterFinder.cxx index 885160100fb..2f43b9ed970 100644 --- a/ITS/AliITSClusterFinder.cxx +++ b/ITS/AliITSClusterFinder.cxx @@ -18,6 +18,7 @@ // See also AliITSClusterFinderSPD, AliITSClusterFinderSDD, // AliITSClusterFinderSDD // + #include "AliITSClusterFinder.h" #include "AliITSdigit.h" #include "AliRun.h" diff --git a/ITS/AliITSClusterFinder.h b/ITS/AliITSClusterFinder.h index a91b27d12fb..baa57d936dc 100644 --- a/ITS/AliITSClusterFinder.h +++ b/ITS/AliITSClusterFinder.h @@ -112,10 +112,10 @@ class AliITSClusterFinder :public TObject{ // set the fitting methods in the derived classes // data members - - protected: TClonesArray *fDigits; //! digits - Int_t fNdigits; //! num of digits + Int_t fNdigits; //! num of digits + + protected: AliITSresponse *fResponse; //! response AliITSsegmentation *fSegmentation; //!segmentation Int_t fNRawClusters; //! in case we split the cluster diff --git a/ITS/AliITSClusterFinderSDD.cxx b/ITS/AliITSClusterFinderSDD.cxx index 549809e3b58..ce3272d643d 100644 --- a/ITS/AliITSClusterFinderSDD.cxx +++ b/ITS/AliITSClusterFinderSDD.cxx @@ -12,36 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Id$ - $Log$ - Revision 1.30 2003/03/03 16:34:35 masera - Corrections to comply with coding conventions - Revision 1.29 2002/10/25 18:54:22 barbera - Various improvements and updates from B.S.Nilsen and T. Virgili +/* $Id$ */ - Revision 1.28 2002/10/22 14:45:29 alibrary - Introducing Riostream.h - - Revision 1.27 2002/10/14 14:57:00 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.23.4.2 2002/10/14 13:14:07 hristov - Updating VirtualMC to v3-09-02 - - Revision 1.26 2002/09/09 17:23:28 nilsen - Minor changes in support of changes to AliITSdigitS?D class'. - - Revision 1.25 2002/05/10 22:29:40 nilsen - Change my Massimo Masera in the default constructor to bring things into - compliance. - - Revision 1.24 2002/04/24 22:02:31 nilsen - New SDigits and Digits routines, and related changes, (including new - noise values). - - */ // // Cluster finder // for Silicon diff --git a/ITS/AliITSClusterFinderSPDdubna.cxx b/ITS/AliITSClusterFinderSPDdubna.cxx index 71247b1ff18..69c7a45cce9 100644 --- a/ITS/AliITSClusterFinderSPDdubna.cxx +++ b/ITS/AliITSClusterFinderSPDdubna.cxx @@ -13,35 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/22 14:45:33 alibrary -Introducing Riostream.h +/* $Id$ */ -Revision 1.5 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.2.8.1 2002/08/28 15:06:50 alibrary -Updating to v3-09-01 - -Revision 1.4 2002/08/22 13:18:46 nilsen -Added = operator and copy constructor in an attempt to fix complilation -problems found by Yves Schutz. - -Revision 1.3 2002/08/21 22:04:27 nilsen -Added data member to SPD cluters and made related modifications to the -SPD Cluster finders. Generaly cleanded up some of the code. - -Revision 1.2 2001/06/14 14:33:53 barbera -New version from B. Batyunya to get the Dubna model work with the present HEAD - -Revision 1.15 2001/05/01 22:37:44 nilsen -Added a dummy argument to FindRawClusters. Argument used for SSD version. - -Revision 1.14 2001/03/05 14:48:46 nilsen -Fixed a reoccuring bug. Array sizes must be declare const. - -*/ // Cluster Finder for // Silicon // Pixel diff --git a/ITS/AliITSComparisonV2.C b/ITS/AliITSComparisonV2.C index 9d47628536f..9dcdb9ff60a 100644 --- a/ITS/AliITSComparisonV2.C +++ b/ITS/AliITSComparisonV2.C @@ -3,11 +3,15 @@ #include #include "AliRun.h" + #include "AliRunLoader.h" + #include "AliLoader.h" + #include "AliITSLoader.h" #include "AliITS.h" #include "AliITSgeom.h" #include "AliITStrackerV2.h" #include "AliITStrackV2.h" #include "AliITSclusterV2.h" + #include "AliMagF.h" #include "TFile.h" #include "TTree.h" @@ -30,16 +34,44 @@ struct GoodTrackITS { Int_t AliITSComparisonV2(Int_t event=0) { cerr<<"Doing comparison...\n"; - + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } + + AliRunLoader *rl = AliRunLoader::Open("galice.root"); + if (!rl) + { + cerr<<"AliITSComparisonV2.C :Can't start sesion !\n"; + return 1; + } + rl->LoadgAlice(); + if (rl->GetAliRun()) + AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()); + else + { + cerr<<"AliITSComparisonV2.C :Can't get AliRun !\n"; + return 1; + } + rl->UnloadgAlice(); + + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsl == 0x0) + { + cerr<<"AliITSComparisonV2.C : Can not find TPCLoader\n"; + delete rl; + return 3; + } + const Int_t MAX=15000; - Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event); + Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const char* evfoldname = AliConfig::fgkDefaultEventFolderName);//declaration only Int_t nentr=0; TObjArray tarray(2000); {/* Load tracks */ - TFile *tf=TFile::Open("AliITStracksV2.root"); - if (!tf->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 3;} - char tname[100]; sprintf(tname,"TreeT_ITS_%d",event); - TTree *tracktree=(TTree*)tf->Get(tname); + itsl->LoadTracks(); + TTree *tracktree=itsl->TreeT(); if (!tracktree) {cerr<<"Can't get a tree with ITS tracks !\n"; return 4;} TBranch *tbranch=tracktree->GetBranch("tracks"); nentr=(Int_t)tracktree->GetEntries(); @@ -49,16 +81,8 @@ Int_t AliITSComparisonV2(Int_t event=0) { tbranch->SetAddress(&iotrack); tracktree->GetEvent(i); tarray.AddLast(iotrack); - /*if (itsLabel != 1234) continue; - Int_t nc=iotrack->GetNumberOfClusters(); - for (Int_t k=0; kGetClusterIndex(k); - AliITSclusterV2 *c=tracker.GetCluster(index); - cout<GetLabel(0)<<' '<GetLabel(1)<<' '<GetLabel(2)<Close(); + itsl->UnloadTracks(); } /* Generate a list of "good" tracks */ @@ -80,7 +104,7 @@ Int_t AliITSComparisonV2(Int_t event=0) { if (!in.eof()) cerr<<"Read error (good_tracks_its) !\n"; } else { cerr<<"Marking good tracks (this will take a while)...\n"; - ngood=good_tracks_its(gt,MAX,event); + ngood=good_tracks_its(gt,MAX,AliConfig::fgkDefaultEventFolderName); ofstream out("good_tracks_its"); if (out) { for (Int_t ngd=0; ngdSetTextSize(0.05); text->Draw(); +// PH taken from v3-09-09, but not used +// TCanvas *c2=new TCanvas("c2","",320,32,530,590); +// TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw(); +// p6->cd(); p6->SetFillColor(42); p6->SetFrameFillColor(10); +// he->SetFillColor(2); he->SetFillStyle(3005); +// he->SetXTitle("Arbitrary Units"); +// he->Fit("gaus"); c2->cd(); - TCanvas *c2=new TCanvas("c2","",320,32,530,590); - - TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw(); - p6->cd(); p6->SetFillColor(42); p6->SetFrameFillColor(10); - he->SetFillColor(2); he->SetFillStyle(3005); - he->SetXTitle("Arbitrary Units"); - he->Fit("gaus"); c2->cd(); - - TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw(); - p7->cd(); p7->SetFillColor(42); p7->SetFrameFillColor(10); - hep->SetXTitle("p (Gev/c)"); hep->SetYTitle("dE/dX (Arb. Units)"); - hep->Draw(); c1->cd(); - +// TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw(); +// p7->cd(); p7->SetFillColor(42); p7->SetFrameFillColor(10); +// hep->SetXTitle("p (Gev/c)"); hep->SetYTitle("dE/dX (Arb. Units)"); +// hep->Draw(); c1->cd(); + return 0; } -Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) { - if (gAlice) {delete gAlice; gAlice=0;} +Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const char* evfoldname) { + + Int_t nt=0; + + AliRunLoader* rl = AliRunLoader::GetRunLoader(evfoldname); + if (rl == 0x0) + { + ::Fatal("AliTPCComparison.C::good_tracks_its", + "Can not find Run Loader in Folder Named %s", + evfoldname); + } + + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsl == 0x0) + { + cerr<<"AliITSComparisonV2.C : Can not find TPCLoader\n"; + delete rl; + return 3; + } + + rl->LoadgAlice(); + rl->LoadHeader(); + Int_t np = rl->GetHeader()->GetNtrack(); - TFile *file=TFile::Open("galice.root"); - if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);} - if (!(gAlice=(AliRun*)file->Get("gAlice"))) { - cerr<<"gAlice have not been found on galice.root !\n"; - exit(5); - } - Int_t np=gAlice->GetEvent(event); Int_t *good=new Int_t[np]; Int_t k; for (k=0; kGetDetector("ITS"); + AliITS *ITS=(AliITS*)rl->GetAliRun()->GetDetector("ITS"); if (!ITS) { cerr<<"can't get ITS !\n"; exit(8); } @@ -319,12 +356,8 @@ Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) { cerr<<"can't get ITS geometry !\n"; exit(9); } - TFile *cf=TFile::Open("AliITSclustersV2.root"); - if (!cf->IsOpen()){ - cerr<<"Can't open AliITSclustersV2.root !\n"; exit(6); - } - char cname[100]; sprintf(cname,"TreeC_ITS_%d",event); - TTree *cTree=(TTree*)cf->Get(cname); + itsl->LoadRawClusters(); + TTree *cTree=itsl->TreeC(); if (!cTree) { cerr<<"Can't get cTree !\n"; exit(7); } @@ -355,19 +388,28 @@ Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) { } } clusters->Delete(); delete clusters; - delete cTree; //Thanks to Mariana Bondila - cf->Close(); - + itsl->UnloadRawClusters(); + ifstream in("good_tracks_tpc"); if (!in) { cerr<<"can't get good_tracks_tpc !\n"; exit(11); } + + rl->LoadKinematics(); + AliStack* stack = rl->Stack(); Int_t nt=0; Double_t px,py,pz,x,y,z; Int_t code,lab; while (in>>lab>>code>>px>>py>>pz>>x>>y>>z) { if (good[lab] != 0x3F) continue; - TParticle *p = (TParticle*)gAlice->Particle(lab); + TParticle *p = (TParticle*)stack->Particle(lab); + if (p == 0x0) + { + cerr<<"Can not get particle "<GetPdgCode(); //**** px py pz - in global coordinate system @@ -379,8 +421,9 @@ Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) { delete[] good; - delete gAlice; gAlice=0; - file->Close(); + rl->UnloadKinematics(); + rl->UnloadHeader(); + rl->UnloadgAlice(); return nt; } diff --git a/ITS/AliITSDetType.cxx b/ITS/AliITSDetType.cxx index 16af344d3ca..4ae07d949ea 100644 --- a/ITS/AliITSDetType.cxx +++ b/ITS/AliITSDetType.cxx @@ -13,37 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.10 2002/10/14 14:57:00 hristov - Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ - Revision 1.8.8.1 2002/06/10 17:51:14 hristov - Merged with v3-08-02 - - Revision 1.9 2002/05/05 21:10:10 nilsen - In Distructor, delete fResponse. Since AliITSDetType is supposed to own it - it should delete it. - - Revision 1.8 2001/10/04 22:40:15 nilsen - Cosmetic changes. - - Revision 1.7 2001/09/07 14:43:15 hristov - Destructor reverted after a temporary fix - - Revision 1.6 2001/09/07 08:44:43 hristov - Deletion commented out because AliITSDetType was not the owner - - Revision 1.5 2001/05/31 06:58:38 fca - Patch problem with destructor - - Revision 1.4 2001/05/01 14:47:45 nilsen - Fixed destructor so that it destroyes the pointers fSegmentation, fResponse, - fSimulation, and fReconst if they have been allocated. The two TStrings - fDigClassName and fClustClassName shoud be destroyed automaticaly. This should - fix a small memory leak associated with digitization and reconstruction. - -*/ //////////////////////////////////////////////////////////////////////// // This Class owns the classes needed to to detector simulations and // reconstruction. This includes the detector segmentation classes, diff --git a/ITS/AliITSDigitizer.cxx b/ITS/AliITSDigitizer.cxx index aeca0f4a010..c1fb2b47ca6 100644 --- a/ITS/AliITSDigitizer.cxx +++ b/ITS/AliITSDigitizer.cxx @@ -13,67 +13,33 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2003/03/03 17:00:30 masera -Corrections to comply with coding conventions +/* $Id$ */ -Revision 1.7 2002/10/25 18:54:22 barbera -Various improvements and updates from B.S.Nilsen and T. Virgili - -Revision 1.6 2002/10/22 14:45:34 alibrary -Introducing Riostream.h - -Revision 1.5 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.3.4.1 2002/06/10 17:51:14 hristov -Merged with v3-08-02 - -Revision 1.4 2002/04/24 22:08:12 nilsen -New ITS Digitizer/merger with two macros. One to make SDigits (old way) and -one to run the merger (modified for Jiri). - -Revision 1.3 2002/03/25 10:48:55 nilsen -New ITS SDigit merging with region of interest cut. Update for changes in -AliDigitizer. Additional optimization should be done. - -Revision 1.2 2002/03/15 17:26:40 nilsen -New SDigit version of ITS Digitizer. - -Revision 1.1 2001/11/27 16:27:28 nilsen -Adding AliITSDigitizer class to do merging and digitization . Based on the -TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h -file. The following files required minor changes. AliITS, added functions -SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD. -AliITSsimulationSDD.cxx needed a Tree independent way of returning back to -the original Root Directory in function Compress1D. Now it uses gDirectory. - -Revision 1.2 2002/03/01 E. Lopez -Digitization changed to start from SDigits instead of Hits. -The SDigits are reading as TClonesArray of AliITSpListItem -*/ +//Piotr.Skowronski@cern.ch : +//Corrections applied in order to compile (only) with new I/O and folder structure +//To be implemented correctly by responsible // // Class used to steer // the digitization for ITS // // + #include #include -#include +#include #include #include #include +#include +#include #include - #include "AliITSDigitizer.h" -#include "AliITSgeom.h" #include "AliITSpList.h" +#include "AliITSgeom.h" #include "AliITSsimulation.h" #include "AliITSDetType.h" - ClassImp(AliITSDigitizer) //______________________________________________________________________ @@ -159,22 +125,6 @@ Bool_t AliITSDigitizer::Init(){ } // end if // fModActive needs to be set to a default all kTRUE value for(Int_t i=0;iGetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE; -/* This will not work from Init. ts is aways returned as zero. - TTree *ts; - if(fRoif>=0 && fRoiifile>=0 && fRoiifileGetNinputs()){ - ts = GetManager()->GetInputTreeS(fRoiifile); - if(!ts){ - if(!gAlice) ts = gAlice->TreeS(); - if(!ts){ - cout <<"The TTree TreeS needed to set by region not found." - " No region of interest cut will be applied."<< endl; - return fInit; - } // end if - } // end if - cout << "calling SetByReionOfInterest ts="<< ts <GetOutputFolderName()); + if ( outRL == 0x0) + { + Error("Exec","Can not get Output Run Loader"); + return; + } + outRL->GetEvent(event); + outgime = outRL->GetLoader(loadname); + if ( outgime == 0x0) + { + Error("Exec","Can not get Output ITS Loader"); + return; + } + outgime->LoadDigits("update"); + if (outgime->TreeD() == 0x0) outgime->MakeTree("D"); + // Digitize - fITS->MakeBranchInTreeD(GetManager()->GetTreeD()); + fITS->MakeBranchInTreeD(outgime->TreeD()); if(fRoif!=0) Info("AliITSDigitizer","Region of Interest digitization selected"); else Info("AliITSDigitizer","No Region of Interest selected. Digitizing everything"); //cout <<"fModActive="<InitSimulationModule(module, event); //cout << "Module=" << module; - for(ifiles=0; ifilesGetEvent( module ); lmod = sim->AddSDigitsToModule(sdig,mask); - if(ifiles==0){ - fModActive[module] = lmod; - } // end if - //cout << " fModActive["<Digits sim->FinishSDigitiseModule(); // fills all branches - wasted disk space - GetManager()->GetTreeD()->Fill(); + outgime->TreeD()->Fill(); fITS->ResetDigits(); } // end for module - //cout << "end modules loop"<GetTreeD()->AutoSave(); + outgime->TreeD()->AutoSave(); + outgime->WriteDigits("OVERWRITE"); + outgime->UnloadDigits(); + + for(ifiles=0; ifilesGetInputFolderName(fl[ifiles])); + ingime = inRL->GetLoader(loadname); + ingime->UnloadSDigits(); + } delete[] fl; sdig->Clear(); @@ -311,27 +307,27 @@ void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){ //cout << "Region of Interest ts="<GetITSgeom()->GetIndexMax(); for(m=0;mClear(); diff --git a/ITS/AliITSDigits2RecPoints.C b/ITS/AliITSDigits2RecPoints.C index 4c2c1c1d50a..eaf6b164605 100644 --- a/ITS/AliITSDigits2RecPoints.C +++ b/ITS/AliITSDigits2RecPoints.C @@ -11,162 +11,31 @@ #include "TStopwatch.h" #endif - -TFile* AccessFile(TString inFile="galice.root", TString acctype="R"); -void writeAR(TFile * fin, TFile *fou); -Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt=""); #define DEBUG -Int_t AliITSDigits2RecPoints(TString digFile="galice.root", - TString recFile="galice.root",TString opt=""){ +Int_t AliITSDigits2RecPoints(TString filename="galice.root"){ // Standard ITS Digits to RecPoints. // Dynamically link some shared libs if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); - } // end if - - // Connect the Root Galice file containing Geometry, Kine and Hits - - TFile *digfile = 0; // pointer to input file. - TFile *recfile = 0; // possible output file for TreeD - if(recFile.CompareTo(digFile) == 0) { //write output to same file as input. - digfile = AccessFile(digFile,"U"); // input file open for update. - }else{ // different output file then input file. - digfile = AccessFile(digFile,"R"); // input file open as read only - recfile = new TFile(recFile,"NEW"); - } // end if sdigFile == hitFile. -/* - AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); - if (!ITS) { - cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file" - << endl; - return 3; - } // end if !ITS - if(!(ITS->GetITSgeom())){ - cerr << " AliITSgeom not found. Can't digitize with out it." << endl; - return 4; - } // end if - - ChangeITSDefaults(digfile,ITS,opt); -*/ - // write the AliRun object to the output file if different from input file. - if(recfile) writeAR(digfile,recfile); - if(recfile){ recfile->Close(); recfile = 0;} -// if(digfile){ digfile->Close(); digfile = 0;} -// delete gAlice; -// gAlice = 0; + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + }else if (gAlice){ + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } // end if TStopwatch timer; - #ifdef DEBUG cout << "Creating reconstructed points from digits for the ITS..." << endl; #endif -// const char *nulptr=0; - AliITSreconstruction *itsr = new AliITSreconstruction(gAlice); - if(digFile.CompareTo(recFile)!=0) { -#ifdef DEBUG - cout << itsr << " filename=" << recFile << " compare="<< - digFile.CompareTo(recFile) << endl; -#endif - itsr->SetOutputFile(recFile); - } // end if + AliITSreconstruction *itsr = new AliITSreconstruction(filename); + timer.Start(); itsr->Init(); itsr->Exec(); timer.Stop(); timer.Print(); delete itsr; - delete gAlice; - gAlice = 0; - if(digfile){ digfile->Close(); digfile = 0;} - if(recfile){ recfile->Close(); recfile = 0;} return 0; } -//______________________________________________________________________ -TFile * AccessFile(TString FileName, TString acctype){ - // Function used to open the input file and fetch the AliRun object - - TFile *retfil = 0; - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName); - if(file) file->Close(); - if(acctype.Contains("U")){ - file = new TFile(FileName,"UPDATE"); - } // end if open for update - if(acctype.Contains("N") && !file){ - file = new TFile(FileName,"RECREATE"); - } // end if open a new file - if(!file) file = new TFile(FileName,"READ"); // default readonly - if (!file->IsOpen()) { - cerr << "Can't open " << FileName << " !" << endl; - return retfil; - } // end if error opeing file - - // Get AliRun object from file or return if not on file - if (gAlice) {delete gAlice; gAlice = 0;} - gAlice = (AliRun*)file->Get("gAlice"); - if (!gAlice) { - cerr << "AliRun object not found on file "<< FileName << "!" << endl; - file->Close(); // close file and return error. - return retfil; - } // end if !gAlice - return file; -} -//______________________________________________________________________ -void writeAR(TFile * fin, TFile *fou) { - TDirectory *current = gDirectory; -/* - TTree *TeOld; - TTree *TeNew; - AliHeader *alhe = new AliHeader(); - TeOld = (TTree*)fin->Get("TE"); - TeOld->SetBranchAddress("Header",&alhe); - TeOld->SetBranchStatus("*",1); - fou->cd(); - TeNew = TeOld->CloneTree(); - TeNew->Write(0,TObject::kOverwrite); -*/ - fou->cd(); - gAlice->TreeE()->SetBranchStatus("*",1); - gAlice->TreeE()->Write(0,TObject::kOverwrite); - gAlice->Write(0,TObject::kOverwrite); - current->cd(); -// delete alhe; -#ifdef DEBUG - cout << "AliRun object written to file" << endl; -#endif -} -//______________________________________________________________________ -Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){ - - TDatime *ct0 = new TDatime(2002,04,26,00,00,00); - TDatime ct = hitfile->GetCreationDate(); - - if(ct0->GetDate()>ct.GetDate()){ - // For old files, must change SDD noise. - AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)-> - GetResponseModel(); - resp1 = new AliITSresponseSDD(); - ITS->SetResponseModel(1,resp1); - cout << "Changed response class for SDD:" << endl; - resp1->Print(); - } // end if - - if(opt.Contains("Dubna")){ - AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna(); - if(ITS->DetType(0)->GetResponseModel() !=0){ - delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel()); - ITS->DetType(0)->ResponseModel(0); - } // end if - ITS->DetType(0)->ResponseModel(resp0); - AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS-> - DetType(0)->GetSegmentationModel(); - AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0, - resp0); - if(ITS->DetType(0)->GetSimulationModel() !=0){ - delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel()); - ITS->DetType(0)->SimulationModel(0); - } // end if - ITS->DetType(0)->SimulationModel(sim0); - } // end if Dubna -} diff --git a/ITS/AliITSDumpVertices.C b/ITS/AliITSDumpVertices.C index 5a6303ea326..b6a8cace4e8 100644 --- a/ITS/AliITSDumpVertices.C +++ b/ITS/AliITSDumpVertices.C @@ -1,13 +1,13 @@ void AliITSDumpVertices(Int_t firstEv=0, Int_t noev=1, - TString fileimp="AliITSVertices.root", - TString objbasename="Vertex_"){ + TString fileimp="galice.root"){ // This is a simple example on how to access the vertex objects Int_t evmax = firstEv+noev; - TFile *file = new TFile(fileimp); + AliRunLoader *rl = AliRunLoader::Open(fileimp.Data()); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + ITSloader->LoadVertices(); for(Int_t i=firstEv; iGet(name.Data()); + rl->GetEvent(i); + AliITSVertex *vert = ITSloader->GetVertex(); if(vert){ cout <<"===============================================\n"; cout <<" Event n. "< #include +#include +#include #include #include "AliITSFDigitizer.h" @@ -105,22 +113,55 @@ void AliITSFDigitizer::Exec(Option_t* opt){ // AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints(); + AliRunLoader* outrl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + if (outrl == 0x0) + { + Error("Exec","Can not find Run Loader in output folder."); + return; + } + + AliLoader* outgime = outrl->GetLoader("ITSLoader"); + if (outgime == 0x0) + { + Error("Exec","Can not get TOF Loader from Output Run Loader."); + return; + } + + TTree* outputTreeR = outgime->TreeR(); + if (outputTreeR == 0x0) + { + outgime->MakeTree("R"); + outputTreeR = outgime->TreeR(); + } - TTree *outputTreeR = fManager->GetTreeR(); TClonesArray *recPoints = fITS->RecPoints(); // TBranch *branch = - fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF", - &recPoints,4000,0); + fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",&recPoints,4000,0); Int_t nModules; fITS->InitModules(-1,nModules); // load hits into modules + for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++) + { + AliRunLoader* rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iFile)); + if (rl == 0x0) + { + Error("Exec","Can not find Run Loader in input %d folder.",iFile); + return; + } - for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++) { - fITS->FillModules(fManager->GetInputTreeH(iFile), - fManager->GetMask(iFile)); - } + AliLoader* gime = rl->GetLoader("ITSLoader"); + if (gime == 0x0) + { + Error("Exec","Can not get TOF Loader from Input %d Run Loader.",iFile); + return; + } + + gime->LoadHits(); + fITS->FillModules(gime->TreeH(),fManager->GetMask(iFile)); + gime->UnloadHits(); + } // transform hits to fast rec points @@ -131,7 +172,7 @@ void AliITSFDigitizer::Exec(Option_t* opt){ outputTreeR->Fill(); fITS->ResetRecPoints(); } - outputTreeR->AutoSave(); - + outrl->WriteRecPoints("OVERWRITE"); +// outputTreeR->AutoSave(); } //////////////////////////////////////////////////////////////////////// diff --git a/ITS/AliITSFindClustersV2.C b/ITS/AliITSFindClustersV2.C index 9521a59e4bc..aba52f2e7a1 100644 --- a/ITS/AliITSFindClustersV2.C +++ b/ITS/AliITSFindClustersV2.C @@ -1,57 +1,223 @@ -/**************************************************************************** - * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * - ****************************************************************************/ +/**************************************************************** +* This macro converts AliITSRecPoint(s) to AliITSclusterV2(s) * +* Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * +*****************************************************************/ #ifndef __CINT__ - #include + #include #include "AliRun.h" + #include "AliRunLoader.h" + #include "AliLoader.h" #include "AliITS.h" #include "AliITSgeom.h" #include "AliITSclustererV2.h" - #include "TFile.h" #include "TStopwatch.h" #endif -Int_t AliITSFindClustersV2(Char_t SlowOrFast='s',Int_t eventn=1) { +Int_t AliITSFindClustersV2(Char_t SlowOrFast='f') +{ - cerr<<"Looking for clusters...\n"; + cerr<<"AliITSRecPoint(s) -> AliITSclusterV2(s)...\n"; + + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } + + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : Can not open session RL=NULL" + << endl; + return 3; + } + + Int_t retval = rl->LoadgAlice(); + if (retval) + { + cerr<<"AliITSHits2DigitsDefault.C : LoadgAlice returned error" + << endl; + delete rl; + return 3; + } + gAlice=rl->GetAliRun(); + rl->LoadHeader(); + retval = rl->LoadKinematics(); + if (retval) + { + cerr<<"AliITSHits2DigitsDefault.C : LoadKinematics returned error" + << endl; + delete rl; + return 3; + } + + AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (gime == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : can not get ITS loader" + << endl; + } - TFile *in=TFile::Open("galice.root"); - if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;} - if (!(gAlice=(AliRun*)in->Get("gAlice"))) { - cerr<<"Can't find gAlice !\n"; - return 2; - } - AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); - if (!ITS) { cerr<<"Can't find the ITS !\n"; return 3; } + rl->GetEvent(0); + AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); + if (!ITS) { cerr<<"Can't find the ITS !\n"; delete rl; return 3; } AliITSgeom *geom=ITS->GetITSgeom(); + + TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000); + + gime->LoadRawClusters("recreate"); - TFile *out=TFile::Open("AliITSclustersV2.root","new"); - if (!out->IsOpen()) { - cerr<<"Delete old AliITSclustersV2.root !\n"; return 1;} - geom->Write(); - - TStopwatch timer; - AliITSclustererV2 clusterer(geom); - for (Int_t i=0; iGetEvent(i); - //ITS->MakeTreeC(); //To make the V1 cluster finders happy - clusterer.SetEvent(i); - if (SlowOrFast=='s') clusterer.Digits2Clusters(in,out); - else clusterer.Hits2Clusters(in,out); - } - timer.Stop(); timer.Print(); + if (SlowOrFast=='f') + { + gime->SetRecPointsFileName("ITS.FastRecPoints.root"); + } + if (gime->LoadRecPoints()) + { + cerr<<"Load Rec Pints returned error !\n"; + delete rl; + return 4; + } + + TClonesArray *points = new TClonesArray("AliITSRecPoint",10000); + + Float_t lp[5]; + Int_t lab[6]; + + Int_t iEvent; + for (iEvent = 0; iEvent< rl->GetNumberOfEvents() ; iEvent++) + { + + rl->GetEvent(iEvent); + + TTree *cTree = gime->TreeC(); + if (cTree == 0x0) + { + gime->MakeTree("C"); + cTree = gime->TreeC(); + } + + cTree->Branch("Clusters",&clusters); + + TTree *pTree=gime->TreeR(); + if (pTree == 0x0) + { + cerr<<"Can not get TreeR !\n"; delete rl;return 5; + } + TBranch *branch = 0; + if (SlowOrFast=='f') { + branch = pTree->GetBranch("ITSRecPointsF"); + } + else { + branch = pTree->GetBranch("ITSRecPoints"); + } + if (!branch) + { + cerr<<"Can't get ITSRecPoints branch !\n"; + delete rl; + return 6; + } + + branch->SetAddress(&points); + + AliStack* stack = rl->Stack(); + if (stack == 0x0) + { + cerr<<"AliITSFindClustersV2.C : Can not get stack" + << endl; + delete rl; + return 3; + } + + TClonesArray &cl=*clusters; + Int_t nclusters=0; + Int_t nentr=(Int_t)branch->GetEntries(); + + cerr<<"Number of entries: "<Clear(); + clusters->Clear(); + branch->GetEvent(i); + Int_t ncl=points->GetEntriesFast(); if (ncl==0){cTree->Fill();continue;} + Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det); + if ( (lay<0) || (lad<0) || (det<0)) + { + ::Error("AliITSFindClustersV2.C","No such a module %d",i); + continue; + } + Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift); + Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot); + Double_t yshift = x*rot[0] + y*rot[1]; + Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1); + nclusters+=ncl; + + Float_t kmip=1; // ADC->mip normalization factor for the SDD and SSD + if(lay==4 || lay==3){kmip=280.;}; + if(lay==6 || lay==5){kmip=38.;}; + + for (Int_t j=0; jUncheckedAt(j); + //Float_t lp[5]; + lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0]; + lp[1]=p->GetZ()+zshift; + lp[2]=p->GetSigmaX2(); + lp[3]=p->GetSigmaZ2(); + lp[4]=p->GetQ(); lp[4]/=kmip; + //Int_t lab[6]; + lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2); + lab[3]=ndet; - delete gAlice; gAlice=0; - out->Close(); - in->Close(); + Int_t label=lab[0]; + if (label>=0) { + TParticle *part=(TParticle*)stack->Particle(label); + if (part == 0x0) + cerr<<"Can not get particle with label "<P() < 0.005) { + Int_t m=part->GetFirstMother(); + if (m<0) {cerr<<"Primary momentum: "<P()<Particle(label); + } + if (lab[1]<0) lab[1]=label; + else if (lab[2]<0) lab[2]=label; + else cerr<<"No empty labels !\n"; + } + new(cl[j]) AliITSclusterV2(lab,lp); + } + cTree->Fill(); +// clusters->Delete(); points->Delete(); + } + gime->WriteRawClusters("OVERWRITE"); + cerr<<"Number of clusters: "< +#include +#include +#include +#include +#include +#include +#include +#include +#include -void AliITSFindPrimaryVertex(Int_t evNumber1=0,Int_t evNumber2=0, const char *filename="galice.root") { +#endif - - ///////////////// Dynamically link some shared libs ///////////////////// +void AliITSFindPrimaryVertex(Int_t evNumber1=0,Int_t NumbofEv=1, const char *filename="galice.root") { + + Int_t evNumber2 = evNumber1+NumbofEv; if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); + gROOT->Macro("loadlibs.C"); } else { - delete gAlice; - gAlice=0; + if(gAlice){ + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } } -// Connect the Root Galice file containing Geometry, Kine and Hits - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); - if (!file) file = new TFile(filename); - - -// Get AliRun object from file - if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) { - printf("AliRun object found on file\n"); - } - else { - printf("AliRun object not found - nothing done\n"); - return; - } - } - - // Open output file for vertices and Create vertexer - TFile *filou = new TFile("vertices.root","recreate"); - AliITSVertexerIons *vertexer = new AliITSVertexerIons(file,filou); - AliITSVertex *V; -// Loop over events -// - Int_t Nh=0; - Int_t Nh1=0; - for (int nev=0; nev<= evNumber2; nev++) { - gAlice->SetEvent(nev); - Int_t nparticles = gAlice->GetEvent(nev); - cout << "nev " << nev <LoadHeader(); + if (retval){ + cerr<<"AliITSFindPrimaryVertex.C : LoadHeader returned error"<LoadKinematics(); + if (retval){ + cerr<<"AliITSFindPrimaryVertex.C : LoadKinematics returned error"<FindVertexForCurrentEvent(i); + // Open output file for vertices (default name: ITS.Vertex.root + // and Create vertexer + AliITSVertexerIons *vertexer = new AliITSVertexerIons("default"); + AliITSVertex *V; + // Loop over events + // + + for (int nev=evNumber1; nev< evNumber2; nev++) { + cout<<"=============================================================\n"; + cout<<" Processing event "<GetEvent(nev); + cout << "nev " << nev <GetHeader(); + AliGenEventHeader* genEventHeader = header->GenEventHeader(); + TArrayF primaryVertex(3); + genEventHeader->PrimaryVertex(primaryVertex); + + TStopwatch timer; + timer.Start(); - timer.Stop(); - timer.Print(); + V=vertexer->FindVertexForCurrentEvent(nev); + if(V){ + Double_t pos[3]; + for(Int_t kk=0;kk<3;kk++)pos[kk]=(Double_t)primaryVertex[kk]; + V->SetTruePos(pos); + } + timer.Stop(); + timer.Print(); - cout << endl << "Xv = " << V->GetXv() << " cm" << endl; - cout << "X resolution = " << V->GetXRes()*10000 << " microns" << endl; - cout << "Signal/Noise for X = " << V->GetXSNR() << endl; - cout << endl << "Yv = " << V->GetYv() << " cm" << endl; - cout << "Y resolution = " << V->GetYRes()*10000 << " microns" << endl; - cout << "Signal/Noise for Y = " << V->GetYSNR() << endl; - cout << endl << "Zv = " << V->GetZv() << " cm" << endl; - cout << "Z Resolution = " << V->GetZRes()*10000 << " microns" << endl; - cout << "Signal/Noise for Z = " << V->GetZSNR() <GetRunLoader(); + delete gAlice; + gAlice=0; + } + + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : Can not open session RL=NULL" + << endl; + return 3; + } + + Int_t retval = rl->LoadgAlice(); + if (retval) + { + ::Error("AliITSHits2DigitsDefault.C","LoadgAlice returned error"); + delete rl; + return 3; + } + retval = rl->LoadHeader(); + if (retval) + { + ::Error("AliITSHits2DigitsDefault.C","LoadHeader returned error"); + delete rl; + return 3; + } + gAlice=rl->GetAliRun(); + + + AliITSLoader* itsloader = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsloader == 0x0) + { + ::Error("AliITSHits2DigitsDefault.C","can not get ITS loader"); + return 4; + } - TFile *out=TFile::Open("AliITStracksV2.root","new"); - if (!out->IsOpen()) {cerr<<"Delete old AliITStracksV2.root !\n"; return 1;} + AliLoader* tpcloader = rl->GetLoader("TPCLoader"); + if (tpcloader == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : can not get TPC loader" + << endl; + } - TFile *in=TFile::Open("AliTPCtracks.root"); - if (!in->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 2;} + rl->GetEvent(0); - TFile *file=TFile::Open("AliITSclustersV2.root"); - if (!file->IsOpen()) {cerr<<"Can't open AliITSclustersV2.root !\n";return 3;} + itsloader->LoadTracks("recreate"); + tpcloader->LoadTracks("read"); + itsloader->LoadRawClusters("read"); - AliITSgeom *geom=(AliITSgeom*)file->Get("AliITSgeom"); - if (!geom) {cerr<<"Can't get AliITSgeom !\n"; return 4;} + AliITS* dITS = (AliITS*)gAlice->GetDetector("ITS"); + if(!dITS) + { + ::Error("AliITSHits2DigitsDefault.C","Can not find ITS detector."); + return 6; + } // end if !fITS - Int_t rc=0; - TStopwatch timer; - AliITStrackerV2 tracker(geom); - for (Int_t i=0; iGetITSgeom(); + if(geom == 0x0) + { + ::Error("AliITSHits2DigitsDefault.C","Can not get geometry from ITS detector."); + return 6; + } // end if !GetITSgeom() - file->Close(); - in->Close(); - out->Close(); + TStopwatch timer; + + for (Int_t i = 0;i < rl->GetNumberOfEvents(); i++) + { + AliITStrackerV2* tracker = new AliITStrackerV2(geom,i); + Int_t rc=tracker->Clusters2Tracks(); + if (rc) + { + ::Error("AliITSHits2DigitsDefault.C", + "AliITStrackerV2::Clusters2Tracks returned errror for event %d",i); + delete tracker; + break; + } + } + timer.Stop(); timer.Print(); + delete tracker; + delete rl; return rc; } diff --git a/ITS/AliITSGeoPlot.C b/ITS/AliITSGeoPlot.C index d571c045534..db6662cfff4 100644 --- a/ITS/AliITSGeoPlot.C +++ b/ITS/AliITSGeoPlot.C @@ -1,5 +1,5 @@ #if !defined(__CINT__) || defined(__MAKECINT__) -#include +#include #include #include #include @@ -24,12 +24,15 @@ #include #include #include +#include +#include +#include #endif void GetHitsCoor(TObject *its, Int_t mod, TObjArray & histos, Int_t subd,Bool_t verb); Int_t GetRecCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb); void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, Int_t mod, Bool_t verbose, TObjArray & histos); -Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+Rec", char *filename="galice.root",TString FileDigits="galice.root", TString FileRec="galice.root", Int_t isfastpoints = 0) { +Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+Rec", char *filename="galice.root", Int_t isfastpoints = 0) { /******************************************************************* * This macro displays geometrical information related to the * hits, digits and rec points in ITS. @@ -51,12 +54,7 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+Rec", char *filename="galice * .x AliITSGeoPlot(); (All subdetectors; no-verbose; no-recpoints) * .x AliITSGeoPlot("SPD+SSD+Verbose+Rec"); * - * filename: It's "galice.root" by default. Hits, kine and the - * AliRun object are supposed to be stored on this file - * FileDigits: It's "galice.root" by defaults. It is the file where - * digits are stored - * FileRec: It's "galice.root" by defaults. It is the file where - * recpoints are stored + * filename: It's "galice.root" by default. * isfastpoints: integer. It is set to 0 by defaults. This means that * slow reconstruction is assumed. If fast recpoint are in * in use, isfastpoints must be set =1. @@ -83,7 +81,7 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+Rec", char *filename="galice * --- AliITSGeoPlot(); * * M.Masera 14/05/2001 18:30 - * Last rev. 05/06/2002 + * Last rev. 09/06/2003 17:00 (Adapted to NewIO) m.m. ********************************************************************/ //Options @@ -100,38 +98,47 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+Rec", char *filename="galice else { #endif if(gAlice){ + delete gAlice->GetRunLoader(); delete gAlice; gAlice=0; } #if !(!defined(__CINT__) || defined(__MAKECINT__)) } #endif - // Connect the Root input file containing Geometry, Kine and Hits - // galice.root file by default - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); - if (!file) file = new TFile(filename); - file->ls(); - - // Get AliRun object from file - - if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice && verbose)cout<<"AliRun object found on file "<SetTreeDFileName(FileDigits); - } - if(!(FileRec.Data() == filename)){ - gAlice->SetTreeRFileName(FileRec); - } - Int_t nparticles = gAlice->GetEvent(evesel); +AliRunLoader* rl = AliRunLoader::Open(filename); + if (rl == 0x0){ + cerr<<"AliITSGeoPlot.C : Can not open session RL=NULL"<< endl; + return -1; + } + Int_t retval = rl->LoadgAlice(); + if (retval){ + cerr<<"AliITSGeoPlot.C : LoadgAlice returned error"<GetAliRun(); + + retval = rl->LoadHeader(); + if (retval){ + cerr<<"AliITSGeoPlot.C : LoadHeader returned error"<GetLoader("ITSLoader"); + + if(!ITSloader){ + cerr<<"AliITSGeoPlot.C : ITS loader not found"<LoadHits("read"); + ITSloader->LoadDigits("read"); + if(isfastpoints==1)ITSloader->SetRecPointsFileName("ITS.FastRecPoints.root"); + ITSloader->LoadRecPoints("read"); + rl->GetEvent(evesel); + Int_t nparticles = rl->GetHeader()->GetNtrack(); + AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); + ITS->SetTreeAddress(); if(verbose) { cout<<" "<InitModules(-1,nmodules); cout<<"Number of ITS modules= "<TreeD(); + TTree *TD = ITSloader->TreeD(); //RECPOINTS - TTree *TR = gAlice->TreeR(); + TTree *TR = ITSloader->TreeR(); TClonesArray *ITSrec = ITS->RecPoints(); TBranch *branch = 0; if(userec && TR && ITSrec){ if(isfastpoints==1){ - branch = gAlice->TreeR()->GetBranch("ITSRecPointsF"); + branch = ITSloader->TreeR()->GetBranch("ITSRecPointsF"); cout<<"using fast points\n"; } else { - branch = gAlice->TreeR()->GetBranch("ITSRecPoints"); + branch = ITSloader->TreeR()->GetBranch("ITSRecPoints"); } if(branch)branch->SetAddress(&ITSrec); } @@ -563,23 +569,3 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In } // loop on digits for this module } // if(ndigits>0.... } - - - - - - - - - - - - - - - - - - - - diff --git a/ITS/AliITSGeometrySDDCone.cxx b/ITS/AliITSGeometrySDDCone.cxx index 6bfb8bb7c95..c3ce89ea962 100644 --- a/ITS/AliITSGeometrySDDCone.cxx +++ b/ITS/AliITSGeometrySDDCone.cxx @@ -15,6 +15,13 @@ /* $Log$ +Revision 1.1.2.1 2003/05/19 16:24:39 hristov +Merging with v3-09-09 (partial, AliITCclustererV2 is excluded from compilation and has to be adapted to NewIO, AliITStrackerV2 needs additional changes) + +Revision 1.1 2003/03/25 23:27:19 nilsen +ITS new Geometry files. Not yet ready for uses, committed to allow additional +development. + $Id$ */ diff --git a/ITS/AliITSGeometrySSDCone.cxx b/ITS/AliITSGeometrySSDCone.cxx index 8bca77c18cd..7c0d52510ee 100644 --- a/ITS/AliITSGeometrySSDCone.cxx +++ b/ITS/AliITSGeometrySSDCone.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.4.2.1 2003/05/19 16:24:39 hristov +Merging with v3-09-09 (partial, AliITCclustererV2 is excluded from compilation and has to be adapted to NewIO, AliITStrackerV2 needs additional changes) + +Revision 1.4 2003/04/22 20:41:08 nilsen +Finished geometry objects defninistions, and fixed bugs in SSD cone geometry. + Revision 1.3 2003/04/17 22:29:23 nilsen Geometry bug fixes and the like. Work still progressing. diff --git a/ITS/AliITSHits2FastRecPoints.C b/ITS/AliITSHits2FastRecPoints.C index d5d3eec6c54..d3e75048b76 100644 --- a/ITS/AliITSHits2FastRecPoints.C +++ b/ITS/AliITSHits2FastRecPoints.C @@ -1,6 +1,4 @@ -TFile* AccessFile(TString inFile="galice.root", TString acctype="R"); - -void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", TString outFile="galice.root", Int_t nsignal=25, Int_t size=-1) +void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", Int_t nsignal=25, Int_t size=-1) { ///////////////////////////////////////////////////////////////////////// // @@ -8,33 +6,68 @@ void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFi // ///////////////////////////////////////////////////////////////////////// + // Dynamically link some shared libs if (gClassTable->GetID("AliRun") < 0) { gROOT->LoadMacro("loadlibs.C"); loadlibs(); - } else { - delete gAlice; - gAlice=0; + } else if (gAlice){ + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; } // Connect the Root Galice file containing Geometry, Kine and Hits - TFile *file; - if(outFile.Data() == inFile.Data()){ - file = AccessFile(inFile,"U"); - } - else { - file = AccessFile(inFile); - } - - TFile *file2 = 0; // possible output file for TreeR - if(!(outFile.Data() == inFile.Data())){ - // open output file and create TreeR on it - file2 = gAlice->InitTreeFile("R",outFile); - } - - AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); - if (!ITS) return; + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + ::Error("AliITSHits2FastRecPoints.C","Can not open session RL=NULL"); + return; + } + + Int_t retval = rl->LoadgAlice(); + if (retval) + { + ::Error("AliITSHits2FastRecPoints.C","LoadgAlice returned error"); + delete rl; + return; + } + gAlice=rl->GetAliRun(); + rl->LoadHeader(); + retval = rl->LoadKinematics(); + if (retval) + { + ::Error("AliITSHits2FastRecPoints.C","LoadKinematics returned error"); + delete rl; + return; + } + + AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (gime == 0x0) + { + ::Error("AliITSHits2FastRecPoints.C","can not get ITS loader"); + delete rl; + return; + } + retval = gime->LoadHits("read"); + if (retval) + { + ::Error("AliITSHits2FastRecPoints.C","LoadHits returned error"); + delete rl; + return; + } + gime->SetRecPointsFileName("ITS.FastRecPoints.root"); + retval = gime->LoadRecPoints("update"); + if (retval) + { + ::Error("AliITSHits2FastRecPoints.C","LoadRecPoints returned error"); + delete rl; + return; + } + + AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); + if (!ITS) return; // Set the simulation model @@ -57,51 +90,19 @@ void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFi Int_t nparticles = gAlice->GetEvent(ev); cout << "event " <SetEvent(ev); - if(!gAlice->TreeR() && file2 == 0) gAlice-> MakeTree("R"); - if(!gAlice->TreeR() && file2 != 0) gAlice->MakeTree("R",file2); + rl->GetEvent(ev); + if(gime->TreeR() == 0x0) gime->MakeTree("R"); + ITS->MakeBranch("RF"); if (ev < evNumber1) continue; if (nparticles <= 0) return; Int_t bgr_ev=Int_t(ev/nsignal); - //printf("bgr_ev %d\n",bgr_ev); timer.Start(); ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," "); timer.Stop(); timer.Print(); } // event loop - delete gAlice; gAlice=0; - file->Close(); + delete rl; } - -//------------------------------------------------------------------- -TFile * AccessFile(TString FileName, TString acctype){ - - // Function used to open the input file and fetch the AliRun object - - TFile *retfil = 0; - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName); - if (file) {file->Close(); delete file; file = 0;} - if(acctype.Contains("U")){ - file = new TFile(FileName,"update"); - } - if(acctype.Contains("N") && !file){ - file = new TFile(FileName,"recreate"); - } - if(!file) file = new TFile(FileName); // default readonly - if (!file->IsOpen()) { - cerr<<"Can't open "<Get("gAlice"); - if (!gAlice) { - cerr << "AliRun object not found on file"<< endl; - return retfil; - } - return file; -} diff --git a/ITS/AliITSHits2SDigits.C b/ITS/AliITSHits2SDigits.C index 58e594c564e..47617ed54d9 100644 --- a/ITS/AliITSHits2SDigits.C +++ b/ITS/AliITSHits2SDigits.C @@ -12,32 +12,44 @@ #endif -TFile* AccessFile(TString inFile="galice.root", TString acctype="R"); -void writeAR(TFile * fin, TFile *fou); -Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt=""); -//#define DEBUG -Int_t AliITSHits2SDigits(TString hitFile = "galice.root", - TString sdigFile = "galice.root",TString opt=""){ +Int_t AliITSHits2SDigits(TString filename = "galice.root") + { // Standeard ITS Hits to SDigits. // Dynamically link some shared libs if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); - } // end if + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } else if (gAlice){ + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } // Connect the Root Galice file containing Geometry, Kine and Hits - TFile *hitfile = 0; // pointer to input file. - TFile *sdigfile = 0; // possible output file for TreeD - if(sdigFile.CompareTo(hitFile) == 0){// write output to same file as input. - hitfile = AccessFile(hitFile,"U"); // input file open for update. - }else{ // different output file then input file. - hitfile = AccessFile(hitFile,"R"); // input file open as read only - // open output file and create TreeR on it - sdigfile = gAlice->InitTreeFile("S",sdigFile); - } // end if sdigFile == hitFile. - + AliRunLoader* rl = AliRunLoader::Open(filename); + if (rl == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : Can not open session RL=NULL" + << endl; + return 3; + } + + Int_t retval = rl->LoadgAlice(); + if (retval) + { + cerr<<"AliITSHits2DigitsDefault.C : LoadgAlice returned error" + << endl; + return 3; + } + gAlice=rl->GetAliRun(); + AliLoader* gime = rl->GetLoader("ITSLoader"); + if (gime == 0x0) + { + cerr<<"AliITSHits2DigitsDefault.C : can not get ITS loader" + << endl; + } AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); if (!ITS) { cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file" @@ -45,128 +57,42 @@ Int_t AliITSHits2SDigits(TString hitFile = "galice.root", return 3; } // end if !ITS if(!(ITS->GetITSgeom())){ - cerr << " AliITSgeom not found. Can't digitize with out it." << endl; - return 4; + cerr << " AliITSgeom not found. Can't digitize with out it." << endl; + return 4; } // end if - ChangeITSDefaults(hitfile,ITS,opt); - // write the AliRun object to the output file if different from input file. - if(sdigfile) writeAR(hitfile,sdigfile); - TStopwatch timer; Int_t evNumber1 = 0; Int_t evNumber2 = gAlice->GetEventsPerRun(); timer.Start(); + retval = gime->LoadHits(); + if (retval) + { + cerr<<"AliITSHits2DigitsDefault.C : ITSLoader::LoadHits returned error" + << endl; + return 3; + } + retval = gime->LoadSDigits("recreate"); + if (retval) + { + cerr<<"AliITSHits2DigitsDefault.C : ITSLoader::LoadSDigits returned error" + << endl; + return 3; + } for(Int_t event = evNumber1; event < evNumber2; event++){ - gAlice->GetEvent(event); - if(!gAlice->TreeS() && sdigfile == 0){ - cout << "Having to create the SDigits Tree." << endl; - gAlice->MakeTree("S"); - } // end if !gAlice->TreeS() - if(sdigfile) gAlice->MakeTree("S",sdigfile); - // make branch - ITS->MakeBranch("S"); - ITS->SetTreeAddress(); -#ifdef DEBUG - cout<<"Making ITS SDigits for event "<Hits2SDigits(); + rl->GetEvent(event); + if(!gime->TreeS()){ + cout << "Having to create the SDigits Tree." << endl; + gime->MakeTree("S"); + } // end + + ITS->MakeBranch("S"); + ITS->SetTreeAddress(); + cout<<"Making ITS SDigits for event "<Hits2SDigits(); } // end for event timer.Stop(); timer.Print(); - if(sdigfile!=0){ - cout << sdigFile << " size =" << sdigfile->GetSize() << endl; - }else{ - cout << hitFile << " size =" << hitfile->GetSize() << endl; - } // end if sdigfile!=0 - - delete gAlice; // sdigfile is closed by deleting gAlice if != hitfile. - gAlice = 0; - hitfile->Close(); hitfile=0; -} -//______________________________________________________________________ -TFile * AccessFile(TString FileName, TString acctype){ - // Function used to open the input file and fetch the AliRun object - - TFile *retfil = 0; - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName); - if(file) { - file->Close(); - delete file; - file = 0; - } // end if file - if(acctype.Contains("U")){ - file = new TFile(FileName,"UPDATE"); - } // end if open for update - if(acctype.Contains("N") && !file){ - file = new TFile(FileName,"RECREATE"); - } // end if open a new file - if(!file) file = new TFile(FileName,"READ"); // default readonly - if (!file->IsOpen()) { - cerr << "Can't open " << FileName << " !" << endl; - return retfil; - } // end if error opeing file - - // Get AliRun object from file or return if not on file - if (gAlice) {delete gAlice; gAlice = 0;} - gAlice = (AliRun*)file->Get("gAlice"); - if (!gAlice) { - cerr << "AliRun object not found on file "<< FileName << "!" << endl; - file->Close(); // close file and return error. - return retfil; - } // end if !gAlice - return file; -} -//______________________________________________________________________ -void writeAR(TFile * fin, TFile *fou) { - TDirectory *current = gDirectory; - TTree *TeOld; - TTree *TeNew; - AliHeader *alhe = new AliHeader(); - TeOld = (TTree*)fin->Get("TE"); - TeOld->SetBranchAddress("Header",&alhe); - TeOld->SetBranchStatus("*",1); - fou->cd(); - TeNew = TeOld->CloneTree(); - TeNew->Write(0,TObject::kOverwrite); - gAlice->Write(0,TObject::kOverwrite); - current->cd(); - delete alhe; -#ifdef DEBUG - cout << "AliRun object written to file" << endl; -#endif -} -//______________________________________________________________________ -Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){ - - TDatime *ct0 = new TDatime(2002,04,26,00,00,00); - TDatime ct = hitfile->GetCreationDate(); - - if(ct0->GetDate()>ct.GetDate()){ - // For old files, must change SDD noise. - AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)-> - GetResponseModel(); - resp1 = new AliITSresponseSDD(); - ITS->SetResponseModel(1,resp1); - cout << "Changed response class for SDD:" << endl; - resp1->Print(); - } // end if - if(opt.Contains("Dubna")){ - AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna(); - if(ITS->DetType(0)->GetResponseModel() !=0){ - delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel()); - ITS->DetType(0)->ResponseModel(0); - } // end if - ITS->DetType(0)->ResponseModel(resp0); - AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS-> - DetType(0)->GetSegmentationModel(); - AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0, - resp0); - if(ITS->DetType(0)->GetSimulationModel() !=0){ - delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel()); - ITS->DetType(0)->SimulationModel(0); - } // end if - ITS->DetType(0)->SimulationModel(sim0); - } // end if Dubna + delete rl; // sdigfile is closed by deleting gAlice if != hitfile. } diff --git a/ITS/AliITSLoader.cxx b/ITS/AliITSLoader.cxx new file mode 100644 index 00000000000..f93a34b4db6 --- /dev/null +++ b/ITS/AliITSLoader.cxx @@ -0,0 +1,81 @@ +#include "AliITSLoader.h" +#include + +#include +#include + +const TString AliITSLoader::fgkDefaultRawClustersContainerName = "TreeC"; +const TString AliITSLoader::fgkDefaultBackTracksContainerName = "TreeB"; +const TString AliITSLoader::fgkDefaultVerticesContainerName = "Vertex"; + +ClassImp(AliITSLoader) + +/*****************************************************************************/ +AliITSLoader::AliITSLoader(const Char_t *name,const Char_t *topfoldername): + AliLoader(name,topfoldername), + fRawClustersDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters"), + fBackTracksDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks"), + fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O") +{ +//ctor + fDataLoaders->Add(&fRawClustersDataLoader); + fRawClustersDataLoader.SetEventFolder(fEventFolder); + fRawClustersDataLoader.SetFolder(GetDetectorDataFolder()); + + fDataLoaders->Add(&fBackTracksDataLoader); + fBackTracksDataLoader.SetEventFolder(fEventFolder); + fBackTracksDataLoader.SetFolder(GetDetectorDataFolder()); + + fDataLoaders->Add(&fVertexDataLoader); + fVertexDataLoader.SetEventFolder(fEventFolder); + fVertexDataLoader.SetFolder(GetDetectorDataFolder()); + +} +/*****************************************************************************/ + +AliITSLoader::AliITSLoader(const Char_t *name,TFolder *topfolder): + AliLoader(name,topfolder), + fRawClustersDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters"), + fBackTracksDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks"), + fVertexDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O") +{ +//ctor + fDataLoaders->Add(&fRawClustersDataLoader); + fRawClustersDataLoader.SetEventFolder(fEventFolder); + fRawClustersDataLoader.SetFolder(GetDetectorDataFolder()); + + fDataLoaders->Add(&fBackTracksDataLoader); + fBackTracksDataLoader.SetEventFolder(fEventFolder); + fBackTracksDataLoader.SetFolder(GetDetectorDataFolder()); + + fDataLoaders->Add(&fVertexDataLoader); + fVertexDataLoader.SetEventFolder(fEventFolder); + fVertexDataLoader.SetFolder(GetDetectorDataFolder()); + +} +/*****************************************************************************/ +AliITSLoader::~AliITSLoader() +{ + //destructor + UnloadRawClusters(); + fDataLoaders->Remove(&fRawClustersDataLoader); + + UnloadBackTracks(); + fDataLoaders->Remove(&fBackTracksDataLoader); + + UnloadVertices(); + fDataLoaders->Remove(&fVertexDataLoader); + +} + +void AliITSLoader::MakeTree(Option_t *opt){ + // invokes AliLoader::MakeTree + specific ITS tree(s) + // Valid options: H,S,D,R,T and C (C=raw clusters) + AliLoader::MakeTree(opt); + const char *oC = strstr(opt,"C"); + if (oC) MakeRawClustersContainer(); + + const char *oB = strstr(opt,"B"); + if (oB) MakeBackTracksContainer(); + +} diff --git a/ITS/AliITSLoader.h b/ITS/AliITSLoader.h new file mode 100644 index 00000000000..c3490a44f77 --- /dev/null +++ b/ITS/AliITSLoader.h @@ -0,0 +1,71 @@ +#ifndef ALIITSGETTER_H +#define ALIITSGETTER_H + +#include +#include + +class AliITSLoader: public AliLoader + { + public: + AliITSLoader(){}; + AliITSLoader(const Char_t *name,const Char_t *topfoldername); + AliITSLoader(const Char_t *name,TFolder *topfolder); + + virtual ~AliITSLoader(); + + void MakeTree(Option_t* opt); + + //Raw Clusters + virtual void CleanRawClusters() {fRawClustersDataLoader.GetBaseLoader(0)->Clean();} + Int_t LoadRawClusters(Option_t* opt=""){return fRawClustersDataLoader.GetBaseLoader(0)->Load(opt);} + void SetRawClustersFileName(const TString& fname){fRawClustersDataLoader.SetFileName(fname);} + TTree* TreeC(){ return fRawClustersDataLoader.Tree();} // returns a pointer to the tree of RawClusters + void UnloadRawClusters(){fRawClustersDataLoader.GetBaseLoader(0)->Unload();} + virtual Int_t WriteRawClusters(Option_t* opt=""){return fRawClustersDataLoader.GetBaseLoader(0)->WriteData(opt);} + + //Vertices + virtual void CleanVertices() {fVertexDataLoader.GetBaseLoader(0)->Clean();} + Int_t LoadVertices(Option_t* opt=""){return fVertexDataLoader.GetBaseLoader(0)->Load(opt);} + void SetVerticesFileName(const TString& fname){fVertexDataLoader.SetFileName(fname);} + void UnloadVertices(){fVertexDataLoader.GetBaseLoader(0)->Unload();} + virtual Int_t WriteVertices(Option_t* opt=""){return fVertexDataLoader.GetBaseLoader(0)->WriteData(opt);} + virtual Int_t PostVertex(AliITSVertex *ptr){return fVertexDataLoader.GetBaseLoader(0)->Post(ptr);} + // virtual void SetVerticesContName(const char *name){fVertexDataLoader.GetBaseLoader(0)->SetName(name);} + AliITSVertex *GetVertex(){return static_cast (fVertexDataLoader.GetBaseLoader(0)->Get());} + + //Back Propagated Tracks + + virtual void CleanBackTracks() {fBackTracksDataLoader.GetBaseLoader(0)->Clean();} + Int_t LoadBackTracks(Option_t* opt=""){return fBackTracksDataLoader.GetBaseLoader(0)->Load(opt);} + void SetBackTracksFileName(const TString& fname){fBackTracksDataLoader.SetFileName(fname);} + TTree* TreeB(){ return fBackTracksDataLoader.Tree();} // returns a pointer to the tree of BackTracks + void UnloadBackTracks(){fBackTracksDataLoader.GetBaseLoader(0)->Unload();} + virtual Int_t WriteBackTracks(Option_t* opt=""){return fBackTracksDataLoader.GetBaseLoader(0)->WriteData(opt);} + + + protected: + + // METHODS + virtual void MakeRawClustersContainer() {fRawClustersDataLoader.MakeTree();} + Int_t PostRawClusters(){return fRawClustersDataLoader.GetBaseLoader(0)->Post();} + + virtual void MakeBackTracksContainer() {fBackTracksDataLoader.MakeTree();} + Int_t PostBackTracks(){return fBackTracksDataLoader.GetBaseLoader(0)->Post();} + + // DATA + AliDataLoader fRawClustersDataLoader; + static const TString fgkDefaultRawClustersContainerName; + + AliDataLoader fBackTracksDataLoader; + static const TString fgkDefaultBackTracksContainerName; + + AliDataLoader fVertexDataLoader; + static const TString fgkDefaultVerticesContainerName; + + public: + ClassDef(AliITSLoader,2) + }; + +#endif + + diff --git a/ITS/AliITSRawCluster.cxx b/ITS/AliITSRawCluster.cxx index fb5b4853337..a486539de5d 100644 --- a/ITS/AliITSRawCluster.cxx +++ b/ITS/AliITSRawCluster.cxx @@ -13,23 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ -Revision 1.7.6.1 2002/08/28 15:06:50 alibrary -Updating to v3-09-01 - -Revision 1.8 2002/08/21 22:04:27 nilsen -Added data member to SPD cluters and made related modifications to the -SPD Cluster finders. Generaly cleanded up some of the code. - -Revision 1.7 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -*/ #include #include diff --git a/ITS/AliITSRecPoint.cxx b/ITS/AliITSRecPoint.cxx index fab9a4edc92..8ab82577677 100644 --- a/ITS/AliITSRecPoint.cxx +++ b/ITS/AliITSRecPoint.cxx @@ -13,19 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ -Revision 1.3.12.1 2002/10/14 13:14:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.4 2002/09/09 17:28:02 nilsen -Added class iostreamer funcionality and Print and Read functions. cleaned -up files. - -*/ //////////////////////////////////////////////// // Reconstructed point class for set:ITS // //////////////////////////////////////////////// diff --git a/ITS/AliITSSDigits2Digits.C b/ITS/AliITSSDigits2Digits.C index d7dead000ce..ca5f9ba1c12 100644 --- a/ITS/AliITSSDigits2Digits.C +++ b/ITS/AliITSSDigits2Digits.C @@ -1,15 +1,16 @@ -void writeAR(TFile * fin, TFile *fou); void AliITSSD2D(TString inFile, TString outFile); -void AliITSSDigits2Digits(TString inFile= "galice.root", TString outFile = ""){ +void AliITSSDigits2Digits(TString inFile= "galice.root", TString outFile = "") + { // This macro takes SDigits and produces Digits. No merging is done // and only one galice.root file is used. // Dynamically link some shared libs TStopwatch timer; - - if(gAlice){ - delete gAlice; - gAlice = 0; + if(gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice = 0x0; } // end if gAlice cout << "Creating digits from summable digits for the ITS..." << endl; AliITSSD2D(inFile,outFile); @@ -19,37 +20,11 @@ void AliITSSDigits2Digits(TString inFile= "galice.root", TString outFile = ""){ void AliITSSD2D(TString inFile, TString outFile){ AliRunDigitizer * manager = new AliRunDigitizer(1,1); - char ftmp[50]; - sprintf(ftmp,"%s",inFile.Data()); - manager->SetInputStream(0,ftmp); + manager->SetInputStream(0,inFile); if(outFile != "")manager->SetOutputFile(outFile); AliITSDigitizer *dITS = new AliITSDigitizer(manager); manager->Exec(""); - if(outFile != ""){ - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile); - TFile * file2 = new TFile(outFile,"UPDATE"); - writeAR(file,file2); - file2->Close(); - } delete manager; - delete gAlice; gAlice=0; -} - -void writeAR(TFile * fin, TFile *fou) { - TDirectory *current = gDirectory; - TTree *Te; - TTree *TeNew; - AliHeader *alhe = new AliHeader(); - Te = (TTree*)fin->Get("TE"); - Te->SetBranchAddress("Header",&alhe); - Te->SetBranchStatus("*",1); - fou->cd(); - TeNew = Te->CloneTree(); - TeNew->Write(0,TObject::kOverwrite); - gAlice->Write(0,TObject::kOverwrite); - current->cd(); - delete alhe; - cout<<"AliRun object written to file\n"; } diff --git a/ITS/AliITSTrackerV1.cxx b/ITS/AliITSTrackerV1.cxx index 89ebc15918e..98c8e7e320b 100644 --- a/ITS/AliITSTrackerV1.cxx +++ b/ITS/AliITSTrackerV1.cxx @@ -13,52 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.27 2002/10/31 10:17:40 hristov -Corrected usage of AliKalmanTrack::SetConvConst (Alpha) +/* $Id$ */ -Revision 1.26 2002/10/25 18:44:33 barbera -Unnecessary print-out removed - -Revision 1.25 2002/10/24 17:12:58 barbera -ITS tracking V1 integrated with the last version of ITS PID - -Revision 1.24 2002/10/23 14:28:38 barbera -Fixes added to get into account the new magnetic field conversion factor automatically - -Revision 1.23 2002/10/22 18:29:34 barbera -Tracking V1 ported to the HEAD - -Revision 1.22 2002/10/22 14:45:36 alibrary -Introducing Riostream.h - -Revision 1.21 2002/02/05 09:12:26 hristov -Small mods for gcc 3.02 - -Revision 1.20 2001/11/21 14:47:45 barbera -Some unuseful print-out commented out - -Revision 1.19 2001/11/21 10:49:07 barbera -Bug correction suggested by Rene done - -Revision 1.18 2001/11/20 15:46:17 barbera -Point coordinated are calculated in cylindrical reference frame once and for all at the beginning of tracking V1 - -Revision 1.10.2.1 2001/10/24 07:26:04 hristov -All the changes from the head are merged with the release - -Revision 1.14 2001/10/24 07:19:57 hristov -Some pointer correctly initialised in one of the constructors - -Revision 1.13 2001/10/21 19:17:12 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.12 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -*/ // The purpose of this class is to permorm the ITS tracking. The // constructor has the task to inizialize some private members. The method // DoTracking is written to be called by a macro. It gets the event number, @@ -84,6 +40,7 @@ cleanded up a little bit of code. #include "TParticle.h" #include "AliRun.h" +#include "AliLoader.h" #include "AliITS.h" #include "AliITSsegmentationSSD.h" #include "AliITSgeomSPD.h" @@ -551,9 +508,11 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr, if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();} cf->cd(); - //AliTPCtracker *tracker = new AliTPCtracker(digp,evNumber); //I.B. - AliTPCtracker *tracker = new AliTPCtracker(digp); //I.B. - tracker->SetEventNumber(evNumber); //I.B. + TString foldname(fITS->GetLoader()->GetEventFolder()->GetName()); + + AliTPCtracker *tracker = new AliTPCtracker(digp,evNumber,foldname); + //PH AliTPCtracker *tracker = new AliTPCtracker(digp); //I.B. + //PH tracker->SetEventNumber(evNumber); //I.B. // Load clusters //tracker->LoadInnerSectors(); //I.B. diff --git a/ITS/AliITSVertexer.cxx b/ITS/AliITSVertexer.cxx index 39dc270722a..206b6fc06c1 100644 --- a/ITS/AliITSVertexer.cxx +++ b/ITS/AliITSVertexer.cxx @@ -1,5 +1,8 @@ +#include #include #include +#include +#include ClassImp(AliITSVertexer) @@ -13,27 +16,33 @@ AliITSVertexer::AliITSVertexer() { // Default Constructor fCurrentVertex = 0; - fInFile = 0; - fOutFile = 0; SetDebug(); SetFirstEvent(0); SetLastEvent(0); } -AliITSVertexer::AliITSVertexer(TFile *infile, TFile *outfile) { +AliITSVertexer::AliITSVertexer(TString filename) { // Standard constructor + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + if(!rl){ + Fatal("AliITSVertexer","Run Loader not found"); + } + if(rl->LoadgAlice()){ + Fatal("AliITSVertexer","The AliRun object is not available - nothing done"); + } fCurrentVertex = 0; - SetInputFile(infile); - SetOutputFile(outfile); SetDebug(); SetFirstEvent(0); SetLastEvent(0); - if(gAlice){ - Int_t lst; - if(gAlice->TreeE()){ - lst = static_cast(gAlice->TreeE()->GetEntries()); - SetLastEvent(lst-1); - } + rl->LoadHeader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + if(filename.Data()!="default")ITSloader->SetVerticesFileName(filename); + ITSloader->LoadVertices("recreate"); + ITSloader->LoadRecPoints(); + Int_t lst; + if(rl->TreeE()){ + lst = static_cast(rl->TreeE()->GetEntries()); + SetLastEvent(lst-1); } } @@ -44,20 +53,16 @@ AliITSVertexer::~AliITSVertexer() { // by this class and are not deleted fCurrentVertex = 0; - fInFile = 0; - fOutFile = 0; } //______________________________________________________________________ void AliITSVertexer::WriteCurrentVertex(){ // Write the current AliVertex object to file fOutFile - if(!fOutFile){ - Error("WriteCurrentEvent","The output file is not defined"); - return; - } - TDirectory *curdir = gDirectory; - fOutFile->cd(); - fCurrentVertex->Write(); - curdir->cd(); - fCurrentVertex = 0; + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + fCurrentVertex->SetName("Vertex"); + // const char * name = fCurrentVertex->GetName(); + // ITSloader->SetVerticesContName(name); + Int_t rc = ITSloader->PostVertex(fCurrentVertex); + rc = ITSloader->WriteVertices(); } diff --git a/ITS/AliITSVertexer.h b/ITS/AliITSVertexer.h index 056f620d692..8b0df00a773 100644 --- a/ITS/AliITSVertexer.h +++ b/ITS/AliITSVertexer.h @@ -21,27 +21,23 @@ class AliITSVertexer : public TObject { // default constructor AliITSVertexer(); // standard constructor - AliITSVertexer(TFile *infile, TFile *outfile); + AliITSVertexer(TString filename); // destructor virtual ~AliITSVertexer(); // computes the vertex for the current event virtual AliITSVertex* FindVertexForCurrentEvent(Int_t evnumb)=0; - // computes the vetex for each event and stores it on fOutFile + // computes the vetex for each event and stores it on file virtual void FindVertices()= 0; virtual void PrintStatus() const = 0; virtual void SetDebug(Int_t debug = 0){fDebug = debug;} virtual void SetFirstEvent(Int_t ev){fFirstEvent = ev;} virtual void SetLastEvent(Int_t ev){fLastEvent = ev;} - virtual void SetInputFile(TFile *infile){fInFile = infile;} - virtual void SetOutputFile(TFile *outfile){fOutFile = outfile;} virtual void WriteCurrentVertex(); protected: AliITSVertex *fCurrentVertex; //! pointer to the vertex of the current // event - TFile *fInFile; //! pointer to the input file - TFile *fOutFile; //! pointer to the output file Int_t fFirstEvent; // First event to be processed by FindVertices Int_t fLastEvent; // Last event to be processed by FindVertices Int_t fDebug; //! debug flag - verbose printing if >0 diff --git a/ITS/AliITSVertexerIons.cxx b/ITS/AliITSVertexerIons.cxx index c45085a5891..54ced005a4c 100644 --- a/ITS/AliITSVertexerIons.cxx +++ b/ITS/AliITSVertexerIons.cxx @@ -11,6 +11,7 @@ #include "AliRun.h" #include "AliITS.h" #include "AliITSgeom.h" +#include "AliITSLoader.h" #include "AliITSRecPoint.h" #include "AliGenerator.h" #include "AliMagF.h" @@ -43,16 +44,16 @@ ClassImp(AliITSVertexerIons) //______________________________________________________________________ -AliITSVertexerIons::AliITSVertexerIons():AliITSVertexer() { + AliITSVertexerIons::AliITSVertexerIons():AliITSVertexer() { // Default Constructor fITS = 0; } //______________________________________________________________________ -AliITSVertexerIons::AliITSVertexerIons(TFile *infile, TFile *outfile):AliITSVertexer(infile,outfile) { +AliITSVertexerIons::AliITSVertexerIons(TString fn):AliITSVertexer(fn) { // Standard constructor - if(!fInFile)Fatal("AliITSVertexerIons","No inputfile has been defined!"); + fITS = 0; } @@ -70,7 +71,8 @@ AliITSVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){ Double_t Position[3]; Double_t Resolution[3]; Double_t SNR[3]; - + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); if(!fITS) { fITS =(AliITS *)gAlice->GetDetector("ITS"); if(!fITS) { @@ -78,412 +80,404 @@ AliITSVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){ return fCurrentVertex; } } - AliITSgeom *g2 = fITS->GetITSgeom(); - - TClonesArray *recpoints = fITS->RecPoints(); - AliITSRecPoint *pnt; - - Int_t NoPoints1 = 0; - Int_t NoPoints2 = 0; - Double_t Vzero[3]; - Double_t AsPar[2]; + fITS->SetTreeAddress(); + AliITSgeom *g2 = fITS->GetITSgeom(); + TClonesArray *recpoints = fITS->RecPoints(); + AliITSRecPoint *pnt; + + Int_t NoPoints1 = 0; + Int_t NoPoints2 = 0; + Double_t Vzero[3]; + Double_t AsPar[2]; -//------------ Rough Vertex evaluation --------------------------------- + //------------ Rough Vertex evaluation --------------------------------- - Int_t i,npoints,ipoint,j,k,max,BinMax; - Double_t ZCentroid; - Float_t l[3], p[3]; + Int_t i,npoints,ipoint,j,k,max,BinMax; + Double_t ZCentroid; + Float_t l[3], p[3]; - Double_t mxpiu = 0; - Double_t mxmeno = 0; - Double_t mypiu = 0; - Double_t mymeno = 0; + Double_t mxpiu = 0; + Double_t mxmeno = 0; + Double_t mypiu = 0; + Double_t mymeno = 0; - TH1F *hITSz1 = new TH1F("hITSz1","",100,-14.35,14.35); + TH1F *hITSz1 = new TH1F("hITSz1","",100,-14.35,14.35); + TTree *TR = ITSloader->TreeR(); + for(i=g2->GetStartSPD();i<=g2->GetLastSPD();i++) + { + fITS->ResetRecPoints(); + TR->GetEvent(i); + npoints = recpoints->GetEntries(); + for (ipoint=0;ipointUncheckedAt(ipoint); + l[0]=pnt->GetX(); + l[1]=0; + l[2]=pnt->GetZ(); + g2->LtoG(i, l, p); + if(i<80 && TMath::Abs(p[2])<14.35) { + if(p[0]>0) mxpiu++; + if(p[0]<0) mxmeno++; + if(p[1]>0) mypiu++; + if(p[1]<0) mymeno++; + hITSz1->Fill(p[2]); + } + if(i>=80 && TMath::Abs(p[2])<14.35) NoPoints2++; + } + } - for(i=g2->GetStartSPD();i<=g2->GetLastSPD();i++) - { - fITS->ResetRecPoints(); - gAlice->TreeR()->GetEvent(i); - npoints = recpoints->GetEntries(); + NoPoints1 = (Int_t)(hITSz1->GetEntries()); - for (ipoint=0;ipointUncheckedAt(ipoint); - l[0]=pnt->GetX(); - l[1]=0; - l[2]=pnt->GetZ(); - g2->LtoG(i, l, p); - if(i<80 && TMath::Abs(p[2])<14.35) { - if(p[0]>0) mxpiu++; - if(p[0]<0) mxmeno++; - if(p[1]>0) mypiu++; - if(p[1]<0) mymeno++; - hITSz1->Fill(p[2]); - } - if(i>=80 && TMath::Abs(p[2])<14.35) NoPoints2++; - } - } - - NoPoints1 = (Int_t)(hITSz1->GetEntries()); - - AsPar[0] = (mxpiu-mxmeno)/(mxpiu+mxmeno); - AsPar[1] = (mypiu-mymeno)/(mypiu+mymeno); + AsPar[0] = (mxpiu-mxmeno)/(mxpiu+mxmeno); + AsPar[1] = (mypiu-mymeno)/(mypiu+mymeno); - Vzero[0] = 5.24441*AsPar[0]; - Vzero[1] = 5.24441*AsPar[1]; + Vzero[0] = 5.24441*AsPar[0]; + Vzero[1] = 5.24441*AsPar[1]; - ZCentroid= TMath::Abs(hITSz1->GetMean()); - Vzero[2] = -5.31040e-02+1.42198*ZCentroid+7.44718e-01*TMath::Power(ZCentroid,2) - -5.73426e-01*TMath::Power(ZCentroid,3)+2.01500e-01*TMath::Power(ZCentroid,4) - -3.34118e-02*TMath::Power(ZCentroid,5)+2.20816e-03*TMath::Power(ZCentroid,6); + ZCentroid= TMath::Abs(hITSz1->GetMean()); + Vzero[2] = -5.31040e-02+1.42198*ZCentroid+7.44718e-01*TMath::Power(ZCentroid,2) + -5.73426e-01*TMath::Power(ZCentroid,3)+2.01500e-01*TMath::Power(ZCentroid,4) + -3.34118e-02*TMath::Power(ZCentroid,5)+2.20816e-03*TMath::Power(ZCentroid,6); - if(hITSz1->GetMean()<0) Vzero[2] = -Vzero[2]; + if(hITSz1->GetMean()<0) Vzero[2] = -Vzero[2]; - /*cout << "\nXvzero: " << Vzero[0] << " cm" << ""; - cout << "\nYvzero: " << Vzero[1] << " cm" << ""; - cout << "\nZvzero: " << Vzero[2] << " cm" << "\n";*/ + /*cout << "\nXvzero: " << Vzero[0] << " cm" << ""; + cout << "\nYvzero: " << Vzero[1] << " cm" << ""; + cout << "\nZvzero: " << Vzero[2] << " cm" << "\n";*/ - delete hITSz1; + delete hITSz1; - Double_t dphi,r,DeltaZ,a,b; - Int_t np1=0; - Int_t np2=0; - Int_t niter=0; + Double_t dphi,r,DeltaZ,a,b; + Int_t np1=0; + Int_t np2=0; + Int_t niter=0; - Double_t DeltaPhiZ = 0.08; + Double_t DeltaPhiZ = 0.08; - Float_t B[3]; - Float_t origin[3]; - for(Int_t okm=0;okm<3;okm++) origin[okm]=0; - gAlice->Field()->Field(origin,B); + Float_t B[3]; + Float_t origin[3]; + for(Int_t okm=0;okm<3;okm++) origin[okm]=0; + gAlice->Field()->Field(origin,B); - DeltaPhiZ = DeltaPhiZ*B[2]/2; - Double_t DeltaPhiXY = 1.0; + DeltaPhiZ = DeltaPhiZ*B[2]/2; + Double_t DeltaPhiXY = 1.0; -// cout << "\nDeltaPhiZ: " << DeltaPhiZ << " deg" << "\n"; -// cout << "DeltaPhiXY: " << DeltaPhiXY << " deg" << "\n"; + // cout << "\nDeltaPhiZ: " << DeltaPhiZ << " deg" << "\n"; + // cout << "DeltaPhiXY: " << DeltaPhiXY << " deg" << "\n"; - Double_t *Z1, *Z2, *Y1, *Y2, *X1, *X2, *phi1, *phi2, *r1, *r2; - Z1=new Double_t[NoPoints1]; - Z2=new Double_t[NoPoints2]; - Y1=new Double_t[NoPoints1]; - Y2=new Double_t[NoPoints2]; - X1=new Double_t[NoPoints1]; - X2=new Double_t[NoPoints2]; - phi1=new Double_t[NoPoints1]; - phi2=new Double_t[NoPoints2]; - r1=new Double_t[NoPoints1]; - r2=new Double_t[NoPoints2]; + Double_t *Z1, *Z2, *Y1, *Y2, *X1, *X2, *phi1, *phi2, *r1, *r2; + Z1=new Double_t[NoPoints1]; + Z2=new Double_t[NoPoints2]; + Y1=new Double_t[NoPoints1]; + Y2=new Double_t[NoPoints2]; + X1=new Double_t[NoPoints1]; + X2=new Double_t[NoPoints2]; + phi1=new Double_t[NoPoints1]; + phi2=new Double_t[NoPoints2]; + r1=new Double_t[NoPoints1]; + r2=new Double_t[NoPoints2]; - DeltaZ = 4.91617e-01+2.67567e-02*Vzero[2]+1.49626e-02*TMath::Power(Vzero[2],2); - Float_t MulFactorZ = 28000./(Float_t)NoPoints1; - Int_t nbin=(Int_t)((DeltaZ/0.005)/MulFactorZ); - Int_t nbinxy=250; - Int_t *VectorBinZ,*VectorBinXY; - VectorBinZ=new Int_t[nbin]; - VectorBinXY=new Int_t[nbinxy]; - Float_t f1= 0; - Float_t f2= 0; - Double_t sigma,MediaFondo; + DeltaZ = 4.91617e-01+2.67567e-02*Vzero[2]+1.49626e-02*TMath::Power(Vzero[2],2); + Float_t MulFactorZ = 28000./(Float_t)NoPoints1; + Int_t nbin=(Int_t)((DeltaZ/0.005)/MulFactorZ); + Int_t nbinxy=250; + Int_t *VectorBinZ,*VectorBinXY; + VectorBinZ=new Int_t[nbin]; + VectorBinXY=new Int_t[nbinxy]; + Float_t f1= 0; + Float_t f2= 0; + Double_t sigma,MediaFondo; - TH1D *hITSZv = new TH1D("hITSZv","",nbin,Vzero[2]-DeltaZ,Vzero[2]+DeltaZ); - TH1D *hITSXv = new TH1D("hITSXv","",nbinxy,-3,3); - TH1D *hITSYv = new TH1D("hITSYv","",nbinxy,-3,3); + TH1D *hITSZv = new TH1D("hITSZv","",nbin,Vzero[2]-DeltaZ,Vzero[2]+DeltaZ); + TH1D *hITSXv = new TH1D("hITSXv","",nbinxy,-3,3); + TH1D *hITSYv = new TH1D("hITSYv","",nbinxy,-3,3); -// cout << "DeltaZeta: " << DeltaZ << " cm" << "\n"; + // cout << "DeltaZeta: " << DeltaZ << " cm" << "\n"; - start: + start: - hITSZv->Add(hITSZv,-1.); - hITSXv->Add(hITSXv,-1.); - hITSYv->Add(hITSYv,-1.); + hITSZv->Add(hITSZv,-1.); + hITSXv->Add(hITSXv,-1.); + hITSYv->Add(hITSYv,-1.); - np1=np2=0; + np1=np2=0; - for(i=g2->GetStartSPD();i<=g2->GetLastSPD();i++) - { - fITS->ResetRecPoints(); - gAlice->TreeR()->GetEvent(i); - npoints = recpoints->GetEntries(); - for (ipoint=0;ipointGetStartSPD();i<=g2->GetLastSPD();i++) + { + fITS->ResetRecPoints(); + ITSloader->TreeR()->GetEvent(i); + npoints = recpoints->GetEntries(); + for (ipoint=0;ipointUncheckedAt(ipoint); - l[0]=pnt->GetX(); - l[1]=0; - l[2]=pnt->GetZ(); - g2->LtoG(i, l, p); + pnt = (AliITSRecPoint*)recpoints->UncheckedAt(ipoint); + l[0]=pnt->GetX(); + l[1]=0; + l[2]=pnt->GetZ(); + g2->LtoG(i, l, p); - if(i<80 && TMath::Abs(p[2])<14.35) { - p[0]=p[0]-Vzero[0]; - p[1]=p[1]-Vzero[1]; - r=TMath::Sqrt(TMath::Power(p[0],2)+TMath::Power(p[1],2)); - Y1[np1]=p[1]; - X1[np1]=p[0]; - Z1[np1]=p[2]; - r1[np1]=r; - phi1[np1]=PhiFunc(p); - np1++; - } - - if(i>=80 && TMath::Abs(p[2])<14.35) { - p[0]=p[0]-Vzero[0]; - p[1]=p[1]-Vzero[1]; - r=TMath::Sqrt(TMath::Power(p[0],2)+TMath::Power(p[1],2)); - Y2[np2]=p[1]; - X2[np2]=p[0]; - Z2[np2]=p[2]; - r2[np2]=r; - phi2[np2]=PhiFunc(p); - np2++; - } + if(i<80 && TMath::Abs(p[2])<14.35) { + p[0]=p[0]-Vzero[0]; + p[1]=p[1]-Vzero[1]; + r=TMath::Sqrt(TMath::Power(p[0],2)+TMath::Power(p[1],2)); + Y1[np1]=p[1]; + X1[np1]=p[0]; + Z1[np1]=p[2]; + r1[np1]=r; + phi1[np1]=PhiFunc(p); + np1++; + } + + if(i>=80 && TMath::Abs(p[2])<14.35) { + p[0]=p[0]-Vzero[0]; + p[1]=p[1]-Vzero[1]; + r=TMath::Sqrt(TMath::Power(p[0],2)+TMath::Power(p[1],2)); + Y2[np2]=p[1]; + X2[np2]=p[0]; + Z2[np2]=p[2]; + r2[np2]=r; + phi2[np2]=PhiFunc(p); + np2++; + } - } - } + } + } -//------------------ Correlation between rec points ---------------------- + //------------------ Correlation between rec points ---------------------- - //cout << "\nNo. of Points on the two pixel layers: "<180) dphi = 360-dphi; - if(dphiFill(Z1[k]-(Z2[j]-Z1[k])/((r2[j]/r1[k])-1)); - } - } + //cout << "\nNo. of Points on the two pixel layers: "<180) dphi = 360-dphi; + if(dphiFill(Z1[k]-(Z2[j]-Z1[k])/((r2[j]/r1[k])-1)); + } + } - //cout << "\nNumber of used pairs: \n"; - //cout << hITSZv->GetEntries() << '\n' << '\n'; - a = Vzero[2]-DeltaZ; - b = Vzero[2]+DeltaZ; - max=(Int_t) hITSZv->GetMaximum(); - BinMax=hITSZv->GetMaximumBin(); - sigma=0; - for(i=0;iGetBinContent(i); - for(i=0;i<10;i++) f1=f1+VectorBinZ[i]/10; - for(i=nbin-10;i(max-MediaFondo)*0.4 && - VectorBinZ[i]-MediaFondo<(max-MediaFondo)*0.7) { - sigma=hITSZv->GetBinCenter(BinMax)-hITSZv->GetBinCenter(i); - sigma=TMath::Abs(sigma); - if(sigma==0) sigma=0.05; - } - } + //cout << "\nNumber of used pairs: \n"; + //cout << hITSZv->GetEntries() << '\n' << '\n'; + a = Vzero[2]-DeltaZ; + b = Vzero[2]+DeltaZ; + max=(Int_t) hITSZv->GetMaximum(); + BinMax=hITSZv->GetMaximumBin(); + sigma=0; + for(i=0;iGetBinContent(i); + for(i=0;i<10;i++) f1=f1+VectorBinZ[i]/10; + for(i=nbin-10;i(max-MediaFondo)*0.4 && + VectorBinZ[i]-MediaFondo<(max-MediaFondo)*0.7) { + sigma=hITSZv->GetBinCenter(BinMax)-hITSZv->GetBinCenter(i); + sigma=TMath::Abs(sigma); + if(sigma==0) sigma=0.05; + } + } - /*cout << "f1 " <GetMaximumBin() <GetBinContent(BinMax)<GetMaximumBin() <GetBinContent(BinMax)<SetParameter(0,max); - if(niter==0) {Double_t temp = hITSZv->GetBinCenter(BinMax); Vzero[2]=temp;} - fz->SetParameter(1,Vzero[2]); - fz->SetParameter(2,sigma); - fz->SetParameter(3,MediaFondo); - fz->SetParLimits(2,0,999); - fz->SetParLimits(3,0,999); + fz->SetParameter(0,max); + if(niter==0) {Double_t temp = hITSZv->GetBinCenter(BinMax); Vzero[2]=temp;} + fz->SetParameter(1,Vzero[2]); + fz->SetParameter(2,sigma); + fz->SetParameter(3,MediaFondo); + fz->SetParLimits(2,0,999); + fz->SetParLimits(3,0,999); - hITSZv->Fit("fz","RMEQ0"); + hITSZv->Fit("fz","RMEQ0"); - SNR[2] = fz->GetParameter(0)/fz->GetParameter(3); - if(SNR[2]<0.) { - cout << "\nNegative Signal to noise ratio for z!!!" << endl; - cout << "The algorithm cannot find the z vertex position." << endl; - exit(123456789); - } - else - { - Position[2] = fz->GetParameter(1); - if(Position[2]<0) - { - Position[2]=Position[2]-TMath::Abs(Position[2])*1.11/10000; - } - else - { - Position[2]=Position[2]+TMath::Abs(Position[2])*1.11/10000; - } - } - Resolution[2] = fz->GetParError(1); - + SNR[2] = fz->GetParameter(0)/fz->GetParameter(3); + if(SNR[2]<0.) { + cout << "\nNegative Signal to noise ratio for z!!!" << endl; + cout << "The algorithm cannot find the z vertex position." << endl; + exit(123456789); + } + else + { + Position[2] = fz->GetParameter(1); + if(Position[2]<0) + { + Position[2]=Position[2]-TMath::Abs(Position[2])*1.11/10000; + } + else + { + Position[2]=Position[2]+TMath::Abs(Position[2])*1.11/10000; + } + } + Resolution[2] = fz->GetParError(1); - for(j=0; j<(np2)-1; j++) { - for(k=0; k<(np1)-1; k++) { - dphi=TMath::Abs(phi1[k]-phi2[j]); - if(dphi>180) dphi = 360-dphi; - if(dphi>DeltaPhiXY) continue; - if(TMath::Abs((Z1[k]-(Z2[j]-Z1[k])/((r2[j]/r1[k])-1))-Position[2]) - <4*Resolution[2]) { - hITSXv->Fill(Vzero[0]+(X2[j]-((X2[j]-X1[k])/(Y2[j]-Y1[k]))*Y2[j])); - hITSYv->Fill(Vzero[1]+(Y2[j]-((Y2[j]-Y1[k])/(X2[j]-X1[k]))*X2[j])); - } - } - } - TF1 *fx = new TF1 - ("fx","([0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2])))+[3]",Vzero[0]-0.5,Vzero[0]+0.5); - - max=(Int_t) hITSXv->GetMaximum(); - BinMax=hITSXv->GetMaximumBin(); - sigma=0; - f1=f2=0; - for(i=0;iGetBinContent(i); - for(i=0;i<10;i++) f1=f1+VectorBinXY[i]/10; - for(i=nbinxy-10;i(max-MediaFondo)*0.4 && - VectorBinXY[i]-MediaFondo<(max-MediaFondo)*0.7) { - sigma=hITSXv->GetBinCenter(BinMax)-hITSXv->GetBinCenter(i); - sigma=TMath::Abs(sigma); - if(sigma==0) sigma=0.05; + for(j=0; j<(np2)-1; j++) { + for(k=0; k<(np1)-1; k++) { + dphi=TMath::Abs(phi1[k]-phi2[j]); + if(dphi>180) dphi = 360-dphi; + if(dphi>DeltaPhiXY) continue; + if(TMath::Abs((Z1[k]-(Z2[j]-Z1[k])/((r2[j]/r1[k])-1))-Position[2]) + <4*Resolution[2]) { + hITSXv->Fill(Vzero[0]+(X2[j]-((X2[j]-X1[k])/(Y2[j]-Y1[k]))*Y2[j])); + hITSYv->Fill(Vzero[1]+(Y2[j]-((Y2[j]-Y1[k])/(X2[j]-X1[k]))*X2[j])); } - } + } + } - /*cout << "f1 " <GetMaximumBin() <GetBinContent(BinMax)<GetMaximum(); + BinMax=hITSXv->GetMaximumBin(); + sigma=0; + f1=f2=0; + for(i=0;iGetBinContent(i); + for(i=0;i<10;i++) f1=f1+VectorBinXY[i]/10; + for(i=nbinxy-10;i(max-MediaFondo)*0.4 && + VectorBinXY[i]-MediaFondo<(max-MediaFondo)*0.7) { + sigma=hITSXv->GetBinCenter(BinMax)-hITSXv->GetBinCenter(i); + sigma=TMath::Abs(sigma); + if(sigma==0) sigma=0.05; + } + } - fx->SetParameter(0,max); - fx->SetParameter(1,Vzero[0]); - fx->SetParameter(2,sigma); - fx->SetParameter(3,MediaFondo); - - hITSXv->Fit("fx","RMEQ0"); - - SNR[0] = fx->GetParameter(0)/fx->GetParameter(3); - if(SNR[0]<0.) { - cout << "\nNegative Signal to noise ratio for x!!!" << endl; - cout << "The algorithm cannot find the x vertex position." << endl; - exit(123456789); - } - else - { - Position[0]=fx->GetParameter(1); - Resolution[0]=fx->GetParError(1); - } - - TF1 *fy = new TF1("fy","([0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2])))+[3]",Vzero[1]-0.5,Vzero[1]+0.5); - - max=(Int_t) hITSYv->GetMaximum(); - BinMax=hITSYv->GetMaximumBin(); - sigma=0; - f1=f2=0; - for(i=0;iGetBinContent(i); - for(i=0;i<10;i++) f1=f1+VectorBinXY[i]/10; - for(i=nbinxy-10;i(max-MediaFondo)*0.4 && - VectorBinXY[i]-MediaFondo<(max-MediaFondo)*0.7) { - sigma=hITSYv->GetBinCenter(BinMax)-hITSYv->GetBinCenter(i); - sigma=TMath::Abs(sigma); - if(sigma==0) sigma=0.05; - } - } + /*cout << "f1 " <GetMaximumBin() <GetBinContent(BinMax)<SetParameter(0,max); + fx->SetParameter(1,Vzero[0]); + fx->SetParameter(2,sigma); + fx->SetParameter(3,MediaFondo); + + hITSXv->Fit("fx","RMEQ0"); + + SNR[0] = fx->GetParameter(0)/fx->GetParameter(3); + if(SNR[0]<0.) { + cout << "\nNegative Signal to noise ratio for x!!!" << endl; + cout << "The algorithm cannot find the x vertex position." << endl; + exit(123456789); + } + else + { + Position[0]=fx->GetParameter(1); + Resolution[0]=fx->GetParError(1); + } + + TF1 *fy = new TF1("fy","([0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2])))+[3]",Vzero[1]-0.5,Vzero[1]+0.5); + + max=(Int_t) hITSYv->GetMaximum(); + BinMax=hITSYv->GetMaximumBin(); + sigma=0; + f1=f2=0; + for(i=0;iGetBinContent(i); + for(i=0;i<10;i++) f1=f1+VectorBinXY[i]/10; + for(i=nbinxy-10;i(max-MediaFondo)*0.4 && + VectorBinXY[i]-MediaFondo<(max-MediaFondo)*0.7) { + sigma=hITSYv->GetBinCenter(BinMax)-hITSYv->GetBinCenter(i); + sigma=TMath::Abs(sigma); + if(sigma==0) sigma=0.05; + } + } - /*cout << "f1 " <GetMaximumBin() <GetBinContent(BinMax)<GetMaximumBin() <GetBinContent(BinMax)<SetParameter(0,max); - fy->SetParameter(1,Vzero[1]); - fy->SetParameter(2,sigma); - fy->SetParameter(3,MediaFondo); + fy->SetParameter(0,max); + fy->SetParameter(1,Vzero[1]); + fy->SetParameter(2,sigma); + fy->SetParameter(3,MediaFondo); - hITSYv->Fit("fy","RMEQ0"); - - SNR[1] = fy->GetParameter(0)/fy->GetParameter(3); - if(SNR[1]<0.) { - cout << "\nNegative Signal to noise ratio for y!!!" << endl; - cout << "The algorithm cannot find the y vertex position." << endl; - exit(123456789); - } - else - { - Position[1]=fy->GetParameter(1); - Resolution[1]=fy->GetParError(1); - } - - niter++; + hITSYv->Fit("fy","RMEQ0"); + + SNR[1] = fy->GetParameter(0)/fy->GetParameter(3); + if(SNR[1]<0.) { + cout << "\nNegative Signal to noise ratio for y!!!" << endl; + cout << "The algorithm cannot find the y vertex position." << endl; + exit(123456789); + } + else + { + Position[1]=fy->GetParameter(1); + Resolution[1]=fy->GetParError(1); + } + + niter++; - Vzero[0] = Position[0]; - Vzero[1] = Position[1]; - Vzero[2] = Position[2]; + Vzero[0] = Position[0]; + Vzero[1] = Position[1]; + Vzero[2] = Position[2]; - if(niter<3) goto start; // number of iterations + if(niter<3) goto start; // number of iterations - cout<<"Number of iterations: "<0 && p[0]>0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578); - if(p[1]>0 && p[0]<0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+180; - if(p[1]<0 && p[0]<0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+180; - if(p[1]<0 && p[0]>0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+360; - return phi; + if(p[1]>0 && p[0]>0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578); + if(p[1]>0 && p[0]<0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+180; + if(p[1]<0 && p[0]<0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+180; + if(p[1]<0 && p[0]>0) phi=(TMath::ATan((Double_t)(p[1]/p[0]))*57.29578)+360; + return phi; } //______________________________________________________________________ void AliITSVertexerIons::FindVertices(){ // computes the vertices of the events in the range FirstEvent - LastEvent - if(!fOutFile){ - Error("FindVertices","The output file is not available - nothing done"); - return; - } - if(!gAlice)gAlice = (AliRun*)fInFile->Get("gAlice"); - if(!gAlice){ - Error("FindVertices","The AliRun object is not available - nothing done"); - return; - } - TDirectory *curdir = gDirectory; - fInFile->cd(); + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + ITSloader->LoadRecPoints("read"); for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ - gAlice->GetEvent(i); + rl->GetEvent(i); FindVertexForCurrentEvent(i); if(fCurrentVertex){ WriteCurrentVertex(); @@ -494,18 +488,13 @@ void AliITSVertexerIons::FindVertices(){ } } } - curdir->cd(); } //________________________________________________________ void AliITSVertexerIons::PrintStatus() const { // Print current status - cout <<"=======================================================\n"; - cout <<" Debug flag: "<PrintStatus(); diff --git a/ITS/AliITSVertexerIons.h b/ITS/AliITSVertexerIons.h index e39b07ea856..3bc37322713 100644 --- a/ITS/AliITSVertexerIons.h +++ b/ITS/AliITSVertexerIons.h @@ -26,7 +26,7 @@ class AliITSVertexerIons : public AliITSVertexer { public: AliITSVertexerIons(); - AliITSVertexerIons(TFile *infile, TFile *outfile); + AliITSVertexerIons(TString fn); virtual ~AliITSVertexerIons(); // destructor virtual AliITSVertex* FindVertexForCurrentEvent(Int_t event); virtual void FindVertices(); diff --git a/ITS/AliITSVertexerPPZ.cxx b/ITS/AliITSVertexerPPZ.cxx index 6c7eb9f6c25..5db663b5f5f 100644 --- a/ITS/AliITSVertexerPPZ.cxx +++ b/ITS/AliITSVertexerPPZ.cxx @@ -24,6 +24,7 @@ #include "AliRun.h" #include "AliITS.h" #include "AliITSgeom.h" +#include "AliITSLoader.h" #include "AliITSRecPoint.h" ///////////////////////////////////////////////////////////////////////// // // @@ -53,9 +54,8 @@ AliITSVertexerPPZ::AliITSVertexerPPZ():AliITSVertexer() { SetWindow(0); } -AliITSVertexerPPZ::AliITSVertexerPPZ(TFile *infile, TFile *outfile, Float_t x0, Float_t y0):AliITSVertexer(infile,outfile) { +AliITSVertexerPPZ::AliITSVertexerPPZ(TString fn, Float_t x0, Float_t y0):AliITSVertexer(fn) { // Standard constructor - if(!fInFile)Fatal("AliITSVertexerPPZ","No inputfile has been defined!"); SetDiffPhiMax(); fX0 = x0; fY0 = y0; @@ -180,11 +180,8 @@ AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){ fCurrentVertex = 0; fZFound = -999; fZsig = -999; - if(!gAlice)gAlice = (AliRun*)fInFile->Get("gAlice"); - if(!gAlice){ - Error("FindVertexForCurrentEvent","The AliRun object is not available - nothing done"); - return fCurrentVertex; - } + AliRunLoader *rl =AliRunLoader::GetRunLoader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); if(!fITS) { fITS = (AliITS*)gAlice->GetModule("ITS"); if(!fITS) { @@ -192,6 +189,7 @@ AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){ return fCurrentVertex; } } + fITS->SetTreeAddress(); AliITSgeom *geom = fITS->GetITSgeom(); if(!geom) { Error("FindVertexForCurrentEvent","ITS geometry is not defined"); @@ -204,7 +202,7 @@ AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){ Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.; Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.; - TR = gAlice->TreeR(); + TR = ITSloader->TreeR(); if(!TR){ Error("FindVertexForCurrentEvent","TreeR not found"); return fCurrentVertex; @@ -330,7 +328,7 @@ AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){ if(fCurrentVertex){ char name[30]; sprintf(name,"Vertex_%d",evnumber); - fCurrentVertex->SetName(name); + // fCurrentVertex->SetName(name); fCurrentVertex->SetTitle("vertexer: PPZ"); } return fCurrentVertex; @@ -339,19 +337,12 @@ AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){ //______________________________________________________________________ void AliITSVertexerPPZ::FindVertices(){ // computes the vertices of the events in the range FirstEvent - LastEvent - if(!fOutFile){ - Error("FindVertices","The output file is not available - nothing done"); - return; - } - if(!gAlice)gAlice = (AliRun*)fInFile->Get("gAlice"); - if(!gAlice){ - Error("FindVertices","The AliRun object is not available - nothing done"); - return; - } - TDirectory *curdir = gDirectory; - fInFile->cd(); + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + ITSloader->ReloadRecPoints(); for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ - gAlice->GetEvent(i); + cout<<"Processing event "<GetEvent(i); FindVertexForCurrentEvent(i); if(fCurrentVertex){ WriteCurrentVertex(); @@ -363,7 +354,6 @@ void AliITSVertexerPPZ::FindVertices(){ } } } - curdir->cd(); } //________________________________________________________ @@ -378,10 +368,6 @@ void AliITSVertexerPPZ::PrintStatus() const { cout <<" Window for Z search: "<PrintStatus(); TString vtxName = "Vertex_"; vtxName += ev; - fCurrentVertex->SetName(vtxName.Data()); + // fCurrentVertex->SetName(vtxName.Data()); fCurrentVertex->SetTitle("VertexerTracks"); WriteCurrentVertex(); } // loop over events @@ -210,7 +209,8 @@ AliITSVertex* AliITSVertexerTracks::FindVertexForCurrentEvent(Int_t evnumb) { // get tree with tracks from input file TString treeName = "TreeT_ITS_"; treeName += evnumb; - TTree *trkTree=(TTree*)fInFile->Get(treeName.Data()); + // TTree *trkTree=(TTree*)fInFile->Get(treeName.Data()); masera + TTree *trkTree; if(!trkTree) return fCurrentVertex; @@ -233,7 +233,7 @@ AliITSVertex* AliITSVertexerTracks::FindVertexForCurrentEvent(Int_t evnumb) { TString vtxName; vtxName = "Vertex_"; vtxName += evnumb; - fCurrentVertex->SetName(vtxName.Data()); + // fCurrentVertex->SetName(vtxName.Data()); return fCurrentVertex; } //--------------------------------------------------------------------------- diff --git a/ITS/AliITSVertexerTracks.h b/ITS/AliITSVertexerTracks.h index 54a11924fde..86a96989988 100644 --- a/ITS/AliITSVertexerTracks.h +++ b/ITS/AliITSVertexerTracks.h @@ -39,15 +39,15 @@ class AliITSVertexerTracks : public AliITSVertexer { // default constructor AliITSVertexerTracks(); // standard constructor - AliITSVertexerTracks(TFile *inFile,TFile *outFile,Double_t field, - Double_t xStart=0,Double_t yStart=0,Int_t useThFr=0); + AliITSVertexerTracks(Double_t field, TString fn, + Double_t xStart=0,Double_t yStart=0,Int_t useThFr=0); // destructor virtual ~AliITSVertexerTracks() {} // return vertex from the set of tracks in the tree AliITSVertex *VertexOnTheFly(TTree &trkTree); // computes the vertex for the current event virtual AliITSVertex* FindVertexForCurrentEvent(Int_t evnumb); - // computes the vertex for each event and stores it on fOutFile + // computes the vertex for each event and stores it on file virtual void FindVertices(); virtual void PrintStatus() const; // computes the vertex for the current event diff --git a/ITS/AliITSVertexerZTest.C b/ITS/AliITSVertexerZTest.C index f658b667567..21d91a96a05 100644 --- a/ITS/AliITSVertexerZTest.C +++ b/ITS/AliITSVertexerZTest.C @@ -8,22 +8,44 @@ #include #include #include +#include +#include #endif -void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Float_t inity=0.,TString FileWithKine="galice.root", TString FileWithRecP="galice.root"){ +void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Float_t inity=0.,TString FileIn="galice.root"){ // delphi ---> azimuthal range to accept tracklets // window ---> window in Z around the peak of tracklets proj. in mm - Int_t kDebug = 0; + Int_t kDebug = 50; TH2F *diff2 = new TH2F("diff2","Zfound vs Ztrue",100,-6,6,100,-6,6); TH1F *diff1 = new TH1F("diff1","Zfound - Ztrue(#mu m)",100,-500,500); delete gAlice; gAlice = 0; - TFile *in = new TFile(FileWithKine.Data()); - gAlice = (AliRun*)in->Get("gAlice"); - if(FileWithKine != FileWithRecP)gAlice->SetTreeRFileName(FileWithRecP); - TFile *fo = new TFile("vertici.root","recreate"); - AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ(in,fo,initx,inity); + AliRunLoader *rl = AliRunLoader::Open(FileIn.Data()); + Int_t retval = rl->LoadgAlice(); + if(retval){ + cerr<<"AliITSVertexerZTest.C: AliRun object not found"<LoadHeader(); + if (retval){ + cerr<<"AliITSVertexerZTest.C : LoadHeader returned error"<LoadKinematics(); + if (retval){ + cerr<<"AliITSVertexerZTest.C : LoadKinematics returned error"<GetLoader("ITSLoader"); + + if(!ITSloader){ + cerr<<"AliITSVertexerZTest.C : ITS loader not found"<LoadRecPoints("read"); + // TFile *fo = new TFile("vertici.root","recreate"); + AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ("default",initx,inity); dovert->SetDebug(0); dovert->SetDiffPhiMax(delphi); dovert->SetWindow(window); @@ -33,10 +55,10 @@ void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Int_t meno110=0; Int_t sigmazero=0; AliITSVertex *vert = 0; - for(Int_t i=0; iTreeE()->GetEntries(); i++){ - gAlice->GetEvent(i); + for(Int_t i=0; iTreeE()->GetEntries(); i++){ + rl->GetEvent(i); // The true Z coord. is fetched for comparison - AliHeader *header = gAlice->GetHeader(); + AliHeader *header = rl->GetHeader(); AliGenEventHeader* genEventHeader = header->GenEventHeader(); TArrayF primaryVertex(3); genEventHeader->PrimaryVertex(primaryVertex); @@ -75,10 +97,6 @@ void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., dovert->WriteCurrentVertex(); } } - in->Close(); - fo->Close(); - delete in; - delete fo; if(kDebug>0){ cout<<"Number of bad vertices with code -100: "< #include "TArrayI.h" diff --git a/ITS/AliITSclustererV2.cxx b/ITS/AliITSclustererV2.cxx index abc9017a0c3..75c2d546aab 100644 --- a/ITS/AliITSclustererV2.cxx +++ b/ITS/AliITSclustererV2.cxx @@ -6,6 +6,8 @@ //uncomment the line below for running with V1 cluster finder classes //#define V1 +//PH 19/05/2003 This class hast to be adapted to NewIO + #include #include "AliRun.h" diff --git a/ITS/AliITSdigit.cxx b/ITS/AliITSdigit.cxx index ea6b6d7be2a..6edea78b193 100644 --- a/ITS/AliITSdigit.cxx +++ b/ITS/AliITSdigit.cxx @@ -12,6 +12,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ //////////////////////////////////////////////// diff --git a/ITS/AliITSdigit.h b/ITS/AliITSdigit.h index 934a7c56e35..bc06f5fec17 100644 --- a/ITS/AliITSdigit.h +++ b/ITS/AliITSdigit.h @@ -2,7 +2,9 @@ #define ALIITSDIGIT_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ + /* $Id$ */ + //////////////////////////////////////////////// // Digits classes for all ITS detectors // //////////////////////////////////////////////// diff --git a/ITS/AliITSetfSDD.cxx b/ITS/AliITSetfSDD.cxx index 817bbb728d9..7573d81d615 100644 --- a/ITS/AliITSetfSDD.cxx +++ b/ITS/AliITSetfSDD.cxx @@ -12,20 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - -/* -$Log$ -Revision 1.8 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) -Revision 1.6.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 +/* $Id$ */ -Revision 1.7 2002/04/24 22:02:31 nilsen -New SDigits and Digits routines, and related changes, (including new -noise values). - -*/ #include #include #include diff --git a/ITS/AliITSetfSDD.h b/ITS/AliITSetfSDD.h index 4f72ab6faab..fb7466ed5c9 100644 --- a/ITS/AliITSetfSDD.h +++ b/ITS/AliITSetfSDD.h @@ -2,16 +2,9 @@ #define ITSETFSDD_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -/* -$Log$ -Revision 1.5.10.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 -Revision 1.6 2002/04/24 22:02:31 nilsen -New SDigits and Digits routines, and related changes, (including new -noise values). +/* $Id$ */ -*/ #include static const Int_t kMaxNofPoles = 5; diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx index e15eccdabf4..c459a7dca65 100644 --- a/ITS/AliITSgeom.cxx +++ b/ITS/AliITSgeom.cxx @@ -13,87 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.20 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.18.8.1 2002/07/24 09:27:50 alibrary -Updating on VirtualMC - -Revision 1.19 2002/05/31 21:07:42 mariana -Fix memory leak - -Revision 1.18 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.17 2001/07/27 08:06:48 hristov -Use global gRandom generator (M.Ivanov) - -Revision 1.16 2001/02/08 23:57:00 nilsen -Fixed up some informational printouts. - -Revision 1.15 2001/02/07 20:23:21 nilsen -Fixed bug with HP and no unget in iostream.h. Now using putback instead. -Other changes and fixes also included. - -Revision 1.14 2001/02/03 00:00:29 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.11 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.4.4.15 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.10 2000/09/05 14:25:50 nilsen -Made fixes for HP compiler. All function parameter default values placed -in .h file. Fixed the usual problem with HP compilers and the "for(Int_t i..." -business. Replaced casting (Double_t [3][3]) to (Double_t (*)[3]) for HP. -Lastly removed all "const" before function parameters which were 2 dim. arrays, -because on HP root generates some strange code (?). Thanks Peter for the -changes. - -Revision 1.9 2000/08/29 20:19:03 nilsen -Removed dependency on structure AliITSeomS and replaced it with class -AliITSgeomMatrix. Added many new functions with many new arguments. Most -in the form of in line functions for speed. - -Revision 1.4.4.6 2000/06/04 16:33:32 Nilsen -A restructured AliITSgeom class. Now used AliITSgeomMatrix. - -Revision 1.4.4.5 2000/03/04 23:42:39 Nilsen -Updated the comments/documentations and improved the maintainability of the -code. - -Revision 1.4.4.4 2000/03/02 21:27:07 Nilsen -Added two functions, SetByAngles and SetTrans. - -Revision 1.4.4.3 2000/01/23 03:09:10 Nilsen -// fixed compiler warnings for new function LtLErrorMatrix(...) - -Revision 1.4.4.2 2000/01/19 23:18:20 Nilsen -Added transformations of Error matrix to AliITSgeom and fixed some typos -in AliITS.h and AliITShitIndex.h - -Revision 1.4.4.1 2000/01/12 19:03:32 Nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.4 1999/10/15 07:03:20 fca -Fixed bug in GetModuleId(Int_t index,Int_t &lay,Int_t &lad, Int_t &det) and -a typo in the creator. aliroot need to be rerun to get a fixed geometry. - -Revision 1.3 1999/10/04 15:20:12 fca -Correct syntax accepted by g++ but not standard for static members, remove minor warnings - -Revision 1.2 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // ITS geometry manipulation routines. // @@ -711,9 +631,17 @@ void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det){ // Int_t lad The ladder number. Starting from 1. // Int_t det The detector number. Starting from 1. Int_t id[3]; - - GetGeomMatrix(index)->GetIndex(id); - lay = id[0]; lad = id[1]; det = id[2]; + AliITSgeomMatrix *g = GetGeomMatrix(index); + if (g == 0x0) + { + Error("GetModuleId","Can not get GeoMatrix for index = %d",index); + lay = -1; lad = -1; det = -1; + } + else + { + g->GetIndex(id); + lay = id[0]; lad = id[1]; det = id[2]; + } return; // The old way kept for posterity. diff --git a/ITS/AliITSgeomMatrix.cxx b/ITS/AliITSgeomMatrix.cxx index 144eccc51d4..cc9c43ef264 100644 --- a/ITS/AliITSgeomMatrix.cxx +++ b/ITS/AliITSgeomMatrix.cxx @@ -13,78 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2002/10/31 10:16:40 hristov -Minor corrections for warnings on Alpha - -Revision 1.16 2002/10/22 14:45:40 alibrary -Introducing Riostream.h - -Revision 1.15 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.13.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.14 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.13 2002/01/28 21:49:19 nilsen -Fixed a logical bug in functions GtoLPositionError, LtoGPositionError, -GtoLPositionErrorTracking, and LtoGPositionErrorTracking. - -Revision 1.12 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.11 2001/09/04 14:54:31 hristov -Const multidimentional arrays cause problems in the CINT dictionary on HP, const removed - -Revision 1.10 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.9 2001/03/23 15:21:56 nilsen -Added Cylinderical Coordinates for use with Tracking. Fixed a but in the -Streamer, It was not setting a value for frot[3] as it should when reading. - -Revision 1.8 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.7 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.5 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.1.2.6 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.4 2000/09/07 17:30:45 nilsen -fixed a bug in SixAnglesFromMatrix. - -Revision 1.3 2000/09/05 14:25:50 nilsen -Made fixes for HP compiler. All function parameter default values placed -in .h file. Fixed the usual problem with HP comilers and the "for(Int_t i..." -business. Replaced casting (Double_t [3][3]) to (Double_t (*)[3]) for HP. -Lastly removed all "const" before function parameters which were 2 dim. arrays, -because on HP root generates some strange code (?). Thanks Peter for the -changes. - -Revision 1.2 2000/08/29 20:16:50 nilsen -New class for ITS coordiante transformations used by AliITSgeom nearly -exclusively. - -Revision 1.1.2.1 2000/06/04 16:32:31 Nilsen -A new class to hold the matrix information needed by AliITSgeom. - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////// // This is the implementation file for AliITSgeomMatrix class. It diff --git a/ITS/AliITSgeomSDD.cxx b/ITS/AliITSgeomSDD.cxx index 53d47feca2c..5e8da1c87de 100644 --- a/ITS/AliITSgeomSDD.cxx +++ b/ITS/AliITSgeomSDD.cxx @@ -13,74 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.17 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.16 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.15 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry -tree for the ITS pixels. This fixes both the funny distribution of pixel -coordinates and the missing hits/digits/points in many sectors of the ITS -pixel barrel. Also included is a patch to properly get and use the detector -dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.8 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.2.4.8 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.7 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.2.4.2 2000/03/04 23:55:35 nilsen -Fixed up comments/documentation. - -Revision 1.2.4.1 2000/01/12 19:03:32 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.2 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////// // This class is for the Silicon Drift Detector, SDD, specific geometry. @@ -339,56 +272,8 @@ istream &operator>>(istream &is,AliITSgeomSDD &r){ r.Read(&is); return is; } -//====================================================================== -/* -$Log$ -Revision 1.18 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.17 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.16 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.15 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ -//#include -//#include - -//#include "AliITSgeomSDD256.h" +//====================================================================== ClassImp(AliITSgeomSDD256) @@ -829,56 +714,8 @@ istream &operator>>(istream &is,AliITSgeomSDD256 &r){ r.Read(&is); return is; } -//====================================================================== -/* -$Log$ -Revision 1.18 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.17 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) -Revision 1.15.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.16 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.15 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ -//#include -//#include - -//#include "AliITSgeomSDD300.h" +//====================================================================== ClassImp(AliITSgeomSDD300) diff --git a/ITS/AliITSgeomSPD.cxx b/ITS/AliITSgeomSPD.cxx index a84292c73d8..d9a38502247 100644 --- a/ITS/AliITSgeomSPD.cxx +++ b/ITS/AliITSgeomSPD.cxx @@ -13,54 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry -tree for the ITS pixels. This fixes both the funny distribution of pixel -coordinates and the missing hits/digits/points in many sectors of the ITS -pixel barrel. Also included is a patch to properly get and use the detector -dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/04/26 22:44:34 nilsen -Bug fix. - -Revision 1.9 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.8 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////// // This class is for the Silicon Pixel Detector, SPD, specific geometry. @@ -266,68 +219,6 @@ istream &operator>>(istream &is,AliITSgeomSPD &r){ } //===================================================================== -/* -$Log$ -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/04/26 22:44:34 nilsen -Bug fix. - -Revision 1.9 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.8 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.7 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.1.2.8 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.6 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.4 2000/06/10 20:34:37 nilsen -Fixed compilation warning with HP unix. - -Revision 1.3 2000/06/10 10:43:04 nilsen -Fixed bug in copy and operator =. - -*/ - -//#include "AliITSgeomSPD300.h" - ClassImp(AliITSgeomSPD300) AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){ @@ -391,68 +282,6 @@ istream &operator>>(istream &is,AliITSgeomSPD300 &r){ return is; } //===================================================================== -/* -$Log$ -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/04/26 22:44:34 nilsen -Bug fix. - -Revision 1.9 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.8 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.7 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.1.2.8 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.6 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.4 2000/06/10 20:34:22 nilsen -Fixed compilation warning with HP unix. - -Revision 1.3 2000/06/10 10:42:49 nilsen -Fixed bug in copy and operator =. - - -*/ - -//#include "AliITSgeomSPD425Short.h" ClassImp(AliITSgeomSPD425Short) @@ -546,69 +375,6 @@ istream &operator>>(istream &is,AliITSgeomSPD425Short &r){ } //====================================================================== -/* -$Log$ -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/04/26 22:44:34 nilsen -Bug fix. - -Revision 1.9 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.8 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.7 2000/10/02 16:32:35 barbera -Forward declaration added - -Revision 1.1.2.8 2000/10/02 15:52:05 barbera -Forward declaration added - -Revision 1.6 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.4 2000/06/10 20:34:22 nilsen -Fixed compilation warning with HP unix. - -Revision 1.3 2000/06/10 10:42:49 nilsen -Fixed bug in copy and operator =. - - -*/ - -//#include "AliITSgeomSPD425Long.h" - ClassImp(AliITSgeomSPD425Long) AliITSgeomSPD425Long::AliITSgeomSPD425Long(){ diff --git a/ITS/AliITSgeomSSD.cxx b/ITS/AliITSgeomSSD.cxx index 6e0321e16e6..434ac2be1ad 100644 --- a/ITS/AliITSgeomSSD.cxx +++ b/ITS/AliITSgeomSSD.cxx @@ -13,69 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2002/12/03 09:03:06 hristov -Changes needed on Itanium (F.Carminati) - -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -Revision 1.8 2000/10/02 16:32:43 barbera -Forward declaration added - -Revision 1.2.4.8 2000/10/02 15:53:49 barbera -Forward declaration added - -Revision 1.7 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.2.4.2 2000/03/04 23:55:59 nilsen -Fixed up the comments/documentation - -Revision 1.2.4.1 2000/01/12 19:03:32 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.2 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////// // This class is for the Silicon Strip Detector, SSD, specific geometry. @@ -309,52 +247,6 @@ istream &operator>>(istream &is,AliITSgeomSSD &r){ return is; } //====================================================================== -/* -$Log$ -Revision 1.18 2002/12/03 09:03:06 hristov -Changes needed on Itanium (F.Carminati) - -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ - -//#include "AliITSgeomSSD175.h" ClassImp(AliITSgeomSSD175) @@ -408,52 +300,6 @@ istream &operator>>(istream &is,AliITSgeomSSD175 &r){ return is; } //====================================================================== -/* -$Log$ -Revision 1.18 2002/12/03 09:03:06 hristov -Changes needed on Itanium (F.Carminati) - -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ - -//#include "AliITSgeomSSD275and75.h" ClassImp(AliITSgeomSSD275and75) @@ -516,51 +362,6 @@ istream &operator>>(istream &is,AliITSgeomSSD275and75 &r){ return is; } //====================================================================== -/* -$Log$ -Revision 1.18 2002/12/03 09:03:06 hristov -Changes needed on Itanium (F.Carminati) - -Revision 1.17 2002/10/22 14:45:41 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.14 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.13 2001/10/12 22:07:20 nilsen -A patch for C++ io manipulation functions so that they will work both -with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with -other platforms. - -Revision 1.12 2001/08/24 21:06:37 nilsen -Added more documentation, fixed up some coding violations, and some -forward declorations. - -Revision 1.11 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.10 2001/02/09 00:00:57 nilsen -Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed -bugs in iostream based streamers used to read and write .det files. Fixed -some detector sizes. Fixed bugs in some default-special constructors. - -Revision 1.9 2001/02/03 00:00:30 nilsen -New version of AliITSgeom and related files. Now uses automatic streamers, -set up for new formatted .det file which includes detector information. -Additional smaller modifications are still to come. - -*/ -//#include "AliITSgeomSSD75and275.h" ClassImp(AliITSgeomSSD75and275) diff --git a/ITS/AliITShit.cxx b/ITS/AliITShit.cxx index 121b3333181..b298beaeebc 100644 --- a/ITS/AliITShit.cxx +++ b/ITS/AliITShit.cxx @@ -13,75 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2002/12/03 09:03:06 hristov -Changes needed on Itanium (F.Carminati) - -Revision 1.20 2002/10/22 14:45:42 alibrary -Introducing Riostream.h - -Revision 1.19 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.13.6.3 2002/08/28 15:06:50 alibrary -Updating to v3-09-01 - -Revision 1.18 2002/08/07 18:37:53 nilsen -Removed endl from print function. should be supplied by user as wanted. - -Revision 1.17 2002/06/20 09:10:14 hristov -Data member ft0 initialized - -Revision 1.16 2002/06/19 21:12:37 nilsen -Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri -for finding it and pointing it out. - -Revision 1.15 2002/06/12 18:59:47 nilsen -Added Starting track location to hit class and related changes to modules. -This is at present still fully backwards compatible since starting hits -are still written to the file. When aliroot v4.0 will be released, this -backwards compatiblity will be broken by removing the enterence hit, and making -the nessesary changes to module at that time. - -Revision 1.14 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.13 2002/03/09 18:35:35 nilsen -Added functions to print out Hit data members. - -Revision 1.12 2002/03/08 16:05:05 nilsen -Standeard io streamers added to make debugging et al. easier. - -Revision 1.11 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.10 2001/01/26 20:01:19 hristov -Major upgrade of AliRoot code - -Revision 1.9 2000/10/02 16:32:51 barbera -Automatic streamer used and forward declarations added - -Revision 1.3.4.7 2000/10/02 15:54:49 barbera -Automatic streamer used and forward declarations added - -Revision 1.8 2000/09/22 12:35:21 nilsen -Traps placed incase it is used without a properly initilized AliITSgeom class. - -Revision 1.7 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.3.4.2 2000/03/04 23:43:57 nilsen -Fixed up the comments/documentation. - -Revision 1.3.4.1 2000/01/12 19:03:32 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.3 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ #include diff --git a/ITS/AliITShitDigitizer.cxx b/ITS/AliITShitDigitizer.cxx index e82e88d39cc..b6f28daf3f6 100644 --- a/ITS/AliITShitDigitizer.cxx +++ b/ITS/AliITShitDigitizer.cxx @@ -13,20 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2002/03/15 17:25:54 nilsen -Renaming of old hit based Digitizer to make room for new SDigit version. - -Revision 1.1 2001/11/27 16:27:28 nilsen -Adding AliITSDigitizer class to do merging and digitization . Based on the -TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h -file. The following files required minor changes. AliITS, added functions -SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD. -AliITSsimulationSDD.cxx needed a Tree indepenent way of returning back to -the original Root Directory in function Compress1D. Now it uses gDirectory. - -*/ +/* $Id$ */ #include #include diff --git a/ITS/AliITSmodule.cxx b/ITS/AliITSmodule.cxx index d18710d7a95..055f1731745 100644 --- a/ITS/AliITSmodule.cxx +++ b/ITS/AliITSmodule.cxx @@ -14,71 +14,18 @@ **************************************************************************/ /* -$Log$ -Revision 1.15 2003/03/21 13:58:14 masera -Fix to avoid out-of-detector fast rec points (problem occurring for tracks entering and exiting the same side of a sensitive volume) - -Revision 1.14 2002/10/14 14:57:00 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.10.4.2 2002/07/24 09:27:50 alibrary -Updating on VirtualMC - -Revision 1.13 2002/06/12 18:59:47 nilsen -Added Starting track location to hit class and related changes to modules. -This is at present still fully backwards compatible since starting hits -are still written to the file. When aliroot v4.0 will be released, this -backwards compatiblity will be broken by removing the enterence hit, and making -the nessesary changes to module at that time. - -Revision 1.12 2002/06/10 17:31:03 nilsen -Replaced TArrayI expansion with Root version. - -Revision 1.11 2002/06/04 18:43:15 nilsen -Fix to avoid divide by zero problem in MedianHitG and MedianHitL for track -that enter and exit the same side of a detector sensitive volume. Needed -for Fast simulation. Thanks to Nicola Carrer. - -Revision 1.10 2002/03/15 17:21:54 nilsen -Removed zero-ing of fModules variable in constructors. - -Revision 1.9 2000/10/04 19:46:39 barbera -Corrected by F. Carminati for v3.04 - -Revision 1.8 2000/10/02 16:32:57 barbera -Forward declarations added and formatting - -Revision 1.3.4.8 2000/10/02 15:55:26 barbera -Forward declarations added and formatting - -Revision 1.7 2000/09/22 12:36:38 nilsen -Minor changes to improve compilation and create less NOISE. - -Revision 1.6 2000/07/10 16:07:18 fca -Release version of ITS code - -Revision 1.3.4.2 2000/03/02 21:42:29 nilsen -Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints -to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM. -Removed the deletion of fDigitsM from the distructor since it is only a copy -of what is in AliDetector. Fixed a bug in the functions LineSegmentL and -LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to -additionaly return track number from the hit. Removed FastPoint function, -haven't found anywere it was used, also it had very many problems, should -just call FastPointSPD... . - -Revision 1.3.4.1 2000/01/12 19:03:32 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.3 1999/10/04 15:20:12 fca -Correct syntax accepted by g++ but not standard for static members, remove minor warnings - -Revision 1.2 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - + $Id$ */ +/* + $Log$ + Revision 1.9.8.4 2003/06/13 16:31:00 nilsen + Introducing a backward incompatibility to hit files created before June 12 + 2002. The enterance hit is no longer recorded. The starting position of + every hit is used instead. Added GetPositionL0 to AliITShit, fixed up + AliITSmodule to use starting location of hit and not enterance hits, and + StepManager in AliITSvPPRasymm no longer records enterence hit to hit file. +*/ #include #include @@ -142,20 +89,18 @@ AliITSmodule::AliITSmodule(const AliITSmodule &source){ //////////////////////////////////////////////////////////////////////// // Copy Constructor //////////////////////////////////////////////////////////////////////// - printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n"); + Error("AliITSmodule","AliITSmodule class has not to be copied! Exit."); exit(1); } - //_____________________________________________________________________________ AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){ //////////////////////////////////////////////////////////////////////// // Assignment operator //////////////////////////////////////////////////////////////////////// - printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n"); + Error("AliITSmodule","AliITSmodule class has not to be copied! Exit."); exit(1); return *this; // fake return neded on Sun -} - +} //_________________________________________________________________________ // // Hits management @@ -229,26 +174,23 @@ Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b, Double_t &c,Double_t &d, Double_t &e,Double_t &f,Double_t &de){ // line segment - static Int_t hitindex0; - AliITShit *h0,*h1; + AliITShit *h1; + Double_t t; if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; h1 = (AliITShit *) (fHitsM->At(hitindex)); if(h1->StatusEntering()){ // if track entering volume, get index for next // step - hitindex0 = hitindex; return kFALSE; } // end if StatusEntering() // else stepping - h0 = (AliITShit *) (fHitsM->At(hitindex0)); de = h1->GetIonization(); - h0->GetPositionL(a,c,e); + h1->GetPositionL0(a,c,e,t); h1->GetPositionL(b,d,f); b = b - a; d = d - c; f = f - e; - hitindex0 = hitindex; return kTRUE; } //___________________________________________________________________________ @@ -256,26 +198,23 @@ Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b, Double_t &c,Double_t &d, Double_t &e,Double_t &f,Double_t &de){ // line segment - static Int_t hitindex0; - AliITShit *h0,*h1; + AliITShit *h1; + Double_t t; if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; h1 = (AliITShit *) (fHitsM->At(hitindex)); if(h1->StatusEntering()){ // if track entering volume, get index for next // step - hitindex0 = hitindex; return kFALSE; } // end if StatusEntering() // else stepping - h0 = (AliITShit *) (fHitsM->At(hitindex0)); de = h1->GetIonization(); - h0->GetPositionG(a,c,e); + h1->GetPositionG0(a,c,e,t); h1->GetPositionG(b,d,f); b = b - a; d = d - c; f = f - e; - hitindex0 = hitindex; return kTRUE; } //___________________________________________________________________________ @@ -284,27 +223,24 @@ Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b, Double_t &e,Double_t &f, Double_t &de,Int_t &track){ // line segmente - static Int_t hitindex0; - AliITShit *h0,*h1; + AliITShit *h1; + Double_t t; if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; h1 = (AliITShit *) (fHitsM->At(hitindex)); if(h1->StatusEntering()){ // if track entering volume, get index for next // step - hitindex0 = hitindex; track = h1->GetTrack(); return kFALSE; } // end if StatusEntering() // else stepping - h0 = (AliITShit *) (fHitsM->At(hitindex0)); de = h1->GetIonization(); - h0->GetPositionL(a,c,e); + h1->GetPositionL0(a,c,e,t); h1->GetPositionL(b,d,f); b = b - a; d = d - c; f = f - e; - hitindex0 = hitindex; track = h1->GetTrack(); return kTRUE; } @@ -314,27 +250,24 @@ Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b, Double_t &e,Double_t &f, Double_t &de,Int_t &track){ // line segment - static Int_t hitindex0; - AliITShit *h0,*h1; + AliITShit *h1; + Double_t t; if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; h1 = (AliITShit *) (fHitsM->At(hitindex)); if(h1->StatusEntering()){ // if track entering volume, get index for next // step - hitindex0 = hitindex; track = h1->GetTrack(); return kFALSE; } // end if StatusEntering() // else stepping - h0 = (AliITShit *) (fHitsM->At(hitindex0)); de = h1->GetIonization(); - h0->GetPositionG(a,c,e); + h1->GetPositionG0(a,c,e,t); h1->GetPositionG(b,d,f); b = b - a; d = d - c; f = f - e; - hitindex0 = hitindex; track = h1->GetTrack(); return kTRUE; } diff --git a/ITS/AliITSneuralTracker.h b/ITS/AliITSneuralTracker.h index f67bdde9540..76ed52a1c10 100644 --- a/ITS/AliITSneuralTracker.h +++ b/ITS/AliITSneuralTracker.h @@ -127,6 +127,7 @@ private: AliITSglobalRecPoint *fInner; // inner point AliITSglobalRecPoint *fOuter; // outer point + ClassDef(AliITSneuron,1) // neural tracker helper class }; diff --git a/ITS/AliITSpList.cxx b/ITS/AliITSpList.cxx index 536ae091448..0be10eff0b2 100644 --- a/ITS/AliITSpList.cxx +++ b/ITS/AliITSpList.cxx @@ -12,6 +12,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ #include @@ -328,22 +329,6 @@ AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){ this->fTsignal = source.fTsignal; this->fNoise = source.fNoise; this->fSignalAfterElect = source.fSignalAfterElect; - /* - cout <<"this fTrack[0-9]="; - for(i=0;ifkSize;i++) cout <fTrack[i]<<","; - cout <<" fHits[0-9]="; - for(i=0;ifkSize;i++) cout <fHits[i]<<","; - cout <<" fSignal[0-9]="; - for(i=0;ifkSize;i++) cout <fSignal[i]<<","; - cout << endl; - cout <<"source fTrack[0-9]="; - for(i=0;ifkSize;i++) cout < @@ -92,7 +93,7 @@ istream & operator>>(istream &is,AliITSpListItem &source); #define ALIITSPLISTSSD_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -/* $Id$ */ + #include "AliITSMap.h" class TObjArray; diff --git a/ITS/AliITSpackageSSD.cxx b/ITS/AliITSpackageSSD.cxx index 5395a24ba80..e49498bcdb6 100644 --- a/ITS/AliITSpackageSSD.cxx +++ b/ITS/AliITSpackageSSD.cxx @@ -13,23 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/22 14:45:42 alibrary -Introducing Riostream.h - -Revision 1.5 2001/11/19 16:17:03 nilsen -Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal -bugs found by Rene require more work to fix. Will be fixed soon. - -Revision 1.4 2000/07/12 05:32:20 fca -Correcting several syntax problem with static members - -*/ - -#include -#include -#include "AliITSpackageSSD.h" +/* $Id$ */ //************************************************ //Piotr Krzysztof Skowronski @@ -37,6 +21,10 @@ Correcting several syntax problem with static members //skowron@if.pw.edu.pl // +#include +#include +#include "AliITSpackageSSD.h" + const Bool_t AliITSpackageSSD::fgkSIDEP=kTRUE; const Bool_t AliITSpackageSSD::fgkSIDEN=kFALSE; diff --git a/ITS/AliITSreconstruction.cxx b/ITS/AliITSreconstruction.cxx index 06d5afb9896..10ff47931f7 100644 --- a/ITS/AliITSreconstruction.cxx +++ b/ITS/AliITSreconstruction.cxx @@ -13,35 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3.6.2 2002/10/14 13:14:08 hristov -Updating VirtualMC to v3-09-02 +/* $Id$ */ -Revision 1.6 2002/09/09 17:30:02 nilsen -Added new creator which passes a pointer to type AliRun. Can now use either -gAlice or a local instance of AliRun. - -Revision 1.5 2002/05/13 14:27:57 hristov -TreeC created once per event (M.Masera) - -Revision 1.4 2002/05/10 22:31:30 nilsen -Changes by Massimo Masera to allow Recpoints and Clusters to be written -to separate files. - -Revision 1.3 2002/02/06 13:52:27 barbera -gAlice deletion corrected (from M. Masera) - -Revision 1.2 2002/01/31 18:52:09 nilsen -Minor change to allow the use of files that are already open. grun.C macro -that also does ITS digitizationa and Reconstruction all in one go. - -Revision 1.1 2002/01/30 22:20:22 nilsen -New TTask based method to do Digits To clusters. Works with files of multiple -events in the file. Macro added to show how to use. Also the changes made -in the nessesary complilation files. - -*/ #include #include #include @@ -49,9 +22,11 @@ in the nessesary complilation files. #include #include "AliRun.h" +#include "AliRunLoader.h" #include "AliITS.h" #include "AliITSDetType.h" +#include "AliITSLoader.h" #include "AliITSreconstruction.h" #include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" @@ -65,7 +40,15 @@ in the nessesary complilation files. ClassImp(AliITSreconstruction) //______________________________________________________________________ -AliITSreconstruction::AliITSreconstruction(){ +AliITSreconstruction::AliITSreconstruction(): + fInit(kFALSE), + fEnt(0), + fEnt0(0), + fITS(0x0), + fDfArp(kFALSE), + fLoader(0x0), + fRunLoader(0x0) +{ // Default constructor. // Inputs: // none. @@ -73,38 +56,31 @@ AliITSreconstruction::AliITSreconstruction(){ // none. // Return: // A zero-ed constructed AliITSreconstruction class. - - fFilename = ""; - fFile = 0; - fFile2 = 0; - fITS = 0; fDet[0] = fDet[1] = fDet[2] = kTRUE; - fInit = kFALSE; - fArp = 0; - fDfArp = kFALSE; } //______________________________________________________________________ -AliITSreconstruction::AliITSreconstruction(AliRun *ar){ - // Standard constructor. - // Inputs: - // AliRun *ar Pointer to an existing AliRun object. Assumed that - // this AliRun object will not be deleted by this distructor. - // Outputs: - // none. - // Return: - // A standardly constructed AliITSreconstruction class. - fFilename = ""; - fFile = 0; - fFile2 = 0; - fITS = 0; - fDet[0] = fDet[1] = fDet[2] = kTRUE; - fInit = kFALSE; - fDfArp = kFALSE; - fArp = ar; +AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl): + fInit(kFALSE), + fEnt(0), + fEnt0(0), + fITS(0x0), + fDfArp(kFALSE), + fLoader(0x0), + fRunLoader(rl) +{ + fDet[0] = fDet[1] = fDet[2] = kTRUE; } //______________________________________________________________________ -AliITSreconstruction::AliITSreconstruction(const char* filename){ +AliITSreconstruction::AliITSreconstruction(const char* filename): + fInit(kFALSE), + fEnt(0), + fEnt0(0), + fITS(0x0), + fDfArp(kFALSE), + fLoader(0x0), + fRunLoader(0x0) +{ // Standard constructor. // Inputs: // const char* filename filename containing the digits to be @@ -117,43 +93,29 @@ AliITSreconstruction::AliITSreconstruction(const char* filename){ // Return: // A standardly constructed AliITSreconstruction class. - fFilename = filename; - fFile2 = 0; - fFile = 0; - fArp = 0; - fDfArp = kTRUE; - if(filename){ - fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data()); - if(fFile) fFile->Close(); - fFile = new TFile(fFilename.Data(),"UPDATE"); - if(fArp) { - delete fArp; - fArp = 0; - } - fArp = (AliRun*)fFile->Get("gAlice"); - if(!fArp) { - cout << "gAlice not found on file. Aborting." << endl; - fInit = kFALSE; - return; - } // end if !fArp - } // end if !filename. + fDet[0] = fDet[1] = fDet[2] = kTRUE; + + fRunLoader = AliRunLoader::Open(filename); + if (fRunLoader == 0x0) + { + Error("AliITSreconstruction","Can not load the session",filename); + return; + } + fRunLoader->LoadgAlice(); + gAlice = fRunLoader->GetAliRun(); + + if(!gAlice) { + Error("AliITSreconstruction","gAlice not found on file. Aborting."); + fInit = kFALSE; + return; + } // end if !gAlice + } //______________________________________________________________________ AliITSreconstruction::~AliITSreconstruction(){ - // Default constructor. - // Inputs: - // none. - // Outputs: - // none. - // Return: // A destroyed AliITSreconstruction class. - - if(fFile) fFile->Close(); - fFile = 0; + delete fRunLoader; fITS = 0; - if(fDfArp){ - if(fArp) delete fArp; - } // end if } //______________________________________________________________________ Bool_t AliITSreconstruction::Init(){ @@ -164,28 +126,51 @@ Bool_t AliITSreconstruction::Init(){ // none. // Return: // kTRUE if no errors initilizing this class occurse else kFALSE - Int_t nparticles; - fITS = (AliITS*) fArp->GetDetector("ITS"); + Info("Init",""); + if (fRunLoader == 0x0) + { + Error("Init","Run Loader is NULL"); + return kFALSE; + } + fRunLoader->LoadgAlice(); + fRunLoader->LoadHeader(); + + fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); + if(!fLoader) { + Error("Init","ITS loader not found"); + fInit = kFALSE; + } + + //Int_t retcode; + fITS = (AliITS*) gAlice->GetDetector("ITS"); if(!fITS){ - cout << "ITS not found aborting. fITS=" << fITS << endl; - fInit = kFALSE; - return fInit; + cout << "ITS not found aborting. fITS=" << fITS << endl; + fInit = kFALSE; + return fInit; } // end if !fITS if(!(fITS->GetITSgeom())){ - cout << "ITSgeom not found aborting."<< endl; - fInit = kFALSE; - return fInit; + cout << "ITSgeom not found aborting."<< endl; + fInit = kFALSE; + return fInit; } // end if !GetITSgeom() // Now ready to init. fDet[0] = fDet[1] = fDet[2] = kTRUE; fEnt0 = 0; - fEnt = fArp->GetEventsPerRun(); - fITS->MakeTreeC(); - nparticles = fArp->GetEvent(fEnt0); - - // finished init. + + fEnt = gAlice->GetEventsPerRun(); + + fLoader->LoadDigits("read"); + fLoader->LoadRecPoints("recreate"); + fLoader->LoadRawClusters("recreate"); + if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); + fITS->MakeBranch("R"); + fITS->MakeBranchC(); + fITS->SetTreeAddress(); fInit = InitRec(); + + Info("Init"," Done\n\n\n"); + return fInit; } //______________________________________________________________________ @@ -201,41 +186,42 @@ Bool_t AliITSreconstruction::InitRec(){ // SPD if(fDet[kSPD]){ - idt = fITS->DetType(kSPD); - AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*) - idt->GetSegmentationModel(); - TClonesArray *digSPD = fITS->DigitsAddress(kSPD); - TClonesArray *recpSPD = fITS->ClustersAddress(kSPD); - AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD, - digSPD, - recpSPD); - fITS->SetReconstructionModel(kSPD,recSPD); + Info("InitRec","SPD"); + idt = fITS->DetType(kSPD); + AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)idt->GetSegmentationModel(); + TClonesArray *digSPD = fITS->DigitsAddress(kSPD); + TClonesArray *recpSPD = fITS->ClustersAddress(kSPD); + Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",idt,digSPD,recpSPD); + AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD); + fITS->SetReconstructionModel(kSPD,recSPD); } // end if fDet[kSPD]. // SDD if(fDet[kSDD]){ - idt = fITS->DetType(kSDD); - AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*) - idt->GetSegmentationModel(); - AliITSresponseSDD *resSDD = (AliITSresponseSDD*) - idt->GetResponseModel(); - TClonesArray *digSDD = fITS->DigitsAddress(kSDD); - TClonesArray *recpSDD = fITS->ClustersAddress(kSDD); - AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD, - resSDD, - digSDD,recpSDD); - fITS->SetReconstructionModel(kSDD,recSDD); + Info("InitRec","SDD"); + idt = fITS->DetType(kSDD); + AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*) + idt->GetSegmentationModel(); + AliITSresponseSDD *resSDD = (AliITSresponseSDD*) + idt->GetResponseModel(); + TClonesArray *digSDD = fITS->DigitsAddress(kSDD); + TClonesArray *recpSDD = fITS->ClustersAddress(kSDD); + AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD, + resSDD, + digSDD,recpSDD); + fITS->SetReconstructionModel(kSDD,recSDD); } // end if fDet[kSDD] // SSD if(fDet[kSSD]){ - idt = fITS->DetType(kSSD); - AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*) - idt->GetSegmentationModel(); - TClonesArray *digSSD = fITS->DigitsAddress(kSSD); - AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD, - digSSD); - fITS->SetReconstructionModel(kSSD,recSSD); + Info("InitRec","SSD"); + idt = fITS->DetType(kSSD); + AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*) + idt->GetSegmentationModel(); + TClonesArray *digSSD = fITS->DigitsAddress(kSSD); + AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD, + digSSD); + fITS->SetReconstructionModel(kSSD,recSSD); } // end if fDet[kSSD] - + Info("InitRec"," Done\n"); return kTRUE; } //______________________________________________________________________ @@ -248,51 +234,42 @@ void AliITSreconstruction::Exec(const Option_t *opt){ // Return: // none. Option_t *lopt; - Int_t nparticles,evnt; + Int_t evnt; if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){ - fDet[0] = fDet[1] = fDet[2] = kTRUE; - lopt = "All"; + fDet[0] = fDet[1] = fDet[2] = kTRUE; + lopt = "All"; }else{ - fDet[0] = fDet[1] = fDet[2] = kFALSE; - if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE; - if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE; - if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE; - if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All"; - else lopt = opt; + fDet[0] = fDet[1] = fDet[2] = kFALSE; + if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE; + if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE; + if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE; + if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All"; + else lopt = opt; } // end if strstr(opt,...) if(!fInit){ - cout << "Initilization Failed, Can't run Exec." << endl; - return; + cout << "Initilization Failed, Can't run Exec." << endl; + return; } // end if !fInit - TDirectory *curr = gDirectory; - if(fFile2)fFile2->cd(); - for(evnt=0;evntGetEvent(evnt); - fArp->SetEvent(evnt); - if(!fArp->TreeR()){ - if(fFile2){ - fArp->MakeTree("R",fFile2); - } - else { - fArp->MakeTree("R"); - } - } + + for(evnt=0;evntGetEvent(evnt); + if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); fITS->MakeBranch("R"); - fITS->MakeTreeC(); + if (fLoader->TreeC() == 0x0) fITS->MakeTreeC(); + fITS->SetTreeAddress(); fITS->DigitsToRecPoints(evnt,0,lopt); } // end for evnt - curr->cd(); } //______________________________________________________________________ void AliITSreconstruction::SetOutputFile(TString filename){ // Set a file name for recpoints. Used only if this file is not the file // containing digits. This obj is deleted by AliRun. - fFile2 = fArp->InitTreeFile("R",filename); + Error("SetOutputFile","Use AliLoader::SetRecPointsFileName(TString&)instead"); } - - - - - diff --git a/ITS/AliITSreconstruction.h b/ITS/AliITSreconstruction.h index 74e0f74a365..c002196ae62 100644 --- a/ITS/AliITSreconstruction.h +++ b/ITS/AliITSreconstruction.h @@ -9,7 +9,7 @@ #include -class AliRun; +class AliRunLoader; class TString; class AliITS; @@ -17,7 +17,7 @@ class AliITSreconstruction : public TTask{ public: AliITSreconstruction(); // default constructor AliITSreconstruction(const char *filename); // standard constructor - AliITSreconstruction(AliRun *ar); // standard constructor + AliITSreconstruction(AliRunLoader *rl); // standard constructor virtual ~AliITSreconstruction();//Destructor virtual Bool_t Init(); virtual void Exec(const Option_t *opt="ALL"); @@ -25,18 +25,15 @@ class AliITSreconstruction : public TTask{ private: Bool_t InitRec(); // Standard Reconstrution initilization. private: - TFile *fFile; //! pointer to the file contatining the digits and - // and will contain the RecPoints - TFile *fFile2; //! pointer to the file that will contain RecPoints - // (set only if <>fFile) Bool_t fDet[3]; //! logical specifing which detectors to reconstruct. Bool_t fInit; //! True if Init was sucessfull, else false. - TString fFilename; //! input filename for Digits Int_t fEnt; //! Number of events to processevent index. Int_t fEnt0; //! first event to process, default 0. AliITS *fITS; //! Local pointer to ITS class. - AliRun *fArp; //! Local pointer to AliRun or gAlice - Bool_t fDfArp; //! if True then delete fArp in destructor. + Bool_t fDfArp; //! if True then delete fRunLoader in destructor. + + AliITSLoader *fLoader; //! ITS loader + AliRunLoader* fRunLoader;//!Run Loader ClassDef(AliITSreconstruction,2) // Task to Reconstruct ITS from Digits. diff --git a/ITS/AliITSresponseSDD.cxx b/ITS/AliITSresponseSDD.cxx index 5c61da9b64a..33130777e11 100644 --- a/ITS/AliITSresponseSDD.cxx +++ b/ITS/AliITSresponseSDD.cxx @@ -12,17 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Id$ -$Log$ -Revision 1.18.4.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 -Revision 1.19 2002/04/24 22:02:31 nilsen -New SDigits and Digits routines, and related changes, (including new -noise values). - -*/ +/* $Id$ */ #include #include diff --git a/ITS/AliITSresponseSDD.h b/ITS/AliITSresponseSDD.h index 040822dee1e..c0e613614ad 100644 --- a/ITS/AliITSresponseSDD.h +++ b/ITS/AliITSresponseSDD.h @@ -7,6 +7,7 @@ /* $Id$ */ + #include "TArrayF.h" #include #include diff --git a/ITS/AliITSsDigitize.cxx b/ITS/AliITSsDigitize.cxx index ee861a3e0c4..0b7867123f9 100644 --- a/ITS/AliITSsDigitize.cxx +++ b/ITS/AliITSsDigitize.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2002/10/14 14:57:03 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.2.4.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.2 2002/05/19 18:17:03 hristov -Changes needed by ICC/IFC compiler (Intel) - -Revision 1.1 2002/03/28 16:25:26 nilsen -New TTask method for creating SDigits from Hits. - -*/ +/* $Id$ */ #include @@ -55,8 +41,7 @@ AliITSsDigitize::AliITSsDigitize(){ // Return: // A zero-ed constructed AliITSsDigitize class. - fFilename = ""; - fFile = 0; + fRunLoader = 0x0; fITS = 0; fDet[0] = fDet[1] = fDet[2] = kTRUE; fInit = kFALSE; @@ -75,24 +60,15 @@ AliITSsDigitize::AliITSsDigitize(const char* filename){ // Return: // A standardly constructed AliITSsDigitize class. - fFilename = filename; - - if(filename){ - fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data()); - if(fFile) fFile->Close(); - fFile = new TFile(fFilename.Data(),"UPDATE"); - // - if(gAlice) { - delete gAlice; - gAlice = 0; - } - gAlice = (AliRun*)fFile->Get("gAlice"); - if(!gAlice) { - cout << "gAlice not found on file. Aborting." << endl; - fInit = kFALSE; - return; - } // end if !gAlice - } // end if !filename. + if(gAlice) + { + delete gAlice; + gAlice = 0; + } + fRunLoader = AliRunLoader::Open(filename); + fRunLoader->LoadgAlice(); + fRunLoader->LoadHeader(); + Init(); } @@ -106,8 +82,7 @@ AliITSsDigitize::~AliITSsDigitize(){ // Return: // A destroyed AliITSsDigitize class. - if(fFile) fFile->Close(); - fFile = 0; + if(fRunLoader) delete fRunLoader; fITS = 0; } @@ -120,8 +95,8 @@ Bool_t AliITSsDigitize::Init(){ // none. // Return: // kTRUE if no errors initilizing this class occurse else kFALSE - Int_t nparticles; - + //Int_t nparticles; + fITS = (AliITS*) gAlice->GetDetector("ITS"); if(!fITS){ cout << "ITS not found aborting. fITS=" << fITS << endl; @@ -139,15 +114,17 @@ Bool_t AliITSsDigitize::Init(){ fEnt0 = 0; fEnt = gAlice->GetEventsPerRun(); - if(!gAlice->TreeS()){ + AliLoader* loader = fRunLoader->GetLoader("ITSLoader"); + + if(!loader->TreeS()){ cout << "Having to create the SDigits Tree." << endl; - gAlice->MakeTree("S"); + loader->MakeTree("S"); } // end if !gAlice->TreeS() //make branch fITS->MakeBranch("S"); fITS->SetTreeAddress(); - nparticles = gAlice->GetEvent(fEnt0); - + + fRunLoader->GetEvent(fEnt0); // finished init. fInit = InitSDig(); return fInit; @@ -194,5 +171,5 @@ void AliITSsDigitize::Exec(const Option_t *opt){ return; } // end if !fInit - fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," "); + fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," "); } diff --git a/ITS/AliITSsDigitize.h b/ITS/AliITSsDigitize.h index 2a1c733f07d..cee86c7059d 100644 --- a/ITS/AliITSsDigitize.h +++ b/ITS/AliITSsDigitize.h @@ -22,15 +22,15 @@ class AliITSsDigitize : public TTask{ private: Bool_t InitSDig(); // Standard SDigitization initilization. private: - TFile *fFile; //! pointer to the file contatining the hits and - // and will contain the SDigits +// TFile *fFile; //! pointer to the file contatining the hits and +// // and will contain the SDigits + Bool_t fDet[3]; //! logical specifing which detectors to reconstruct. Bool_t fInit; //! True if Init was sucessfull, else false. - TString fFilename; //! input filename for Hits Int_t fEnt; //! Number of events to processevent index. Int_t fEnt0; //! first event to process, default 0. AliITS *fITS; //! Local pointer to ITS class. - + AliRunLoader* fRunLoader;//!Run Loader ClassDef(AliITSsDigitize,1) // Task to SDigitize ITS from Hits. }; diff --git a/ITS/AliITSsegmentationSSD.cxx b/ITS/AliITSsegmentationSSD.cxx index 95e20d00c0b..af1b94d8972 100644 --- a/ITS/AliITSsegmentationSSD.cxx +++ b/ITS/AliITSsegmentationSSD.cxx @@ -12,28 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.15 2001/05/16 14:57:16 alibrary -New files for folders and Stack -Revision 1.14 2001/05/14 06:21:49 barbera -Some unuseful printout commented - -Revision 1.13 2001/05/14 05:44:11 barbera -Version 1.11 reput in place to avoid problem with reconstruction - -Revision 1.11 2001/05/03 16:12:37 nilsen -Fixed up LocalToDet, DetToLocal, GetCrossing, GetPadTxz to work with different -angles in layer 5 and 6. - -Revision 1.10 2001/05/01 22:42:22 nilsen -Update of SSD simulation and reconstruction code by Boris and Enrico. - -Revision 1.9 2001/04/27 14:16:50 nilsen -Remove dead and/or unused code and printout lines. i.e. cleaned it up a bit. - -*/ +/* $Id$ */ #include #include diff --git a/ITS/AliITSsimulation.h b/ITS/AliITSsimulation.h index 465c5d7a6bd..2ad8e9839e8 100644 --- a/ITS/AliITSsimulation.h +++ b/ITS/AliITSsimulation.h @@ -14,6 +14,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ #include diff --git a/ITS/AliITSsimulationFastPoints.cxx b/ITS/AliITSsimulationFastPoints.cxx index 2c2c2a1d6fb..b4b6ef08b45 100644 --- a/ITS/AliITSsimulationFastPoints.cxx +++ b/ITS/AliITSsimulationFastPoints.cxx @@ -13,39 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9.8.1 2002/07/24 09:27:50 alibrary -Updating on VirtualMC +/* $Id$ */ -Revision 1.11 2002/07/11 10:24:21 barbera -Fixes to make tracking V2 working with the HEAD and with fast points. Waiting for a fix in slow reconstruction of SPD, fast points are temporarily made the default for tracking V2. - -Revision 1.10 2002/06/10 17:30:24 nilsen -A new CreateFastRecPoints has been made and the old one made compatible. - -Revision 1.9 2001/10/01 19:36:03 nilsen -fixed a compilation warning about unused variable. - -Revision 1.8 2001/07/27 08:06:49 hristov -Use global gRandom generator (M.Ivanov) - -Revision 1.7 2001/05/11 09:15:21 barbera -Corrected to make fast point creation working with PPR geometry - -Revision 1.6 2000/10/29 18:30:14 barbera -Z resolution of pixel changed according with the default lenght of 425 microns - -Revision 1.1.2.6 2000/10/29 18:29:51 barbera -Z resolution of pixel changed according with the default lenght of 425 microns - -Revision 1.1.2.5 2000/10/02 16:03:20 barbera -Forward declarations added - -Revision 1.4 2000/09/22 12:43:59 nilsen -Default track number set to -3 and not 0. - -*/ #include #include "AliITS.h" diff --git a/ITS/AliITSsimulationSDD.cxx b/ITS/AliITSsimulationSDD.cxx index af298d2c291..26bfc9aabb2 100644 --- a/ITS/AliITSsimulationSDD.cxx +++ b/ITS/AliITSsimulationSDD.cxx @@ -12,29 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Id$ - $Log$ - Revision 1.37 2002/10/14 14:57:07 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.32.4.4 2002/10/14 13:14:08 hristov - Updating VirtualMC to v3-09-02 - - Revision 1.36 2002/09/11 10:32:41 hristov - Use new for arrays with variable size - - Revision 1.35 2002/09/09 17:23:28 nilsen - Minor changes in support of changes to AliITSdigitS?D class'. - Revision 1.34 2002/06/07 16:32:28 nilsen - Latest SDD changes to speed up the SDD simulation code. - - Revision 1.33 2002/04/24 22:02:31 nilsen - New SDigits and Digits routines, and related changes, (including new - noise values). - - */ +/* $Id$ */ #include #include @@ -864,128 +843,6 @@ void AliITSsimulationSDD::AddDigit( Int_t i, Int_t j, Int_t signal ) { delete [] charges; } -/* -//____________________________________________ -void AliITSsimulationSDD::AddDigit(Int_t i, Int_t j, Int_t signal){ - // Adds a Digit. - // tag with -1 signals coming from background tracks - // tag with -2 signals coming from pure electronic noise - - Int_t digits[3], tracks[3], hits[3]; - Float_t phys, charges[3]; - - Int_t trk[20], htrk[20]; - Float_t chtrk[20]; - - Bool_t do10to8=fResponse->Do10to8(); - - if(do10to8) signal=Convert8to10(signal); - AliITSTransientDigit *obj = (AliITSTransientDigit*)fHitMap1->GetHit(i,j); - digits[0] = i; - digits[1] = j; - digits[2] = signal; - if (!obj) { - phys=0; - Int_t k; - for (k=0;k<3;k++) { - tracks[k]=-2; - charges[k]=0; - hits[k]=-1; - } // end for k - fITS->AddSimDigit(1,phys,digits,tracks,hits,charges); - } else { - phys=obj->fPhysics; - TObjArray* trlist=(TObjArray*)obj->TrackList(); - Int_t nptracks=trlist->GetEntriesFast(); - if (nptracks > 20) { - Warning("AddDigit","nptracks=%d > 20 nptracks set to 20",nptracks); - nptracks=20; - } // end if nptracks > 20 - Int_t tr; - for (tr=0;trAt(tr)); - trk[tr]=Int_t(pp(0)); - htrk[tr]=Int_t(pp(1)); - chtrk[tr]=(pp(2)); - } // end for tr - if (nptracks > 1) { - SortTracks(trk,chtrk,htrk,nptracks); - } // end if nptracks > 1 - Int_t i; - if (nptracks < 3 ) { - for (i=0; iAddSimDigit(1,phys,digits,tracks,hits,charges); - - } // end if/else !obj -} - - -//______________________________________________________________________ -void AliITSsimulationSDD::SortTracks(Int_t *tracks,Float_t *charges, - Int_t *hits,Int_t ntr){ - // Sort the list of tracks contributing to a given digit - // Only the 3 most significant tracks are acctually sorted - // Loop over signals, only 3 times - - Float_t qmax; - Int_t jmax; - Int_t idx[3] = {-3,-3,-3}; - Float_t jch[3] = {-3,-3,-3}; - Int_t jtr[3] = {-3,-3,-3}; - Int_t jhit[3] = {-3,-3,-3}; - Int_t i,j,imax; - - if (ntr<3) imax = ntr; - else imax = 3; - for(i=0;i qmax) { - qmax = charges[j]; - jmax=j; - } // end if charges[j]>qmax - } // end for j - if(qmax > 0) { - idx[i] = jmax; - jch[i] = charges[jmax]; - jtr[i] = tracks[jmax]; - jhit[i] = hits[jmax]; - } // end if qmax > 0 - } // end for i - - for(i=0;i<3;i++){ - if (jtr[i] == -3) { - charges[i] = 0; - tracks[i] = -3; - hits[i] = -1; - } else { - charges[i] = jch[i]; - tracks[i] = jtr[i]; - hits[i] = jhit[i]; - } // end if jtr[i] == -3 - } // end for i -} -*/ //______________________________________________________________________ void AliITSsimulationSDD::ChargeToSignal(Bool_t bAddNoise) { // add baseline, noise, electronics and ADC saturation effects @@ -1565,11 +1422,6 @@ void AliITSsimulationSDD::Compress1D(){ // this if(TMath::Abs(diff)= -2 && diff <= 1)) diff=0; - if (tol==2 && (diff >= -4 && diff <= 3)) diff=0; - if (tol==3 && (diff >= -16 && diff <= 15)) diff=0; - */ AddDigit(idx,j,last+diff); } else { AddDigit(idx,j,signal); diff --git a/ITS/AliITSsimulationSDD.h b/ITS/AliITSsimulationSDD.h index a1f5cf99ef8..bc0e770d2dd 100644 --- a/ITS/AliITSsimulationSDD.h +++ b/ITS/AliITSsimulationSDD.h @@ -2,6 +2,7 @@ #define ALIITSSIMULATIONSDD_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ + /* $Id$ */ #include diff --git a/ITS/AliITSsimulationSPD.cxx b/ITS/AliITSsimulationSPD.cxx index e923559021f..3082870f492 100644 --- a/ITS/AliITSsimulationSPD.cxx +++ b/ITS/AliITSsimulationSPD.cxx @@ -13,50 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.22 2002/10/22 14:45:44 alibrary -Introducing Riostream.h - -Revision 1.21 2002/10/14 14:57:08 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.4.3 2002/10/14 13:14:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.20 2002/09/11 10:32:41 hristov -Use new for arrays with variable size - -Revision 1.19 2002/09/09 17:23:28 nilsen -Minor changes in support of changes to AliITSdigitS?D class'. - -Revision 1.18 2002/08/21 22:11:13 nilsen -Debug output now settable via a DEBUG flag. - -Revision 1.17 2002/07/16 17:00:17 barbera -Fixes added to make the slow simulation running with the current HEAD (from M. Masera) +/* $Id$ */ -Revision 1.16 2002/06/19 16:02:22 hristov -Division by zero corrected - -Revision 1.15 2002/03/15 17:32:14 nilsen -Reintroduced SDigitization, and Digitization from SDigits, along with -functions InitSimulationModule, and FinishSDigitizModule. - -Revision 1.14 2001/11/23 13:04:07 barbera -Some protection added in case of high multiplicity - -Revision 1.13 2001/11/13 11:13:24 barbera -A protection against tracks with the same entrance and exit has been made more strict - -Revision 1.12 2001/10/04 22:44:31 nilsen -Major changes in supppor of PreDigits (SDigits). Changes made with will make -it easier to suppor expected changes in AliITSHit class. Added use of new -class AliITSpList. Both SPD and SDD have added effects of Dead Channels. Both -of these will require addtional work as data bases of detectors and the like -are developed. - -*/ #include #include #include diff --git a/ITS/AliITSsimulationSPDdubna.cxx b/ITS/AliITSsimulationSPDdubna.cxx index ac18a05c177..dd9ebedf126 100644 --- a/ITS/AliITSsimulationSPDdubna.cxx +++ b/ITS/AliITSsimulationSPDdubna.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.3.6.2 2003/05/19 16:24:40 hristov +Merging with v3-09-09 (partial, AliITCclustererV2 is excluded from compilation and has to be adapted to NewIO, AliITStrackerV2 needs additional changes) + +Revision 1.10 2003/01/22 01:58:38 nilsen +Small patch to allow new Dubna modle to reproduce BS model. + Revision 1.9 2002/10/22 14:45:45 alibrary Introducing Riostream.h diff --git a/ITS/AliITSsimulationSSD.cxx b/ITS/AliITSsimulationSSD.cxx index a7a72015ab2..427f38c9594 100644 --- a/ITS/AliITSsimulationSSD.cxx +++ b/ITS/AliITSsimulationSSD.cxx @@ -12,6 +12,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ #include diff --git a/ITS/AliITSsimulationSSD.h b/ITS/AliITSsimulationSSD.h index 336838ce34a..98656f1993c 100644 --- a/ITS/AliITSsimulationSSD.h +++ b/ITS/AliITSsimulationSSD.h @@ -2,6 +2,7 @@ #define ALIITSSIMULATIONSSD_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ + /* $Id$ */ #include "AliITSsimulation.h" diff --git a/ITS/AliITStestV2.C b/ITS/AliITStestV2.C index 09a3c5895b2..a1416f59de9 100644 --- a/ITS/AliITStestV2.C +++ b/ITS/AliITStestV2.C @@ -1,33 +1,39 @@ Int_t AliITStestV2(Char_t SlowOrFast='s') { Int_t rc=0; - - if (gAlice) {delete gAlice; gAlice=0;} - TFile *in=TFile::Open("galice.root"); - if (!in->IsOpen()) { - cerr<<"Can't open galice.root !\n"; + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice=0; + } + rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"Can not open session"<LoadgAlice()) + { + cerr<<"Error occured while loading AliRun"<Get("gAlice"))) { - cerr<<"Can't find gAlice !\n"; - return 2; - } - AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); - delete gAlice; gAlice=0; - in->Close(); - - if (SlowOrFast=='f') { - //cerr<<"Fast AliITSRecPoint(s) !\n"; - //gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2FastRecPoints.C"); - //AliITSHits2FastRecPoints(); - } else { - cerr<<"Slow AliITSRecPoint(s) !\n"; - gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2SDigits.C"); - AliITSHits2SDigits(); - gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSSDigits2Digits.C"); - AliITSSDigits2Digits(); - //gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSDigits2RecPoints.C"); - //AliITSDigits2RecPoints(); - } + } + AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()); + delete rl; + + + + cerr<<"Fast AliITSRecPoint(s) !\n"; + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2FastRecPoints.C"); + AliITSHits2FastRecPoints(); + + cerr<<"Slow AliITSRecPoint(s) !\n"; + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2SDigits.C"); + AliITSHits2SDigits(); + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSSDigits2Digits.C"); + AliITSSDigits2Digits(); + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSDigits2RecPoints.C"); + AliITSDigits2RecPoints(); + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C"); if (rc=AliITSFindClustersV2(SlowOrFast)) return rc; diff --git a/ITS/AliITStrackerV2.cxx b/ITS/AliITStrackerV2.cxx index 7bb30ec9369..f3a812c73e4 100644 --- a/ITS/AliITStrackerV2.cxx +++ b/ITS/AliITStrackerV2.cxx @@ -27,15 +27,20 @@ #include "AliITSgeom.h" #include "AliITSRecPoint.h" #include "AliTPCtrack.h" -#include "AliESD.h" #include "AliITSclusterV2.h" #include "AliITStrackerV2.h" +#include "AliRunLoader.h" +#include "AliLoader.h" +#include "AliITSLoader.h" + ClassImp(AliITStrackerV2) AliITStrackerV2::AliITSlayer AliITStrackerV2::fLayers[kMaxLayer]; // ITS layers -AliITStrackerV2::AliITStrackerV2(const AliITSgeom *geom) : AliTracker() { +AliITStrackerV2::AliITStrackerV2(const AliITSgeom *geom, Int_t eventn, const char* evfoldname): + AliTracker(), + fEvFolderName(evfoldname) { //-------------------------------------------------------------------- //This is the AliITStrackerV2 constructor //-------------------------------------------------------------------- @@ -43,7 +48,8 @@ AliITStrackerV2::AliITStrackerV2(const AliITSgeom *geom) : AliTracker() { Float_t x,y,z; Int_t i; - for (i=1; iGetNladders(i); Int_t ndet=g->GetNdetectors(i); @@ -75,11 +81,11 @@ AliITStrackerV2::AliITStrackerV2(const AliITSgeom *geom) : AliTracker() { new(&det) AliITSdetector(r,phi); } } - } fI=kMaxLayer; + fPass=0; fConstraint[0]=1; fConstraint[1]=0; @@ -99,21 +105,35 @@ void AliITStrackerV2::SetLayersNotToSkip(Int_t *l) { } Int_t AliITStrackerV2::LoadClusters() { - return LoadClusters(gFile); -} - -Int_t AliITStrackerV2::LoadClusters(const TFile *cf) { //-------------------------------------------------------------------- //This function loads ITS clusters //-------------------------------------------------------------------- - if (!((TFile *)cf)->IsOpen()) { - Error("LoadClusters","file with ITS clusters has not been open !\n"); + //This class can go to AliITSLoader -- see AliPHOSLoader as an example + AliRunLoader* rl = AliRunLoader::GetRunLoader(fEvFolderName); + if (rl == 0x0) + { + Error("LoadClusters","Can not get RL from specified folder %s",fEvFolderName.Data()); + return 1; + } + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsl == 0x0) + { + Error("LoadClusters","Can not get ITS loader."); return 1; - } - - char cname[100]; - sprintf(cname,"TreeC_ITS_%d",GetEventNumber()); - TTree *cTree=(TTree*)((TFile *)cf)->Get(cname); + } + + Int_t retval; + TTree *cTree=itsl->TreeC(); + if (!cTree) { + retval = itsl->LoadRawClusters("read"); + if (retval) + { + Error("LoadClusters","LoadRawClusters returned error."); + return 1; + } + cTree=itsl->TreeC(); + } + if (!cTree) { Error("LoadClusters"," can't get cTree !\n"); return 1; @@ -142,8 +162,8 @@ Int_t AliITStrackerV2::LoadClusters(const TFile *cf) { } fLayers[i].ResetRoad(); //road defined by the cluster density } - delete cTree; //Thanks to Mariana Bondila - + + itsl->UnloadRawClusters(); return 0; } @@ -188,111 +208,37 @@ static Int_t CorrectForDeadZoneMaterial(AliITStrackV2 *t) { return 0; } -Int_t AliITStrackerV2::Clusters2Tracks(AliESD *event) { - //-------------------------------------------------------------------- - // This functions reconstructs ITS tracks - // The clusters must be already loaded ! - //-------------------------------------------------------------------- - TObjArray itsTracks(15000); - - {/* Read ESD tracks */ - Int_t nentr=event->GetNumberOfTracks(); - Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr); - while (nentr--) { - AliESDtrack *esd=event->GetTrack(nentr); - - if (esd->GetStatus() != AliESDtrack::kTPCin) continue; - - AliITStrackV2 *t=0; - try { - t=new AliITStrackV2(*esd); - } catch (const Char_t *msg) { - Warning("Clusters2Tracks",msg); - delete t; - continue; - } - if (TMath::Abs(t->GetD())>4) continue; - - if (CorrectForDeadZoneMaterial(t)!=0) { - Warning("Clusters2Tracks", - "failed to correct for the material in the dead zone !\n"); - delete t; - continue; - } - itsTracks.AddLast(t); - } - } /* End Read ESD tracks */ - - itsTracks.Sort(); - Int_t nentr=itsTracks.GetEntriesFast(); - - Int_t ntrk=0; - for (fPass=0; fPass<2; fPass++) { - Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue; - for (Int_t i=0; iGetLabel(); //save the TPC track label - - ResetTrackToFollow(*t); - ResetBestTrack(); - - for (FollowProlongation(); fIIsOpen()) { - Error("Clusters2Tracks","file with TPC tracks is not open !\n"); - return 1; - } - - if (!out->IsOpen()) { - Error("Clusters2Tracks","file for ITS tracks is not open !\n"); + + AliRunLoader* rl = AliRunLoader::GetRunLoader(fEvFolderName); + if (rl == 0x0) + { + Error("Clusters2Tracks","Can not get RL from specified folder %s",fEvFolderName.Data()); + return 1; + } + rl->GetEvent(GetEventNumber()); + //leave loading clusters here - than it is not necessary to GetEvent two times + if (LoadClusters()!=0) return 1; + + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + AliLoader* tpcl = rl->GetLoader("TPCLoader"); + if ( !tpcl || !itsl) + { + Error("Clusters2Tracks","Can not get loaders"); return 2; - } + } + - in->cd(); - - Char_t tname[100]; Int_t nentr=0; TObjArray itsTracks(15000); {/* Read TPC tracks */ - sprintf(tname,"TreeT_TPC_%d",GetEventNumber()); - TTree *tpcTree=(TTree*)in->Get(tname); + + if (tpcl->TreeT() == 0x0) tpcl->LoadTracks("read"); + TTree *tpcTree = tpcl->TreeT(); if (!tpcTree) { Error("Clusters2Tracks","can't get a tree with TPC tracks !\n"); return 3; @@ -300,7 +246,6 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) { AliTPCtrack *itrack=new AliTPCtrack; tpcTree->SetBranchAddress("tracks",&itrack); nentr=(Int_t)tpcTree->GetEntries(); - Info("Clusters2Tracks","Number of TPC tracks: %d\n",nentr); for (Int_t i=0; icd(); - sprintf(tname,"TreeT_ITS_%d",GetEventNumber()); - TTree itsTree(tname,"Tree with ITS tracks"); + if (itsl->TreeT() == 0x0) itsl->MakeTree("T"); + + TTree& itsTree = *itsl->TreeT(); AliITStrackV2 *otrack=&fBestTrack; + itsTree.Branch("tracks","AliITStrackV2",&otrack,32000,0); for (fPass=0; fPass<2; fPass++) { @@ -346,16 +291,20 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) { ResetTrackToFollow(*t); ResetBestTrack(); - for (FollowProlongation(); fIWriteTracks("OVERWRITE"); itsTracks.Delete(); UnloadClusters(); - savedir->cd(); - return 0; -} - -Int_t AliITStrackerV2::PropagateBack(AliESD *event) { - //-------------------------------------------------------------------- - // This functions propagates reconstructed ITS tracks back - // The clusters must be loaded ! - //-------------------------------------------------------------------- - Int_t nentr=event->GetNumberOfTracks(); - Info("PropagateBack", "Number of ESD tracks: %d\n", nentr); - - Int_t ntrk=0; - for (Int_t i=0; iGetTrack(i); - - if (esd->GetStatus()!=(AliESDtrack::kTPCin|AliESDtrack::kITSin)) continue; - - AliITStrackV2 *t=0; - try { - t=new AliITStrackV2(*esd); - } catch (const Char_t *msg) { - Warning("PropagateBack",msg); - delete t; - continue; - } - - ResetTrackToFollow(*t); - - // propagete to vertex [SR, GSI 17.02.2003] - fTrackToFollow.PropagateTo(3.,0.0028,65.19); - fTrackToFollow.PropagateToVertex(); - - // Start Time measurement [SR, GSI 17.02.2003] - fTrackToFollow.StartTimeIntegral(); - fTrackToFollow.PropagateTo(3.,-0.0028,65.19); - - fTrackToFollow.ResetCovariance(); fTrackToFollow.ResetClusters(); - if (RefitAt(49.,&fTrackToFollow,t)) { - if (CorrectForDeadZoneMaterial(&fTrackToFollow)!=0) { - Warning("PropagateBack", - "failed to correct for the material in the dead zone !\n"); - delete t; - continue; - } - fTrackToFollow.SetLabel(t->GetLabel()); - fTrackToFollow.CookdEdx(); - CookLabel(&fTrackToFollow,0.); //For comparison only - fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout); - UseClusters(&fTrackToFollow); - ntrk++; - } - delete t; - } - - Info("PropagateBack","Number of back propagated ITS tracks: %d\n",ntrk); - return 0; } -Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) { +Int_t AliITStrackerV2::PropagateBack() { //-------------------------------------------------------------------- //This functions propagates reconstructed ITS tracks back //-------------------------------------------------------------------- - TFile *in=(TFile*)inp; - TDirectory *savedir=gDirectory; - if (LoadClusters()!=0) return 1; - if (!in->IsOpen()) { - Error("PropagateBack","file with ITS tracks is not open !\n"); + AliRunLoader* rl = AliRunLoader::GetRunLoader(fEvFolderName); + if (rl == 0x0) + { + Error("Clusters2Tracks","Can not get RL from specified folder %s",fEvFolderName.Data()); + return 1; + } + rl->GetEvent(GetEventNumber()); + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsl == 0x0) + { + Error("LoadClusters","Can not get ITS loader."); return 1; - } - - if (!out->IsOpen()) { - Error("PropagateBack","file for back propagated ITS tracks is not open !\n"); - return 2; - } - - in->cd(); - - Char_t tname[100]; - sprintf(tname,"TreeT_ITS_%d",GetEventNumber()); - TTree *itsTree=(TTree*)in->Get(tname); + } + + if (itsl->TreeT() == 0x0) itsl->LoadTracks("read"); + TTree *itsTree=itsl->TreeT(); if (!itsTree) { Error("PropagateBack","can't get a tree with ITS tracks !\n"); return 3; @@ -467,10 +357,15 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) { AliITStrackV2 *itrack=new AliITStrackV2; itsTree->SetBranchAddress("tracks",&itrack); - out->cd(); + + itsl->MakeTree("B");//nake tree for back propagated tracks + if (itsl->TreeB() == 0x0) + { + Error("PropagateBack","Can not create tree for back propagated tracks !\n"); + return 3; + } + TTree &backTree = *itsl->TreeB(); - sprintf(tname,"TreeT_ITSb_%d",GetEventNumber()); - TTree backTree(tname,"Tree with back propagated ITS tracks"); AliTPCtrack *otrack=0; backTree.Branch("tracks","AliTPCtrack",&otrack,32000,2); @@ -505,81 +400,34 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) { UseClusters(&fTrackToFollow); } i=(Int_t)backTree.GetEntries(); - backTree.Write(); + + + itsl->WriteBackTracks("OVERWRITE"); Info("PropagateBack","Number of ITS tracks: %d\n",nentr); Info("PropagateBack","Number of back propagated ITS tracks: %d\n",i); delete itrack; - delete itsTree; //Thanks to Mariana Bondila - + + itsl->UnloadTracks(); + itsl->UnloadBackTracks(); + UnloadClusters(); - savedir->cd(); - return 0; } -Int_t AliITStrackerV2::RefitInward(AliESD *event) { +Int_t AliITStrackerV2::RefitInward() { //-------------------------------------------------------------------- // This functions refits ITS tracks using the // "inward propagated" TPC tracks - // The clusters must be loaded ! //-------------------------------------------------------------------- - Int_t nentr=event->GetNumberOfTracks(); - Info("RefitInward", "Number of ESD tracks: %d\n", nentr); - - Int_t ntrk=0; - for (Int_t i=0; iGetTrack(i); - - ULong_t flags = AliESDtrack::kITSin | AliESDtrack::kTPCrefit; - - if ( (esd->GetStatus() & flags) != flags ) continue; - if ( esd->GetStatus() & AliESDtrack::kITSrefit) continue; - AliITStrackV2 *t=0; - try { - t=new AliITStrackV2(*esd); - } catch (const Char_t *msg) { - Warning("RefitInward",msg); - delete t; - continue; - } + //PH 19/05 This function has to be adapted to the NewIO + TFile * inp = 0x0; + TFile * out = 0x0; - if (CorrectForDeadZoneMaterial(t)!=0) { - Warning("RefitInward", - "failed to correct for the material in the dead zone !\n"); - delete t; - continue; - } - - ResetTrackToFollow(*t); - - //Refitting... - if (RefitAt(3.7, &fTrackToFollow, t)) { - fTrackToFollow.SetLabel(t->GetLabel()); - fTrackToFollow.CookdEdx(); - CookLabel(&fTrackToFollow,0.); //For comparison only - fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSrefit); - UseClusters(&fTrackToFollow); - ntrk++; - } - delete t; - } - - Info("RefitInward","Number of refitted tracks: %d\n",ntrk); - - return 0; -} - -Int_t AliITStrackerV2::RefitInward(const TFile *inp, TFile *out) { - //-------------------------------------------------------------------- - // This functions refits ITS tracks using the - // "inward propagated" TPC tracks - //-------------------------------------------------------------------- TFile *in=(TFile*)inp; - TDirectory *savedir=gDirectory; if (LoadClusters()!=0) return 1; @@ -655,15 +503,16 @@ Int_t AliITStrackerV2::RefitInward(const TFile *inp, TFile *out) { for (i=0; iGetEvent(i); + AliITStrackV2 *t=0; try { - otrack=new AliITStrackV2(*itrack); + t=new AliITStrackV2(*itrack); } catch (const Char_t *msg) { Warning("RefitInward",msg); - delete otrack; + delete t; continue; } //check if this track was reconstructed in the ITS - Int_t lab=TMath::Abs(otrack->GetLabel()); + Int_t lab=TMath::Abs(t->GetLabel()); if (lab >= nLab) { Warning("RefitInward","Too big TPC track label: %d\n!",lab); continue; @@ -671,22 +520,20 @@ Int_t AliITStrackerV2::RefitInward(const TFile *inp, TFile *out) { Int_t idx=lut[lab]; if (idx<0) continue; //no prolongation in the ITS for this track - if (CorrectForDeadZoneMaterial(otrack)!=0) { + if (CorrectForDeadZoneMaterial(t)!=0) { Warning("RefitInward", "failed to correct for the material in the dead zone !\n"); continue; } //Refitting... - { - AliITStrackV2 *ctrack=(AliITStrackV2*)itsTracks.UncheckedAt(idx); - if (!RefitAt(3.7, otrack, ctrack)) continue; - } + otrack=(AliITStrackV2*)itsTracks.UncheckedAt(idx); + if (!RefitAt(3.7, t, otrack)) continue; otrack->SetLabel(itrack->GetLabel()); //For comparison only otrack->CookdEdx(); CookLabel(otrack,0.); //For comparison only outTree.Fill(); - delete otrack; + delete t; } i=(Int_t)outTree.GetEntries(); Info("RefitInward","Number of inward refitted ITS tracks: %d\n",i); @@ -694,10 +541,8 @@ Int_t AliITStrackerV2::RefitInward(const TFile *inp, TFile *out) { delete tpcTree; delete itrack; - UnloadClusters(); - itsTracks.Delete(); - savedir->cd(); + itsTracks.Delete(); return 0; } @@ -1016,6 +861,10 @@ FindDetectorIndex(Double_t phi, Double_t z) const { if (nz>=fNdetectors) return -1; if (nz<0) return -1; +#ifdef DEBUG +cout<GetNumberOfClusters(); + Int_t nc=t->GetNumberOfClusters(); for (k=0; kGetClusterIndex(k),nl=(idx&0xf0000000)>>28; + Int_t idx=t->GetClusterIndex(k),nl=(idx&0xf0000000)>>28; index[nl]=idx; } + t->~AliITStrackV2(); new (t) AliITStrackV2(*s); Int_t from, to, step; if (x > t->GetX()) { @@ -1296,6 +1146,7 @@ AliITStrackerV2::RefitAt(Double_t x,AliITStrackV2 *t,const AliITStrackV2 *c) { } if (!t->PropagateTo(x,0.,0.)) return kFALSE; + ot->~AliITStrackV2(); new (ot) AliITStrackV2(*t); return kTRUE; } diff --git a/ITS/AliITStrackerV2.h b/ITS/AliITStrackerV2.h index 5ccbf035218..599ddb42489 100644 --- a/ITS/AliITStrackerV2.h +++ b/ITS/AliITStrackerV2.h @@ -11,9 +11,9 @@ #include "AliTracker.h" #include "AliITSrecoV2.h" #include "AliITStrackV2.h" +#include "AliConfig.h" class AliITSclusterV2; -class AliESD; class AliITSgeom; class TFile; @@ -22,20 +22,20 @@ class TFile; class AliITStrackerV2 : public AliTracker { public: AliITStrackerV2():AliTracker(){} - AliITStrackerV2(const AliITSgeom *geom); + + AliITStrackerV2(const AliITSgeom *geom, Int_t event=0, + const char* evfoldname = AliConfig::fgkDefaultEventFolderName); + AliCluster *GetCluster(Int_t index) const; Int_t LoadClusters(); - Int_t LoadClusters(const TFile *cf); void UnloadClusters(); - Int_t Clusters2Tracks(const TFile *in, TFile *out); - Int_t Clusters2Tracks(AliESD *event); - Int_t PropagateBack(const TFile *in, TFile *out); - Int_t PropagateBack(AliESD *event); - Int_t RefitInward(const TFile *in, TFile *out); - Int_t RefitInward(AliESD *event); - Bool_t RefitAt(Double_t x, AliITStrackV2 *seed, const AliITStrackV2 *t); + Int_t Clusters2Tracks();// + Int_t PropagateBack();// + Int_t RefitInward();// + void SetupFirstPass(Int_t *flags, Double_t *cuts=0); void SetupSecondPass(Int_t *flags, Double_t *cuts=0); + //PH Bool_t RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index); void SetLastLayerToTrackTo(Int_t l=0) {fLastLayerToTrackTo=l;} void SetLayersNotToSkip(Int_t *l); @@ -97,6 +97,7 @@ private: Double_t GetEffectiveThickness(Double_t y, Double_t z) const; void FollowProlongation(); Int_t TakeNextProlongation(); + Bool_t RefitAt(Double_t x, const AliITStrackV2 *t, AliITStrackV2 *tt); void ResetBestTrack() { fBestTrack.~AliITStrackV2(); new(&fBestTrack) AliITStrackV2(fTrackToFollow); @@ -112,11 +113,12 @@ private: AliITStrackV2 fTrackToFollow; // followed track Int_t fPass; // current pass through the data Int_t fConstraint[2]; // constraint flags + TString fEvFolderName; //event folder name Int_t fLayersNotToSkip[kMaxLayer]; // layer masks Int_t fLastLayerToTrackTo; // the innermost layer to track to - ClassDef(AliITStrackerV2,1) //ITS tracker V2 + ClassDef(AliITStrackerV2,2) //ITS tracker V2 }; diff --git a/ITS/AliITSv1.cxx b/ITS/AliITSv1.cxx index cbb0de59d67..e7825943626 100644 --- a/ITS/AliITSv1.cxx +++ b/ITS/AliITSv1.cxx @@ -13,54 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.23 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.22 2000/10/05 20:49:59 nilsen -Now using root generated streamers. - -Revision 1.14.2.9 2000/10/05 07:49:27 nilsen -Removed hit generation from step manager. - -Revision 1.14.2.8 2000/07/31 13:50:37 barbera -Updated from the release - -Revision 1.19 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.2.2 2000/05/19 10:09:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.2.1 2000/03/04 23:45:19 nilsen -Fixed up the comments/documentation. - -Revision 1.14 1999/11/25 06:52:56 fca -Correct value of drca - -Revision 1.13.2.1 1999/11/25 06:52:21 fca -Correct value of drca - -Revision 1.13 1999/10/27 11:16:26 fca -Correction of problem in geometry - -Revision 1.12 1999/10/22 08:25:25 fca -remove double definition of destructors - -Revision 1.11 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.10 1999/10/06 19:56:50 fca -Add destructor - -Revision 1.9 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.8 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -77,26 +30,24 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// -#include -#include -#include +#include +#include +#include // only required for Tracking function? #include +#include #include -#include -#include // only required for Tracking function? -#include #include #include -#include - +#include +#include +#include +#include #include "AliConst.h" -#include "AliRun.h" -#include "AliMagF.h" - #include "AliITShit.h" #include "AliITSv1.h" - +#include "AliMagF.h" +#include "AliRun.h" ClassImp(AliITSv1) diff --git a/ITS/AliITSv11.cxx b/ITS/AliITSv11.cxx index f1a26442654..33da889bdc2 100644 --- a/ITS/AliITSv11.cxx +++ b/ITS/AliITSv11.cxx @@ -15,6 +15,13 @@ /* $Log$ +Revision 1.7.2.1 2003/05/19 16:24:40 hristov +Merging with v3-09-09 (partial, AliITCclustererV2 is excluded from compilation and has to be adapted to NewIO, AliITStrackerV2 needs additional changes) + +Revision 1.7 2003/03/25 23:27:19 nilsen +ITS new Geometry files. Not yet ready for uses, committed to allow additional +development. + Revision 1.6 2003/02/10 17:03:52 nilsen New version and structure of ITS V11 geometry. Work still in progress. diff --git a/ITS/AliITSv5.cxx b/ITS/AliITSv5.cxx index d428a4d277b..d1e7da2fb16 100644 --- a/ITS/AliITSv5.cxx +++ b/ITS/AliITSv5.cxx @@ -13,92 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.37 2002/10/22 14:45:47 alibrary -Introducing Riostream.h - -Revision 1.36 2002/10/14 14:57:08 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.35.10.2 2002/08/30 15:45:54 alibrary -Adding geant4vmc support - -Revision 1.35.10.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.35 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.34 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.33 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.32 2001/03/23 00:12:23 nilsen -Set Reading of AliITSgeom data from Geant3 common blocks as the default and -not a .det file. Removed redundent calls to BuildGeometry. - -Revision 1.31 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.30 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.29 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.28 2001/02/02 23:57:28 nilsen -Added include file that are no londer included in AliITSgeom.h - -Revision 1.27 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.26 2000/11/30 11:13:11 barbera - Added changes suggested by Federico Carminati on nov, 30, 2000 - -Revision 1.25 2000/10/05 20:50:00 nilsen -Now using root generated streamers. - -Revision 1.14.4.12 2000/10/02 16:04:03 barbera -Forward declarations added - -Revision 1.22 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.4.4 2000/05/19 10:10:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.4.3 2000/03/04 23:46:38 nilsen -Fixed up the comments/documentation. - -Revision 1.14.4.2 2000/03/02 21:53:02 nilsen -To make it compatable with the changes in AliRun/AliModule. - -Revision 1.14.4.1 2000/01/12 19:03:33 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.14 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.13 1999/10/06 10:15:19 fca -Correct bug in allocation of layer name and add destructor - -Revision 1.12 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.11 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -113,28 +28,31 @@ Introduction of the Copyright and cvs Log #include #include #include -#include + +#include +#include +#include +#include // only required for Tracking function? #include +#include +#include #include -#include -#include // only required for Tracking function? -#include #include -#include #include -#include -#include #include +#include +#include #include "AliRun.h" #include "AliITShit.h" #include "AliITSGeant3Geometry.h" -#include "AliITS.h" -#include "AliITSv5.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" +#include "AliITShit.h" +#include "AliITSv5.h" +#include "AliRun.h" ClassImp(AliITSv5) diff --git a/ITS/AliITSv5asymm.cxx b/ITS/AliITSv5asymm.cxx index eed6e7ea6e8..b6a40642669 100644 --- a/ITS/AliITSv5asymm.cxx +++ b/ITS/AliITSv5asymm.cxx @@ -13,117 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.20 2002/10/22 14:45:47 alibrary -Introducing Riostream.h - -Revision 1.19 2002/10/14 14:57:08 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.18.10.2 2002/08/30 15:45:54 alibrary -Adding geant4vmc support - -Revision 1.18.10.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.18 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.17 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.16 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.15 2001/05/25 06:47:16 hristov -Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both a proper shape entry and a default, should there be future changes. This bug was related to fMinorVersion=3 was not antisipated. (B.Nilsen) - -Revision 1.14 2001/05/16 14:57:16 alibrary -New files for folders and Stack - -Revision 1.13 2001/05/09 01:00:19 nilsen -Fixed up a typo in the cout of Init(). Now properly indecates which version -of code is being used. - -Revision 1.12 2001/04/18 12:06:02 barbera -Number of modules in layer 5 and 6 re-set to 23 and 26 - -Revision 1.11 2001/03/23 00:12:23 nilsen -Set Reading of AliITSgeom data from Geant3 common blocks as the default and -not a .det file. Removed redundent calls to BuildGeometry. - -Revision 1.10 2001/02/14 14:22:58 nilsen -Now looking in the right director for the old .det. - -Revision 1.9 2001/02/14 14:12:43 nilsen -Forgot about the nonexisting v in ITSgeometry_5.det. - -Revision 1.8 2001/02/14 14:06:23 nilsen -Wrong default .det file name for old .det file format. - -Revision 1.7 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.6 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.5 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.4 2001/02/02 23:57:29 nilsen -Added include file that are no londer included in AliITSgeom.h - -Revision 1.3 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.2 2000/11/30 11:13:11 barbera - Added changes suggested by Federico Carminati on nov, 30, 2000 - -Revision 1.1 2000/10/07 15:46:38 barbera -Version 5 of the geometry with asymmetric services - -Revision 1.25 2000/10/05 20:50:00 nilsen -Now using root generated streamers. - -Revision 1.14.4.12 2000/10/02 16:04:03 barbera -Forward declarations added - -Revision 1.22 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.4.4 2000/05/19 10:10:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.4.3 2000/03/04 23:46:38 nilsen -Fixed up the comments/documentation. - -Revision 1.14.4.2 2000/03/02 21:53:02 nilsen -To make it compatable with the changes in AliRun/AliModule. - -Revision 1.14.4.1 2000/01/12 19:03:33 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.14 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.13 1999/10/06 10:15:19 fca -Correct bug in allocation of layer name and add destructor - -Revision 1.12 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.11 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -138,28 +28,31 @@ Introduction of the Copyright and cvs Log #include #include #include -#include + +#include +#include +#include +#include // only required for Tracking function? #include +#include +#include #include -#include -#include // only required for Tracking function? -#include #include #include -#include -#include -#include #include +#include +#include #include "AliRun.h" #include "AliITShit.h" #include "AliITSGeant3Geometry.h" -#include "AliITS.h" -#include "AliITSv5asymm.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" +#include "AliITShit.h" +#include "AliITSv5asymm.h" +#include "AliRun.h" ClassImp(AliITSv5asymm) diff --git a/ITS/AliITSv5symm.cxx b/ITS/AliITSv5symm.cxx index 881238abd6c..56e54a782b1 100644 --- a/ITS/AliITSv5symm.cxx +++ b/ITS/AliITSv5symm.cxx @@ -13,101 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.15 2002/10/22 14:45:47 alibrary -Introducing Riostream.h - -Revision 1.14 2002/10/14 14:57:08 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.13.10.2 2002/08/30 15:45:54 alibrary -Adding geant4vmc support - -Revision 1.13.10.1 2002/06/10 17:51:15 hristov -Merged with v3-08-02 - -Revision 1.13 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.12 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.11 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.10 2001/05/25 06:47:16 hristov -Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both a proper shape entry and a default, should there be future changes. This bug was related to fMinorVersion=3 was not antisipated. (B.Nilsen) - -Revision 1.9 2001/04/18 12:07:37 barbera -Number of modules in layer 5 and 6 re-set to 23 and 26 - -Revision 1.8 2001/03/23 00:12:23 nilsen -Set Reading of AliITSgeom data from Geant3 common blocks as the default and -not a .det file. Removed redundent calls to BuildGeometry. - -Revision 1.7 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.6 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.5 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.4 2001/02/02 23:57:29 nilsen -Added include file that are no londer included in AliITSgeom.h - -Revision 1.3 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.2 2000/11/30 11:13:11 barbera - Added changes suggested by Federico Carminati on nov, 30, 2000 - -Revision 1.1 2000/10/07 15:46:29 barbera -Version 5 of the geometry with symmetric services - -Revision 1.25 2000/10/05 20:50:00 nilsen -Now using root generated streamers. - -Revision 1.14.4.12 2000/10/02 16:04:03 barbera -Forward declarations added - -Revision 1.22 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.4.4 2000/05/19 10:10:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.4.3 2000/03/04 23:46:38 nilsen -Fixed up the comments/documentation. - -Revision 1.14.4.2 2000/03/02 21:53:02 nilsen -To make it compatable with the changes in AliRun/AliModule. - -Revision 1.14.4.1 2000/01/12 19:03:33 nilsen -This is the version of the files after the merging done in December 1999. -See the ReadMe110100.txt file for details - -Revision 1.14 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.13 1999/10/06 10:15:19 fca -Correct bug in allocation of layer name and add destructor - -Revision 1.12 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.11 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -122,28 +28,31 @@ Introduction of the Copyright and cvs Log #include #include #include -#include + +#include +#include +#include +#include // only required for Tracking function? #include +#include +#include #include -#include -#include // only required for Tracking function? -#include #include -#include #include -#include -#include #include +#include +#include #include "AliRun.h" #include "AliITShit.h" #include "AliITSGeant3Geometry.h" -#include "AliITS.h" -#include "AliITSv5symm.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" +#include "AliITShit.h" +#include "AliITSv5symm.h" +#include "AliRun.h" ClassImp(AliITSv5symm) diff --git a/ITS/AliITSvPPRasymm.cxx b/ITS/AliITSvPPRasymm.cxx index eba6385acee..849680a16bf 100644 --- a/ITS/AliITSvPPRasymm.cxx +++ b/ITS/AliITSvPPRasymm.cxx @@ -13,193 +13,19 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* + $Id$ +*/ /* -$Log$ -Revision 1.63 2003/02/12 10:39:05 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.62 2003/01/16 08:10:13 hristov -Correcting usage of string arrays (valgrind) - -Revision 1.61 2002/11/21 23:05:27 alibrary -Removing AliMC and AliMCProcess - -Revision 1.60 2002/10/22 14:45:47 alibrary -Introducing Riostream.h - -Revision 1.59 2002/10/14 14:57:08 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.53.6.4 2002/10/14 13:14:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.58 2002/10/02 17:56:34 barbera -Bug in copy 37 of volume I570 corrected (thanks to J. Belikov) - -Revision 1.57 2002/06/12 18:57:25 nilsen -Added TrackReference hits for ITS Mother volume at request of TRD and TOF. - -Revision 1.56 2002/05/10 22:30:27 nilsen -fix to use default paramters for the SDD response. - -Revision 1.55 2002/04/13 22:21:12 nilsen -New default value of noise for SDD simulations introduced. - -Revision 1.54 2002/03/28 16:17:03 nilsen -Set new Geant Step size and related parameters for the ITS materials. - -Revision 1.53 2001/11/28 01:35:45 nilsen -Using standard constructors instead of default constructors for Clusterfinder, -Response, and FastSimulator. - -Revision 1.52 2001/10/22 11:00:54 hristov -New naming schema of the rotation matrices in BuildGeometry() to avoid redefinition in other detectors (R.Barbera) - -Revision 1.51 2001/10/19 10:18:49 barbera -A typo corrected. - -Revision 1.50 2001/10/18 12:25:07 barbera -Detailed geometry in BuildGeometry() commented out (450 MB needed to compile the file). Six cylinders put back but improved by comparison with the ITS coarse geometry - -Revision 1.49 2001/10/18 03:09:21 barbera -The method BuildGeometry() has been completely rewritten. Now display.C can display the detailed ITS geometry instead of the old six dummy cylunders. - -Revision 1.48 2001/10/17 04:35:32 barbera -Checks for the det and chip thickness modified in order to set the dafault values to 200 um if the user chosen values are outside the range 100-300 um - -Revision 1.47 2001/10/04 22:33:39 nilsen -Fixed bugs in SetDefaults. - -Revision 1.46 2001/10/01 19:34:08 nilsen -Fixed a bug in asigning detector types in SetDefaults under SSD layer 6. - -Revision 1.45 2001/06/07 14:42:14 barbera -Both chip and det thicknesses set to [100,300] - -Revision 1.44 2001/05/31 19:24:47 barbera -Default values of SPD detector and chip thickness set to 200 microns as defined by the Technical Board - -Revision 1.43 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.42 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.41 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.40 2001/05/25 15:59:59 morsch -Overlaps corrected. (R. Barbera) - -Revision 1.38 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.37 2001/05/10 00:12:59 nilsen -Finished fixing up the default segmentation for the PPR geometry. - -Revision 1.36 2001/05/09 01:02:21 nilsen -Finished fixing SetDefaults for the segmentation of SPD, SDD, and SSD. - -Revision 1.35 2001/05/03 08:40:15 barbera -Volume ITSD slightly modified to be consistent with v5. Some improvement in the printouts. The last commit did not complete successfully. - -Revision 1.33 2001/05/01 22:40:42 nilsen -Partical update of SetDefault. - -Revision 1.32 2001/04/22 13:48:09 barbera -New values of media parameters and thickness of SPD end-ladder electronics as given by Fabio Formenti - -Revision 1.31 2001/04/04 07:02:16 barbera -Position of the cylinders holding rails corrected - -Revision 1.30 2001/03/29 22:02:30 barbera -Some changes to the services due to the new drawings from the engineers. - -Revision 1.29 2001/03/29 05:28:56 barbera -Rails material changed from aluminum to carbon fiber according with the decision of the last Technical Board - -Revision 1.28 2001/03/28 06:40:20 barbera -Central and services mother volumes made consistenf for detailed and coarse geometry. Switch for rails added to the coarse geometries - -Revision 1.26 2001/03/23 00:12:23 nilsen -Set Reading of AliITSgeom data from Geant3 common blocks as the default and -not a .det file. Removed redundent calls to BuildGeometry. - -Revision 1.25 2001/03/20 19:22:51 barbera -Flags for the rails and the cooling fluid added. Some changes in the volumes of the SSD cones after the meeting with the engineers in Torino. - -Revision 1.23 2001/03/13 21:18:44 barbera -Some misleading comments removed - -Revision 1.22 2001/03/13 18:13:30 barbera -Some mother volumes sligthly modified to eliminate an overlap with the absorber - -Revision 1.21 2001/03/13 08:36:23 hristov -fabsf replaced by TMath::Abs - -Revision 1.20 2001/03/13 00:17:41 barbera -New SDD geometry got grom F. Tosello and checked by the SDD engineers - -Revision 1.19 2001/02/28 18:23:13 barbera -Setters and getters to set/get the detector and chip thickness on SPD layers added - -Revision 1.18 2001/02/27 23:18:24 barbera -Full parameterization of detector and chip thicknesses for layer 1 and layer 2 of SPD as requested by the project leader - -Revision 1.17 2001/02/19 22:14:55 nilsen -Fix for all 4 versions 11, 12, 21, and 22. - -Revision 1.16 2001/02/19 20:10:34 barbera -Set option=2 and thickness=2 as default values --> SetMinorVersion=22 - -Revision 1.15 2001/02/19 19:44:00 barbera -Air density parameter corrected - -Revision 1.14 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.13 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.12 2001/02/09 13:53:38 barbera -Int_t redefinition avoided - -Revision 1.11 2001/02/09 06:55:38 barbera -SPD option re-set to B. It was A by mistake - -Revision 1.10 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - - -Revision 1.9 2001/02/08 16:00:37 barbera -New thicknesses (300+300 um) added for SPD chips and detectors and set as default. Many other refinements. - -Revision 1.8 2001/02/06 08:03:44 barbera -Material redefinition in SDD - -Revision 1.7 2001/02/05 13:34:57 barbera -Updated version of the ITS detailed geometry - -Revision 1.5 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.4 2001/01/23 20:08:03 barbera -Option B for pixels implemented and set as default - -Revision 1.3 2001/01/17 08:08:20 barbera -Some media parameters modified - -Revision 1.1.2.1 2001/01/15 13:38:08 barbera -New ITS detailed geometry to be used for the PPR + $Log$ + Revision 1.53.4.6 2003/06/13 16:30:59 nilsen + Introducing a backward incompatibility to hit files created before June 12 + 2002. The enterance hit is no longer recorded. The starting position of + every hit is used instead. Added GetPositionL0 to AliITShit, fixed up + AliITSmodule to use starting location of hit and not enterance hits, and + StepManager in AliITSvPPRasymm no longer records enterence hit to hit file. */ - /////////////////////////////////////////////////////////////////////////////// // // // Inner Traking System version PPR asymmetric // @@ -217,20 +43,22 @@ New ITS detailed geometry to be used for the PPR #include #include #include -#include + +#include +//#include +#include +//#include // only required for Tracking function? #include +#include +#include #include +//#include +//#include +#include +//#include #include #include -#include -#include // only required for Tracking function? -#include -#include -#include -#include -#include -#include -#include +#include #include "AliRun.h" #include "AliMagF.h" @@ -241,22 +69,20 @@ New ITS detailed geometry to be used for the PPR #include "AliITS.h" #include "AliITSvPPRasymm.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" -#include "AliITSDetType.h" -#include "AliITSresponseSPD.h" +#include "AliITShit.h" #include "AliITSresponseSDD.h" +#include "AliITSresponseSPD.h" #include "AliITSresponseSSD.h" -#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" +#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSSD.h" -#include "AliITSsimulationSPD.h" #include "AliITSsimulationSDD.h" +#include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" -#include "AliITSClusterFinderSPD.h" -#include "AliITSClusterFinderSDD.h" -#include "AliITSClusterFinderSSD.h" +#include "AliITSvPPRasymm.h" ClassImp(AliITSvPPRasymm) @@ -29386,9 +29212,8 @@ void AliITSvPPRasymm::StepManager(){ if(!(this->IsActive())){ return; } // end if !Active volume. - Int_t copy1,copy2; -// Float_t hits[8]; - Int_t vol[5]; + Int_t copy1,copy2; + Int_t vol[5]; TClonesArray &lhits = *fHits; // // Track status @@ -29464,23 +29289,13 @@ void AliITSvPPRasymm::StepManager(){ // gMC->TrackPosition(position); gMC->TrackMomentum(momentum); -/* - hits[0]=position[0]; - hits[1]=position[1]; - hits[2]=position[2]; - hits[3]=momentum[0]; - hits[4]=momentum[1]; - hits[5]=momentum[2]; - hits[6]=gMC->Edep(); - hits[7]=gMC->TrackTime(); -*/ vol[4] = stat0; if(gMC->IsTrackEntering()){ position0 = position; stat0 = vol[3]; + return; } // end if IsEntering // Fill hit structure with this new hit. -// new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits); new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol, gMC->Edep(),gMC->TrackTime(),position, position0,momentum); diff --git a/ITS/AliITSvPPRasymmFMD.cxx b/ITS/AliITSvPPRasymmFMD.cxx index 82f270b2954..3404b99220d 100644 --- a/ITS/AliITSvPPRasymmFMD.cxx +++ b/ITS/AliITSvPPRasymmFMD.cxx @@ -13,44 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2003/04/08 08:16:50 morsch -AliTrackReference constructor without passing pointer to VMC. - -Revision 1.10 2003/02/12 10:39:08 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.9 2002/11/21 23:05:28 alibrary -Removing AliMC and AliMCProcess - -Revision 1.8 2002/11/14 15:09:58 nilsen -Fixed problem of elements of a Mixture having zero concentration. This was -done by reordering some of the elements such that those which may have -zero concentration were at the end of the array and the array size passed -would thereby exclude those zero concentrations. - -Revision 1.7 2002/11/02 15:15:58 hristov -Corrected with respect to the previous versions - -Revision 1.6 2002/11/01 19:48:35 nilsen -Fixed bug in material numbering for new FMD part of code. Removed large part -of commented code (if still needed it is in AliITSvPPRasymm.cxx). - -Revision 1.3 2002/10/05 00:12:39 nilsen -Added material to simulate services in front of the SPD, SDD, and SSD support -structures. Modified folumes I212, I200, and I099 so that they do not go -beyond the volume they are creating holes for. This was nessesary so that -the material added to these volumes would be correct. - -Revision 1.2 2002/10/02 17:56:37 barbera -Bug in copy 37 of volume I570 corrected (thanks to J. Belikov) - -Revision 1.1 2002/09/16 14:45:31 barbera -Updated detailed geometry needed by FMD people for some studies - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -66,50 +29,52 @@ Updated detailed geometry needed by FMD people for some studies /////////////////////////////////////////////////////////////////////////////// // See AliITSvPPRasymmFMD::StepManager(). + #include #include #include -#include + +#include +#include +#include +#include // only required for Tracking function? #include +#include +#include #include -#include -#include -#include -#include // only required for Tracking function? -#include #include -#include #include -#include -#include +#include #include +#include +#include +#include -#include "AliRun.h" -#include "AliMagF.h" #include "AliConst.h" -#include "AliITSGeant3Geometry.h" -#include "AliTrackReference.h" -#include "AliITShit.h" #include "AliITS.h" -#include "AliITSvPPRasymmFMD.h" +#include "AliITSClusterFinderSDD.h" +#include "AliITSClusterFinderSPD.h" +#include "AliITSClusterFinderSSD.h" +#include "AliITSDetType.h" +#include "AliITSGeant3Geometry.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" -#include "AliITSDetType.h" -#include "AliITSresponseSPD.h" +#include "AliITShit.h" #include "AliITSresponseSDD.h" +#include "AliITSresponseSPD.h" #include "AliITSresponseSSD.h" -#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" +#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSSD.h" -#include "AliITSsimulationSPD.h" #include "AliITSsimulationSDD.h" +#include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" -#include "AliITSClusterFinderSPD.h" -#include "AliITSClusterFinderSDD.h" -#include "AliITSClusterFinderSSD.h" - +#include "AliITSvPPRasymmFMD.h" +#include "AliMagF.h" +#include "AliRun.h" +#include "AliTrackReference.h" ClassImp(AliITSvPPRasymmFMD) diff --git a/ITS/AliITSvPPRcoarseasymm.cxx b/ITS/AliITSvPPRcoarseasymm.cxx index 2bf4ebbbe24..58915675f8c 100644 --- a/ITS/AliITSvPPRcoarseasymm.cxx +++ b/ITS/AliITSvPPRcoarseasymm.cxx @@ -13,121 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.28 2002/10/22 14:46:00 alibrary -Introducing Riostream.h - -Revision 1.27 2001/10/18 12:26:38 barbera -Six cylinders definition in BuildGeometry() improved by comparison with CreateGeometry() - -Revision 1.26 2001/05/25 15:59:59 morsch -Overlaps corrected. (R. Barbera) - -Revision 1.25 2001/05/03 08:40:15 barbera -Volume ITSD slightly modified to be consistent with v5. Some improvement in the printouts. The last commit did not complete successfully. - -Revision 1.23 2001/04/04 07:02:16 barbera -Position of the cylinders holding rails corrected - -Revision 1.22 2001/03/29 22:01:53 barbera -New flag added to change the material for some service supports as asked by the PMD people. Some changes to the services due to the new drawings from the engineers - -Revision 1.21 2001/03/29 05:28:56 barbera -Rails material changed from aluminum to carbon fiber according with the decision of the last Technical Board - -Revision 1.20 2001/03/28 06:40:21 barbera -Central and services mother volumes made consistenf for detailed and coarse geometry. Switch for rails added to the coarse geometries - -Revision 1.19 2001/03/13 18:13:30 barbera -Some mother volumes sligthly modified to eliminate an overlap with the absorber - -Revision 1.18 2001/02/19 09:44:16 barbera -Copy no.2 of volume ICO2 re-inserted - -Revision 1.17 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.16 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.15 2001/01/17 07:41:29 barbera -Some media parameters modified - -Revision 1.14 2001/01/15 13:13:53 barbera -Some comments added - -Revision 1.13 2000/12/10 16:00:45 barbera -Added last definition of special media like end-ladder boxes and cones - -Revision 1.12 2000/11/02 15:44:23 barbera -Services on the opposite side w.r.t the absorber modified to make room for rails - -Revision 1.10 2000/10/27 17:19:50 barbera -Position of rails w.r.t. the interaction point corrected. - -Revision 1.9 2000/10/27 13:31:29 barbera -Rails between ITS and TPC added. - -Revision 1.8 2000/10/27 13:03:08 barbera -Small changes in the SPD volumes and materials - -Revision 1.6 2000/10/16 14:45:37 barbera -Mother volume ITSD modified to avoid some overlaps - -Revision 1.5 2000/10/16 13:49:15 barbera -Services volumes slightly modified and material added following Pierluigi Barberis' information - -Revision 1.4 2000/10/07 15:33:07 barbera -Small corrections to the ITSV mother volume - -Revision 1.3 2000/10/07 13:06:50 barbera -Some new materials and media defined - -Revision 1.2 2000/10/07 10:58:15 barbera -Mother volume ITSV corrected - -Revision 1.1 2000/10/06 23:09:24 barbera -New coarse geometry (asymmetric services - -Revision 1.20 2000/10/02 21:28:08 fca -Removal of useless dependecies via forward declarations - -Revision 1.19 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.2.2 2000/05/19 10:09:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.2.1 2000/03/04 23:45:19 nilsen -Fixed up the comments/documentation. - -Revision 1.14 1999/11/25 06:52:56 fca -Correct value of drca - -Revision 1.13.2.1 1999/11/25 06:52:21 fca -Correct value of drca - -Revision 1.13 1999/10/27 11:16:26 fca -Correction of problem in geometry - -Revision 1.12 1999/10/22 08:25:25 fca -remove double definition of destructors - -Revision 1.11 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.10 1999/10/06 19:56:50 fca -Add destructor - -Revision 1.9 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.8 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -146,25 +32,22 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// #include #include +#include +#include #include +#include #include +#include #include -#include -#include -#include // only required for Tracking function? -#include -#include -#include #include "AliMagF.h" #include "AliConst.h" - #include "AliITShit.h" #include "AliITSvPPRcoarseasymm.h" +#include "AliMagF.h" #include "AliRun.h" - ClassImp(AliITSvPPRcoarseasymm) //_____________________________________________________________________________ diff --git a/ITS/AliITSvPPRcoarsesymm.cxx b/ITS/AliITSvPPRcoarsesymm.cxx index 0b635be83a7..559b0249563 100644 --- a/ITS/AliITSvPPRcoarsesymm.cxx +++ b/ITS/AliITSvPPRcoarsesymm.cxx @@ -13,118 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.26 2002/10/22 14:46:01 alibrary -Introducing Riostream.h - -Revision 1.25 2001/10/18 12:26:38 barbera -Six cylinders definition in BuildGeometry() improved by comparison with CreateGeometry() - -Revision 1.24 2001/05/25 15:59:59 morsch -Overlaps corrected. (R. Barbera) - -Revision 1.23 2001/05/03 08:40:15 barbera -Volume ITSD slightly modified to be consistent with v5. Some improvement in the printouts. The last commit did not complete successfully. - -Revision 1.21 2001/04/04 07:02:16 barbera -Position of the cylinders holding rails corrected - -Revision 1.20 2001/03/29 22:01:53 barbera -New flag added to change the material for some service supports as asked by the PMD people. Some changes to the services due to the new drawings from the engineers - -Revision 1.19 2001/03/29 05:28:56 barbera -Rails material changed from aluminum to carbon fiber according with the decision of the last Technical Board - -Revision 1.18 2001/03/28 06:40:21 barbera -Central and services mother volumes made consistenf for detailed and coarse geometry. Switch for rails added to the coarse geometries - -Revision 1.17 2001/03/13 18:13:30 barbera -Some mother volumes sligthly modified to eliminate an overlap with the absorber - -Revision 1.16 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.15 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.14 2001/01/17 07:41:29 barbera -Some media parameters modified - -Revision 1.13 2001/01/15 13:13:52 barbera -Some comments added - -Revision 1.12 2000/12/10 16:00:44 barbera -Added last definition of special media like end-ladder boxes and cones - -Revision 1.11 2000/10/30 08:02:25 barbera -PCON's changed into simpler CONS and TUBS. Services now allow for the rails to go through them. - -Revision 1.3.2.7 2000/10/27 17:20:00 barbera -Position of rails w.r.t. the interaction point corrected. - -Revision 1.9 2000/10/27 13:31:29 barbera -Rails between ITS and TPC added. - -Revision 1.8 2000/10/27 13:03:08 barbera -Small changes in the SPD volumes and materials - -Revision 1.6 2000/10/16 14:45:37 barbera -Mother volume ITSD modified to avoid some overlaps - -Revision 1.5 2000/10/16 13:49:15 barbera -Services volumes slightly modified and material added following Pierluigi Barberis' information - -Revision 1.4 2000/10/07 15:33:07 barbera -Small corrections to the ITSV mother volume - -Revision 1.3 2000/10/07 13:06:50 barbera -Some new materials and media defined - -Revision 1.2 2000/10/07 10:42:43 barbera -Mother volume ITSV corrected - -Revision 1.1 2000/10/06 23:09:12 barbera -New coarse geometry (symmetric services - -Revision 1.20 2000/10/02 21:28:08 fca -Removal of useless dependecies via forward declarations - -Revision 1.19 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.2.2 2000/05/19 10:09:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.2.1 2000/03/04 23:45:19 nilsen -Fixed up the comments/documentation. - -Revision 1.14 1999/11/25 06:52:56 fca -Correct value of drca - -Revision 1.13.2.1 1999/11/25 06:52:21 fca -Correct value of drca - -Revision 1.13 1999/10/27 11:16:26 fca -Correction of problem in geometry - -Revision 1.12 1999/10/22 08:25:25 fca -remove double definition of destructors - -Revision 1.11 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.10 1999/10/06 19:56:50 fca -Add destructor - -Revision 1.9 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.8 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -143,25 +32,22 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// #include #include +#include +#include #include +#include #include +#include #include -#include -#include -#include // only required for Tracking function? -#include -#include -#include #include "AliMagF.h" #include "AliConst.h" - #include "AliITShit.h" #include "AliITSvPPRcoarsesymm.h" +#include "AliMagF.h" #include "AliRun.h" - ClassImp(AliITSvPPRcoarsesymm) //_____________________________________________________________________________ diff --git a/ITS/AliITSvPPRsymm.cxx b/ITS/AliITSvPPRsymm.cxx index c94eed67dad..537044f7549 100644 --- a/ITS/AliITSvPPRsymm.cxx +++ b/ITS/AliITSvPPRsymm.cxx @@ -13,211 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.42 2002/10/22 14:46:01 alibrary -Introducing Riostream.h - -Revision 1.41 2002/10/14 14:57:09 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.38.6.3 2002/10/14 13:14:12 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.40 2002/10/02 17:56:35 barbera -Bug in copy 37 of volume I570 corrected (thanks to J. Belikov) - -Revision 1.39 2002/04/13 22:35:52 nilsen -Now symm is derived from asymm. This minimizes duplicated code because -only the geometry is different between asymm and symm. - -Revision 1.38 2001/11/28 01:35:47 nilsen -Using standard constructors instead of default constructors for Clusterfinder, -Response, and FastSimulator. - -Revision 1.37 2001/10/22 11:00:54 hristov -New naming schema of the rotation matrices in BuildGeometry() to avoid redefinition in other detectors (R.Barbera) - -Revision 1.36 2001/10/19 21:32:35 nilsen -Minor changes to remove compliation warning on gcc 2.92.2 compiler, and -cleanded up a little bit of code. - -Revision 1.35 2001/10/19 10:16:28 barbera -A bug corrected in the definition of a TPCON - -Revision 1.34 2001/10/18 12:25:07 barbera -Detailed geometry in BuildGeometry() commented out (450 MB needed to compile the file). Six cylinders put back but improved by comparison with the ITS coarse geometry - -Revision 1.33 2001/10/18 03:09:21 barbera -The method BuildGeometry() has been completely rewritten. Now display.C can display the detailed ITS geometry instead of the old six dummy cylunders. - -Revision 1.32 2001/10/17 04:35:32 barbera -Checks for the det and chip thickness modified in order to set the dafault values to 200 um if the user chosen values are outside the range 100-300 um - -Revision 1.31 2001/10/04 22:33:39 nilsen -Fixed bugs in SetDefaults. - -Revision 1.30 2001/10/01 19:34:09 nilsen -Fixed a bug in asigning detector types in SetDefaults under SSD layer 6. - -Revision 1.29 2001/06/07 14:42:14 barbera -Both chip and det thicknesses set to [100,300] - -Revision 1.28 2001/05/31 19:24:47 barbera -Default values of SPD detector and chip thickness set to 200 microns as defined by the Technical Board - -Revision 1.27 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.26 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.25 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.24 2001/05/25 15:59:59 morsch -Overlaps corrected. (R. Barbera) - -Revision 1.22 2001/05/16 08:17:49 hristov -Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen) - -Revision 1.21 2001/05/10 00:12:59 nilsen -Finished fixing up the default segmentation for the PPR geometry. - -Revision 1.20 2001/05/09 01:02:22 nilsen -Finished fixing SetDefaults for the segmentation of SPD, SDD, and SSD. - -Revision 1.19 2001/05/03 08:40:15 barbera -Volume ITSD slightly modified to be consistent with v5. Some improvement in the printouts. The last commit did not complete successfully. - -Revision 1.17 2001/05/01 22:40:42 nilsen -Partical update of SetDefault. - -Revision 1.16 2001/04/22 13:48:09 barbera -New values of media parameters and thickness of SPD end-ladder electronics as given by Fabio Formenti - -Revision 1.15 2001/04/04 07:02:16 barbera -Position of the cylinders holding rails corrected - -Revision 1.14 2001/03/29 22:02:30 barbera -Some changes to the services due to the new drawings from the engineers. - -Revision 1.13 2001/03/29 05:28:56 barbera -Rails material changed from aluminum to carbon fiber according with the decision of the last Technical Board - -Revision 1.12 2001/03/28 06:40:20 barbera -Central and services mother volumes made consistenf for detailed and coarse geometry. Switch for rails added to the coarse geometries - -Revision 1.11 2001/03/23 00:12:23 nilsen -Set Reading of AliITSgeom data from Geant3 common blocks as the default and -not a .det file. Removed redundent calls to BuildGeometry. - -Revision 1.10 2001/03/15 13:47:55 barbera -Some service mother volumes modified - -Revision 1.9 2001/03/13 18:13:30 barbera -Some mother volumes sligthly modified to eliminate an overlap with the absorber - -Revision 1.8 2001/03/13 08:36:24 hristov -fabsf replaced by TMath::Abs - -Revision 1.7 2001/03/13 00:43:43 barbera -Updated version of the PPR detailed geometry with symmetric services. Of course, the central part of the detector (volume ITSD and its daughters) is the same of AliITSvPPRasymm.cxx - -Revision 1.6 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.5 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.4 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.3 2001/01/30 09:23:13 hristov -Streamers removed (R.Brun) - -Revision 1.2 2001/01/26 20:01:19 hristov -Major upgrade of AliRoot code - -Revision 1.1.2.1 2001/01/15 13:38:32 barbera -New ITS detailed geometry to be used for the PPR - -Revision 1.12 2000/12/10 16:00:44 barbera -Added last definition of special media like end-ladder boxes and cones - -Revision 1.11 2000/10/30 08:02:25 barbera -PCON's changed into simpler CONS and TUBS. Services now allow for the rails to go through them. - -Revision 1.3.2.7 2000/10/27 17:20:00 barbera -Position of rails w.r.t. the interaction point corrected. - -Revision 1.9 2000/10/27 13:31:29 barbera -Rails between ITS and TPC added. - -Revision 1.8 2000/10/27 13:03:08 barbera -Small changes in the SPD volumes and materials - -Revision 1.6 2000/10/16 14:45:37 barbera -Mother volume ITSD modified to avoid some overlaps - -Revision 1.5 2000/10/16 13:49:15 barbera -Services volumes slightly modified and material added following Pierluigi Barberis' information - -Revision 1.4 2000/10/07 15:33:07 barbera -Small corrections to the ITSV mother volume - -Revision 1.3 2000/10/07 13:06:50 barbera -Some new materials and media defined - -Revision 1.2 2000/10/07 10:42:43 barbera -Mother volume ITSV corrected - -Revision 1.1 2000/10/06 23:09:12 barbera -New geometry (symmetric services - -Revision 1.20 2000/10/02 21:28:08 fca -Removal of useless dependecies via forward declarations - -Revision 1.19 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.14.2.2 2000/05/19 10:09:21 nilsen -fix for bug with HP and Sun unix + fix for event display in ITS-working branch - -Revision 1.14.2.1 2000/03/04 23:45:19 nilsen -Fixed up the comments/documentation. - -Revision 1.14 1999/11/25 06:52:56 fca -Correct value of drca - -Revision 1.13.2.1 1999/11/25 06:52:21 fca -Correct value of drca - -Revision 1.13 1999/10/27 11:16:26 fca -Correction of problem in geometry - -Revision 1.12 1999/10/22 08:25:25 fca -remove double definition of destructors - -Revision 1.11 1999/10/22 08:16:49 fca -Correct destructors, thanks to I.Hrivnacova - -Revision 1.10 1999/10/06 19:56:50 fca -Add destructor - -Revision 1.9 1999/10/05 08:05:09 fca -Minor corrections for uninitialised variables. - -Revision 1.8 1999/09/29 09:24:20 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ ////////////////////////////////////////////////////////////////////////////// // // @@ -238,46 +34,44 @@ Introduction of the Copyright and cvs Log #include #include #include -#include + +#include +#include +#include +#include // only required for Tracking function? #include +#include +#include #include -#include -#include -#include -#include // only required for Tracking function? -#include #include -#include #include -#include -#include +#include #include +#include +#include +#include #include "AliRun.h" #include "AliMagF.h" #include "AliConst.h" #include "AliITSGeant3Geometry.h" -#include "AliITShit.h" -#include "AliITS.h" -#include "AliITSvPPRsymm.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" -#include "AliITSDetType.h" -#include "AliITSresponseSPD.h" +#include "AliITShit.h" #include "AliITSresponseSDD.h" +#include "AliITSresponseSPD.h" #include "AliITSresponseSSD.h" -#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" +#include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSSD.h" -#include "AliITSsimulationSPD.h" #include "AliITSsimulationSDD.h" +#include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" -#include "AliITSClusterFinderSPD.h" -#include "AliITSClusterFinderSDD.h" -#include "AliITSClusterFinderSSD.h" - +#include "AliITSvPPRsymm.h" +#include "AliMagF.h" +#include "AliRun.h" ClassImp(AliITSvPPRsymm) diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx index 75886ea96c7..059472f20db 100644 --- a/ITS/AliITSvSPD02.cxx +++ b/ITS/AliITSvSPD02.cxx @@ -13,22 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2003/04/08 08:16:50 morsch -AliTrackReference constructor without passing pointer to VMC. +/* $Id$ */ -Revision 1.3 2003/03/21 14:34:10 nilsen -Removed warning from part of code not properly implimneted yet. - -Revision 1.2 2003/02/12 10:39:05 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.1 2002/12/05 20:07:25 nilsen -Adding new SPD 2002 test-beam geometry, with Config file (setup for testing, -50 pions in one event and not 50 events with one pion). - -*/ #include #include #include @@ -594,7 +580,8 @@ void AliITSvSPD02::SetDefaults(){ //SPD iDetType=DetType(kSPD); - s0 = (AliITSgeomSPD*) fITSgeom->GetShape(kSPD);// Get shape info. Do it this way for now. + // Get shape info. Do it this way for now. + s0 = (AliITSgeomSPD*) fITSgeom->GetShape(kSPD); AliITSresponse *resp0=new AliITSresponseSPD(); SetResponseModel(kSPD,resp0); AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); @@ -733,6 +720,7 @@ void AliITSvSPD02::StepManager(){ if(gMC->IsTrackEntering()){ position0 = position; stat0 = vol[3]; + return; } // end if IsEntering // Fill hit structure with this new hit only for non-entrerance hits. else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol, diff --git a/ITS/AliITSvtest.cxx b/ITS/AliITSvtest.cxx index 2e5df4d74bc..ec70dd65dbb 100644 --- a/ITS/AliITSvtest.cxx +++ b/ITS/AliITSvtest.cxx @@ -13,85 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.15 2002/10/22 14:46:03 alibrary -Introducing Riostream.h - -Revision 1.14 2002/10/14 14:57:10 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.13.8.2 2002/08/30 15:45:56 alibrary -Adding geant4vmc support - -Revision 1.13.8.1 2002/06/10 17:51:17 hristov -Merged with v3-08-02 - -Revision 1.13 2001/10/01 19:34:09 nilsen -Fixed a bug in asigning detector types in SetDefaults under SSD layer 6. - -Revision 1.12 2001/08/24 21:04:36 nilsen -Added some include files. Needed due to new forward declorations in other -files - -Revision 1.11 2001/05/30 16:15:47 fca -Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova - -Revision 1.10 2001/05/30 15:55:35 hristov -Strings compared instead of pointers - -Revision 1.9 2001/05/30 14:04:31 hristov -Dynamic cast replaced (F.Carminati) - -Revision 1.8 2001/02/13 16:53:35 nilsen -Fixed a but when trying to use GEANT4. Needed to replace -if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) -because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer -did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed -to fix a bug in the initilizers and a bug in BuildGeometry. This is now done -in the same way as in AliITSv5.cxx. - -Revision 1.7 2001/02/09 20:06:26 nilsen -Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. - -Revision 1.6 2001/02/09 00:05:31 nilsen -Added fMajor/MinorVersion variables and made other changes to better make -use of the new code changes in AliITSgeom related classes. - -Revision 1.5 2001/01/30 09:23:14 hristov -Streamers removed (R.Brun) - -Revision 1.4 2001/01/18 06:25:09 barbera -ITS geometry using test Euclid files - -Revision 1.1.2.8 2000/10/05 20:28:18 nilsen -Now using root generated streamer function. - -Revision 1.1.2.7 2000/07/31 13:51:22 barbera -Updated from the release - -Revision 1.2 2000/07/10 16:07:19 fca -Release version of ITS code - -Revision 1.1.2.2 2000/03/02 21:53:36 nilsen -to make it compatable with the changes in AliRun/AliModule. - -Revision 1.1.2.1 2000/01/12 20:19:03 nilsen - The changes made with this latest inclusion of code is very large. -Many of the new files were added just in December when P. Cerello added his -SDD simulations to the distrobutions. Also added are some file of P. Skowronski -for SSD cluster finding and ghost RecPoints. None of this "new" code has been -proporly tested. Other code new to this cvs repository is explained in the -ITS Off-line web page. In general the changes are too large to give a resonable -discription of them but probably should be taken as the starting point for -the developement branch (ITS-working). - B. S. Nilsen - -Revision 1.13 1999/10/16 19:49:00 BSN -$Name$ -$Author$ -$Id$ -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -103,31 +25,27 @@ $Id$ // Created October 16 1999. // // // /////////////////////////////////////////////////////////////////////////////// + +#include #include #include -#include #include -#include #include -#include -#include // only required for Tracking function? -#include #include #include -#include -#include -#include #include +#include +#include #include "AliRun.h" #include "AliITSGeant3Geometry.h" -#include "AliITShit.h" -#include "AliITS.h" -#include "AliITSvtest.h" #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" #include "AliITSgeomSDD.h" +#include "AliITSgeomSPD.h" #include "AliITSgeomSSD.h" +#include "AliITShit.h" +#include "AliITSvtest.h" +#include "AliRun.h" ClassImp(AliITSvtest) diff --git a/ITS/ConfigSPD02.C b/ITS/ConfigSPD02.C index 4037a7aebec..46a858433f1 100644 --- a/ITS/ConfigSPD02.C +++ b/ITS/ConfigSPD02.C @@ -5,9 +5,17 @@ void Config(){ gSystem->Load("libgeant321"); new TGeant3("C++ Interface to Geant3"); if (!gSystem->Getenv("CONFIG_FILE")){ - TFile *rootfile = new TFile("galice.root", "recreate"); - rootfile->SetCompressionLevel(2); - } // end if + cout<<"Config.C: Creating Run Loader ..."<Fatal("Config.C","Can not instatiate the Run Loader"); + return; + } // end if rl==0x0 + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(1000); + gAlice->SetRunLoader(rl); + } // end if !gSystem TGeant3 *geant3 = (TGeant3 *) gMC; // Set External decayer AliDecayer *decayer = new AliDecayerPythia(); @@ -69,12 +77,12 @@ void Config(){ // //gener->SetVertexSmear(perTrack); // Field (L3 0.4 T) - //AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1); rootfile->cd(); //gAlice->SetField(field); Int_t iHALL = 0; Int_t iITS = 1; + rl->CdGAFile(); //=================== Alice BODY parameters ============================= AliBODY *BODY = new AliBODY("BODY", "Alice envelop"); diff --git a/ITS/ITSLinkDef.h b/ITS/ITSLinkDef.h index 71a88eb8ed3..10c95411d9b 100644 --- a/ITS/ITSLinkDef.h +++ b/ITS/ITSLinkDef.h @@ -151,7 +151,7 @@ // This class will always be for ITS only #pragma link C++ class AliITSvtest+; -#pragma link C++ class AliITSclustererV2+; +//PH #pragma link C++ class AliITSclustererV2+; #pragma link C++ class AliITSclusterV2+; #pragma link C++ class AliITStrackV2+; #pragma link C++ class AliITStrackerV2+; @@ -180,6 +180,9 @@ #pragma link C++ class AliITSFindClustersV2+; // Raw data #pragma link C++ class AliITSDDLRawData+; + +#pragma link C++ class AliITSLoader+; + #pragma link C++ class AliITSRawStream+; #pragma link C++ class AliITSRawStreamSPD+; #pragma link C++ class AliITSRawStreamSDD+; diff --git a/ITS/libITS.pkg b/ITS/libITS.pkg index e77ba84cfce..08618499f99 100644 --- a/ITS/libITS.pkg +++ b/ITS/libITS.pkg @@ -8,7 +8,7 @@ SRCS = AliITS.cxx AliITSv1.cxx AliITSv5.cxx AliITSvSPD02.cxx \ AliITSgeom.cxx AliITSgeomMatrix.cxx \ AliITSgeomSPD.cxx AliITSgeomSDD.cxx \ AliITSgeomSSD.cxx AliITSmodule.cxx \ - AliITSGeant3Geometry.cxx \ + AliITSGeant3Geometry.cxx AliITSLoader.cxx\ AliITSsimulationFastPoints.cxx \ AliITSsimulationFastPointsV0.cxx AliITSsimulation.cxx \ AliITSsimulationSPD.cxx AliITSsimulationSPDdubna.cxx \ @@ -31,7 +31,6 @@ SRCS = AliITS.cxx AliITSv1.cxx AliITSv5.cxx AliITSvSPD02.cxx \ AliITSTrackV1.cxx AliITSIOTrack.cxx \ AliITSRad.cxx AliITSgeoinfo.cxx AliITSTrackerV1.cxx\ AliITSvtest.cxx AliITSStrLine.cxx\ - AliITSclustererV2.cxx \ AliITSclusterV2.cxx AliITStrackV2.cxx AliITStrackerV2.cxx \ AliITSVertex.cxx AliITSVertexer.cxx AliITSVertexerIons.cxx \ AliITSVertexerPPZ.cxx AliITSVertexerTracks.cxx\ @@ -47,6 +46,7 @@ SRCS = AliITS.cxx AliITSv1.cxx AliITSv5.cxx AliITSvSPD02.cxx \ AliITSDDLRawData.cxx AliITSpidESD.cxx \ AliITSRawStream.cxx AliITSRawStreamSPD.cxx \ AliITSRawStreamSDD.cxx AliITSRawStreamSSD.cxx + # AliITSAlignmentTrack.cxx AliITSAlignmentModule.cxx \ HDRS:= $(SRCS:.cxx=.h) diff --git a/MICROCERN/abend.F b/MICROCERN/abend.F index 3554c3a9729..6a0d2f79104 100644 --- a/MICROCERN/abend.F +++ b/MICROCERN/abend.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/cfill.F b/MICROCERN/cfill.F index cf87baab544..f1aafaa04cb 100644 --- a/MICROCERN/cfill.F +++ b/MICROCERN/cfill.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/cltou.F b/MICROCERN/cltou.F index b54a287b779..2591a0a4f8c 100644 --- a/MICROCERN/cltou.F +++ b/MICROCERN/cltou.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/fchput.c b/MICROCERN/fchput.c index 91e0f9f1cf9..25e52b3cd7e 100644 --- a/MICROCERN/fchput.c +++ b/MICROCERN/fchput.c @@ -2,6 +2,12 @@ * $Id$ * * $Log$ + * Revision 1.2.4.1 2002/11/26 16:46:57 hristov + * Merging NewIO with v3-09-04 + * + * Revision 1.2 2002/10/14 14:57:10 hristov + * Merging the VirtualMC branch to the main development branch (HEAD) + * * Revision 1.1.2.1 2002/07/11 17:15:24 alibrary * Adding MICROCERN * diff --git a/MICROCERN/fchtak.c b/MICROCERN/fchtak.c index d91d630f2d9..41278c49ed4 100644 --- a/MICROCERN/fchtak.c +++ b/MICROCERN/fchtak.c @@ -2,6 +2,12 @@ * $Id$ * * $Log$ + * Revision 1.2.4.1 2002/11/26 16:46:57 hristov + * Merging NewIO with v3-09-04 + * + * Revision 1.2 2002/10/14 14:57:10 hristov + * Merging the VirtualMC branch to the main development branch (HEAD) + * * Revision 1.1.2.1 2002/07/11 17:15:24 alibrary * Adding MICROCERN * diff --git a/MICROCERN/fint.F b/MICROCERN/fint.F index dea6a35951b..3160b114666 100644 --- a/MICROCERN/fint.F +++ b/MICROCERN/fint.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gamma.F b/MICROCERN/gamma.F index 468d7b229e1..7fd01fa9cad 100644 --- a/MICROCERN/gamma.F +++ b/MICROCERN/gamma.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gamma64.F b/MICROCERN/gamma64.F index be7498cfdb2..4533a4d5614 100644 --- a/MICROCERN/gamma64.F +++ b/MICROCERN/gamma64.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gauss.F b/MICROCERN/gauss.F index 91a001e9459..85e5360f112 100644 --- a/MICROCERN/gauss.F +++ b/MICROCERN/gauss.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gauss64.F b/MICROCERN/gauss64.F index b4538e9a226..1cce81592ad 100644 --- a/MICROCERN/gauss64.F +++ b/MICROCERN/gauss64.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/08/29 13:47:41 alibrary * Adding missing routines * diff --git a/MICROCERN/gausscod.inc b/MICROCERN/gausscod.inc index 80175926e47..e94e21d3bba 100644 --- a/MICROCERN/gausscod.inc +++ b/MICROCERN/gausscod.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:15:24 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/def128.inc b/MICROCERN/gen/def128.inc index 7bbf0f998e9..e984bb078a4 100644 --- a/MICROCERN/gen/def128.inc +++ b/MICROCERN/gen/def128.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/def64.inc b/MICROCERN/gen/def64.inc index 371ee8a9335..05a6177b6aa 100644 --- a/MICROCERN/gen/def64.inc +++ b/MICROCERN/gen/def64.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/defc64.inc b/MICROCERN/gen/defc64.inc index bb1c8f93f3d..0e9a34ac07f 100644 --- a/MICROCERN/gen/defc64.inc +++ b/MICROCERN/gen/defc64.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/imp128.inc b/MICROCERN/gen/imp128.inc index 9db4b7637fa..f5d3d791060 100644 --- a/MICROCERN/gen/imp128.inc +++ b/MICROCERN/gen/imp128.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/imp64.inc b/MICROCERN/gen/imp64.inc index c4b264d5e67..5aca4021e05 100644 --- a/MICROCERN/gen/imp64.inc +++ b/MICROCERN/gen/imp64.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/gen/impc64.inc b/MICROCERN/gen/impc64.inc index 901dee96110..39f88c9ae3c 100644 --- a/MICROCERN/gen/impc64.inc +++ b/MICROCERN/gen/impc64.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/geteni.c b/MICROCERN/geteni.c index ba1f7d56185..13ed4f19891 100644 --- a/MICROCERN/geteni.c +++ b/MICROCERN/geteni.c @@ -2,6 +2,12 @@ * $Id$ * * $Log$ + * Revision 1.2.4.1 2002/11/26 16:46:57 hristov + * Merging NewIO with v3-09-04 + * + * Revision 1.2 2002/10/14 14:57:10 hristov + * Merging the VirtualMC branch to the main development branch (HEAD) + * * Revision 1.1.2.1 2002/07/11 17:15:24 alibrary * Adding MICROCERN * diff --git a/MICROCERN/getenvf.F b/MICROCERN/getenvf.F index 40cbf612a16..68cf6af5af7 100644 --- a/MICROCERN/getenvf.F +++ b/MICROCERN/getenvf.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/cf_clos.h b/MICROCERN/kerngen/cf_clos.h index b824630e2d6..d2d308a22b0 100644 --- a/MICROCERN/kerngen/cf_clos.h +++ b/MICROCERN/kerngen/cf_clos.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/cf_open.h b/MICROCERN/kerngen/cf_open.h index a08a8bf60b3..0bcefb8eb5b 100644 --- a/MICROCERN/kerngen/cf_open.h +++ b/MICROCERN/kerngen/cf_open.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/cf_reaw.h b/MICROCERN/kerngen/cf_reaw.h index 8820a7cd1f5..1a7ec7e83b3 100644 --- a/MICROCERN/kerngen/cf_reaw.h +++ b/MICROCERN/kerngen/cf_reaw.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/cf_seek.h b/MICROCERN/kerngen/cf_seek.h index 04e46f31411..fa0a54d7b1e 100644 --- a/MICROCERN/kerngen/cf_seek.h +++ b/MICROCERN/kerngen/cf_seek.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/cf_xaft.h b/MICROCERN/kerngen/cf_xaft.h index 67be2715eb6..ca1ed534fd0 100644 --- a/MICROCERN/kerngen/cf_xaft.h +++ b/MICROCERN/kerngen/cf_xaft.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/fortchar.h b/MICROCERN/kerngen/fortchar.h index 4ddff8ade46..6dcded632b6 100644 --- a/MICROCERN/kerngen/fortchar.h +++ b/MICROCERN/kerngen/fortchar.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_andor.inc b/MICROCERN/kerngen/q_andor.inc index 568a385bd7c..eee2037261c 100644 --- a/MICROCERN/kerngen/q_andor.inc +++ b/MICROCERN/kerngen/q_andor.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_cbyt.inc b/MICROCERN/kerngen/q_cbyt.inc index 4e9d45649f6..883db692b64 100644 --- a/MICROCERN/kerngen/q_cbyt.inc +++ b/MICROCERN/kerngen/q_cbyt.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_isabit.inc b/MICROCERN/kerngen/q_isabit.inc index 446235b45e5..2dd7dd34171 100644 --- a/MICROCERN/kerngen/q_isabit.inc +++ b/MICROCERN/kerngen/q_isabit.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_jbit.inc b/MICROCERN/kerngen/q_jbit.inc index 11f463a83c8..a40b9193fe6 100644 --- a/MICROCERN/kerngen/q_jbit.inc +++ b/MICROCERN/kerngen/q_jbit.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_jbytet.inc b/MICROCERN/kerngen/q_jbytet.inc index 06fbad9ca7c..b460c7f6aa0 100644 --- a/MICROCERN/kerngen/q_jbytet.inc +++ b/MICROCERN/kerngen/q_jbytet.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_sbit.inc b/MICROCERN/kerngen/q_sbit.inc index bed563adb90..8c24f4b9348 100644 --- a/MICROCERN/kerngen/q_sbit.inc +++ b/MICROCERN/kerngen/q_sbit.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_sbyt.inc b/MICROCERN/kerngen/q_sbyt.inc index 6a073e6c329..8372ab5ec64 100644 --- a/MICROCERN/kerngen/q_sbyt.inc +++ b/MICROCERN/kerngen/q_sbyt.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/q_shift.inc b/MICROCERN/kerngen/q_shift.inc index 29fd680f7a2..d9007980b25 100644 --- a/MICROCERN/kerngen/q_shift.inc +++ b/MICROCERN/kerngen/q_shift.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/qf_f2c.h b/MICROCERN/kerngen/qf_f2c.h index c8fe72de6ad..c7a26030e9f 100644 --- a/MICROCERN/kerngen/qf_f2c.h +++ b/MICROCERN/kerngen/qf_f2c.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/qnatch.inc b/MICROCERN/kerngen/qnatch.inc index e0c2d640d46..4c8486799ad 100644 --- a/MICROCERN/kerngen/qnatch.inc +++ b/MICROCERN/kerngen/qnatch.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/qnatchdata.inc b/MICROCERN/kerngen/qnatchdata.inc index 31a0838db96..8d127add9e7 100644 --- a/MICROCERN/kerngen/qnatchdata.inc +++ b/MICROCERN/kerngen/qnatchdata.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/wordsizc.h b/MICROCERN/kerngen/wordsizc.h index 1def785e0ad..4e34789c85d 100644 --- a/MICROCERN/kerngen/wordsizc.h +++ b/MICROCERN/kerngen/wordsizc.h @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerngen/wordsize.inc b/MICROCERN/kerngen/wordsize.inc index f0396790c4f..421e8c9412f 100644 --- a/MICROCERN/kerngen/wordsize.inc +++ b/MICROCERN/kerngen/wordsize.inc @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/kerset.F b/MICROCERN/kerset.F index 71449d38404..6709110e5d2 100644 --- a/MICROCERN/kerset.F +++ b/MICROCERN/kerset.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/mtlprt.F b/MICROCERN/mtlprt.F index 5b64370b637..cdcc87dc545 100644 --- a/MICROCERN/mtlprt.F +++ b/MICROCERN/mtlprt.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/mtlset.F b/MICROCERN/mtlset.F index bee889dbff5..157c47bc4b6 100644 --- a/MICROCERN/mtlset.F +++ b/MICROCERN/mtlset.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/sortzv.F b/MICROCERN/sortzv.F index 5df500323ce..e07c4186ac6 100644 --- a/MICROCERN/sortzv.F +++ b/MICROCERN/sortzv.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:10 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MICROCERN/sungs/abend.F b/MICROCERN/sungs/abend.F index 3ba6bfbee5e..2f3fe00ca1d 100644 --- a/MICROCERN/sungs/abend.F +++ b/MICROCERN/sungs/abend.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:50:55 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:49 alibrary * Adding MICROCERN * diff --git a/MICROCERN/ufill.F b/MICROCERN/ufill.F index f56d71f1bb6..68d19f44313 100644 --- a/MICROCERN/ufill.F +++ b/MICROCERN/ufill.F @@ -2,6 +2,12 @@ * $Id$ * * $Log$ +* Revision 1.2.4.1 2002/11/26 16:46:57 hristov +* Merging NewIO with v3-09-04 +* +* Revision 1.2 2002/10/14 14:57:11 hristov +* Merging the VirtualMC branch to the main development branch (HEAD) +* * Revision 1.1.2.1 2002/07/11 17:14:48 alibrary * Adding MICROCERN * diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx index 1667bfcf777..66cef7a1822 100644 --- a/MUON/AliMUON.cxx +++ b/MUON/AliMUON.cxx @@ -14,6 +14,24 @@ **************************************************************************/ /* $Log$ +Revision 1.56.4.8 2003/06/30 18:32:58 hristov +fHits array is not stored in file - intrdoducing proper protections in SetTreeAddress and MakeBranch in all detectors. Increasing version of class in detectors. (P.Skowronski) + +Revision 1.56.4.7 2003/06/24 14:08:27 pcrochet +Trigger with NewIO + +Revision 1.56.4.6 2003/06/11 16:45:07 martinez +NewIO in Digits2Reco + +Revision 1.56.4.5 2003/05/16 14:40:24 martinez +New IO in AliMUON + +Revision 1.56.4.4 2003/05/14 15:24:08 martinez +Merging with NewIO: New AddHit function + +Revision 1.60 2003/05/13 17:04:22 martinez +Adding new AddHit function + Revision 1.59 2002/11/21 17:01:56 alibrary Removing AliMCProcess and AliMC @@ -111,171 +129,62 @@ Built geometry includes slat geometry for event display. Revision 1.31 2000/10/02 21:28:08 fca Removal of useless dependecies via forward declarations - -Revision 1.30 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.29 2000/07/28 13:49:38 morsch -SetAcceptance defines inner and outer chamber radii according to angular acceptance. -Can be used for simple acceptance studies. - -Revision 1.28 2000/07/22 16:43:15 morsch -Same comment as before, but now done correctly I hope (sorry it's Saturday evening) - -Revision 1.27 2000/07/22 16:36:50 morsch -Change order of indices in creation (new) of xhit and yhit - -Revision 1.26 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.25 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.24 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.23 2000/06/28 12:19:17 morsch -More consequent seperation of global input data services (AliMUONClusterInput singleton) and the -cluster and hit reconstruction algorithms in AliMUONClusterFindRawinderVS. -AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. -It requires two cathode planes. Small modifications in the code will make it usable for -one cathode plane and, hence, more general (for test beam data). -AliMUONClusterFinder is now obsolete. - -Revision 1.22 2000/06/28 08:06:10 morsch -Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the -algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. -It also naturally takes care of the TMinuit instance. - -Revision 1.21 2000/06/27 08:54:41 morsch -Problems with on constant array sizes (in hitMap, nmuon, xhit, yhit) corrected. - -Revision 1.20 2000/06/26 14:02:38 morsch -Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. - -Revision 1.19 2000/06/22 13:40:51 morsch -scope problem on HP, "i" declared once -pow changed to TMath::Power (PH, AM) - -Revision 1.18 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.14.4.17 2000/06/14 14:36:46 morsch -- add TriggerCircuit (PC) -- add GlobalTrigger and LocalTrigger and specific methods (PC) - -Revision 1.14.4.16 2000/06/09 21:20:28 morsch -Most coding rule violations corrected - -Revision 1.14.4.15 2000/05/02 09:54:32 morsch -RULE RN17 violations corrected - -Revision 1.14.4.12 2000/04/26 12:25:02 morsch -Code revised by P. Crochet: -- Z position of TriggerChamber changed according to A.Tournaire Priv.Comm. -- ToF included in the method MakePadHits -- inner radius of flange between beam shielding and trigger corrected -- Trigger global volume updated (according to the new geometry) - -Revision 1.14.4.11 2000/04/19 19:42:08 morsch -Some changes of variable names curing viols and methods concerning -correlated clusters removed. - -Revision 1.14.4.10 2000/03/22 16:44:07 gosset -Memory leak suppressed in function Digitise: -p_adr->Delete() instead of Clear (I.Chevrot and A.Baldisseri) - -Revision 1.14.4.9 2000/03/20 18:15:25 morsch -Positions of trigger chambers corrected (P.C.) - -Revision 1.14.4.8 2000/02/21 15:38:01 morsch -Call to AddHitList introduced to make this version compatible with head. - -Revision 1.14.4.7 2000/02/20 07:45:53 morsch -Bugs in Trigger part of BuildGeomemetry corrected (P.C) - -Revision 1.14.4.6 2000/02/17 14:28:54 morsch -Trigger included into initialization and digitization - -Revision 1.14.4.5 2000/02/15 10:02:58 morsch -Log messages of previous revisions added - -Revision 1.14.4.2 2000/02/04 10:57:34 gosset -Z position of the chambers: -it was the Z position of the stations; -it is now really the Z position of the chambers. - !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS" - !!!! AND "AliMUONChamber::ZPosition" - !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ" - !!!! AND "AliMUONChamber::Z" - -Revision 1.14.4.3 2000/02/04 16:19:04 gosset -Correction for mis-spelling of NCH - -Revision 1.14.4.4 2000/02/15 09:43:38 morsch -Log message added - */ +/* $Id$ */ + /////////////////////////////////////////////// // Manager and hits classes for set:MUON // //////////////////////////////////////////////// -#include +#include "Riostream.h" + +#include #include -#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include +#include #include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include +#include +#include +#include +#include "AliConst.h" +#include "AliHeader.h" +#include "AliHitMap.h" +#include "AliLoader.h" #include "AliMUON.h" +#include "AliMUONChamberTrigger.h" +#include "AliMUONClusterFinderVS.h" +#include "AliMUONClusterInput.h" +#include "AliMUONConstants.h" +#include "AliMUONDigit.h" +#include "AliMUONGlobalTrigger.h" #include "AliMUONHit.h" +#include "AliMUONHitMapA1.h" +#include "AliMUONLocalTrigger.h" +#include "AliMUONMerger.h" #include "AliMUONPadHit.h" -#include "AliMUONDigit.h" -#include "AliMUONTransientDigit.h" #include "AliMUONRawCluster.h" -#include "AliMUONLocalTrigger.h" -#include "AliMUONGlobalTrigger.h" +#include "AliMUONTransientDigit.h" #include "AliMUONTriggerCircuit.h" -#include "AliHitMap.h" -#include "AliMUONHitMapA1.h" -#include "AliMUONChamberTrigger.h" -#include "AliMUONConstants.h" -#include "AliMUONClusterFinderVS.h" #include "AliMUONTriggerDecision.h" -#include "AliRun.h" -#include "AliHeader.h" -#include "AliMUONClusterInput.h" -#include "AliMUONMerger.h" -#include "Riostream.h" -#include "AliConst.h" +#include "AliRun.h" + // Defaults parameters for Z positions of chambers // taken from values for "stations" in AliMUON::AliMUON @@ -579,7 +488,7 @@ Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t ) } //___________________________________________ -void AliMUON::MakeBranch(Option_t* option, const char *file) +void AliMUON::MakeBranch(Option_t* option) { // // Create Tree branches for the MUON. @@ -588,68 +497,83 @@ void AliMUON::MakeBranch(Option_t* option, const char *file) char branchname[30]; sprintf(branchname,"%sCluster",GetName()); - AliDetector::MakeBranch(option,file); const char *cD = strstr(option,"D"); const char *cR = strstr(option,"R"); const char *cH = strstr(option,"H"); - // PadHits to be removed - if (fPadHits && gAlice->TreeH() && cH) { - MakeBranchInTree(gAlice->TreeH(), - branchname, &fPadHits, kBufferSize, file); - } + if (TreeH() && cH) + { + if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000); + MakeBranchInTree(TreeH(), branchname, &fPadHits, kBufferSize, 0); + if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); + } + //it must be under fHits creation + AliDetector::MakeBranch(option); - if (cD) { + if (cD && fLoader->TreeD()) { // // one branch for digits per chamber // Int_t i; - - for (i=0; iTreeD()) { - MakeBranchInTree(gAlice->TreeD(), - branchname, &((*fDchambers)[i]), kBufferSize, file); - printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); + if (fDchambers == 0x0) + { + fDchambers = new TObjArray(AliMUONConstants::NCh()); + for (Int_t i=0; iAddAt(new TClonesArray("AliMUONDigit",10000),i); + } } - } + + for (i=0; iTreeD(), branchname, &((*fDchambers)[i]), kBufferSize, 0); + printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); + } } - if (cR) { + if (cR && fLoader->TreeR()) { // // one branch for raw clusters per chamber // - printf("Make Branch - TreeR address %p\n",gAlice->TreeR()); + printf("Make Branch - TreeR address %p\n",fLoader->TreeR()); Int_t i; + if (fRawClusters == 0x0) + { + fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); + for (Int_t i=0; iAddAt(new TClonesArray("AliMUONRawCluster",10000),i); + } + } - for (i=0; iTreeR()) { - MakeBranchInTree(gAlice->TreeR(), - branchname, &((*fRawClusters)[i]), kBufferSize, file); - printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); - } + for (i=0; iTreeR(), branchname, &((*fRawClusters)[i]), kBufferSize, 0); + printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); } // // one branch for global trigger // sprintf(branchname,"%sGlobalTrigger",GetName()); - if (fGlobalTrigger && gAlice->TreeR()) { - MakeBranchInTree(gAlice->TreeR(), - branchname, &fGlobalTrigger, kBufferSize, file); - printf("Making Branch %s for Global Trigger\n",branchname); + + if (fGlobalTrigger == 0x0) { + fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); } + MakeBranchInTree(fLoader->TreeR(), branchname, &fGlobalTrigger, kBufferSize, 0); + printf("Making Branch %s for Global Trigger\n",branchname); // // one branch for local trigger // sprintf(branchname,"%sLocalTrigger",GetName()); - if (fLocalTrigger && gAlice->TreeR()) { - MakeBranchInTree(gAlice->TreeR(), - branchname, &fLocalTrigger, kBufferSize, file); - printf("Making Branch %s for Local Trigger\n",branchname); + + if (fLocalTrigger == 0x0) { + fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); } + + MakeBranchInTree(fLoader->TreeR(), branchname, &fLocalTrigger, kBufferSize, 0); + printf("Making Branch %s for Local Trigger\n",branchname); } } @@ -658,24 +582,35 @@ void AliMUON::SetTreeAddress() { // Set branch address for the Hits and Digits Tree. char branchname[30]; - AliDetector::SetTreeAddress(); TBranch *branch; - TTree *treeH = gAlice->TreeH(); - TTree *treeD = gAlice->TreeD(); - TTree *treeR = gAlice->TreeR(); + TTree *treeH = fLoader->TreeH(); + TTree *treeD = fLoader->TreeD(); + TTree *treeR = fLoader->TreeR(); if (treeH) { + if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000); if (fPadHits) { branch = treeH->GetBranch("MUONCluster"); if (branch) branch->SetAddress(&fPadHits); } + if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); } + //it must be under fHits creation + AliDetector::SetTreeAddress(); if (treeD) { + if (fDchambers == 0x0) + { + fDchambers = new TObjArray(AliMUONConstants::NCh()); + for (Int_t i=0; iAddAt(new TClonesArray("AliMUONDigit",10000),i); + } + } for (int i=0; iGetBranch(branchname); if (branch) branch->SetAddress(&((*fDchambers)[i])); } @@ -685,6 +620,14 @@ void AliMUON::SetTreeAddress() // printf("SetTreeAddress --- treeR address %p \n",treeR); if (treeR) { + if (fRawClusters == 0x0) + { + fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); + for (Int_t i=0; iAddAt(new TClonesArray("AliMUONRawCluster",10000),i); + } + } + for (int i=0; iGetBranch("MUONLocalTrigger"); if (branch) branch->SetAddress(&fLocalTrigger); } + + if (fGlobalTrigger == 0x0) { + fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); + } + if (fGlobalTrigger) { branch = treeR->GetBranch("MUONGlobalTrigger"); if (branch) branch->SetAddress(&fGlobalTrigger); @@ -915,9 +867,9 @@ void AliMUON::SDigits2Digits() fMerger->Init(); fMerger->Digitise(); char hname[30]; - sprintf(hname,"TreeD%d",gAlice->GetHeader()->GetEvent()); - gAlice->TreeD()->Write(hname,TObject::kOverwrite); - gAlice->TreeD()->Reset(); + // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent()); + fLoader->TreeD()->Write(hname,TObject::kOverwrite); + fLoader->TreeD()->Reset(); } //___________________________________________ @@ -987,6 +939,7 @@ void AliMUON::Trigger(Int_t nev){ decision->Trigger(); decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); + // add a local trigger in the list AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); Int_t i; @@ -1008,14 +961,17 @@ void AliMUON::Trigger(Int_t nev){ AddLocalTrigger(localtr); // add a local trigger in the list } } + delete decision; - gAlice->TreeR()->Fill(); + fLoader->TreeR()->Fill(); +// char hname[30]; +// sprintf(hname,"TreeR%d",nev); +// fLoader->TreeR()->Write(hname,TObject::kOverwrite); +// fLoader->TreeR()->Reset(); + fLoader->WriteRecPoints("OVERWRITE"); ResetTrigger(); - char hname[30]; - sprintf(hname,"TreeR%d",nev); - gAlice->TreeR()->Write(hname,TObject::kOverwrite); - gAlice->TreeR()->Reset(); + printf("\n End of trigger for event %d", nev); } @@ -1025,11 +981,12 @@ void AliMUON::Digits2Reco() { FindClusters(); Int_t nev = gAlice->GetHeader()->GetEvent(); - gAlice->TreeR()->Fill(); - char hname[30]; - sprintf(hname,"TreeR%d", nev); - gAlice->TreeR()->Write(hname); - gAlice->TreeR()->Reset(); + fLoader->TreeR()->Fill(); + // char hname[30]; + // sprintf(hname,"TreeR%d", nev); + //fLoader->TreeR()->Write(hname); + //fLoader->TreeR()->Reset(); + fLoader->WriteRecPoints("OVERWRITE"); ResetRawClusters(); printf("\n End of cluster finding for event %d", nev); } @@ -1044,20 +1001,22 @@ void AliMUON::FindClusters() dig1 = new TClonesArray("AliMUONDigit",1000); dig2 = new TClonesArray("AliMUONDigit",1000); AliMUONDigit *digit; -// // Loop on chambers and on cathode planes // ResetRawClusters(); + TClonesArray * muonDigits; + for (Int_t ich = 0; ich < 10; ich++) { //PH AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich]; AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich); AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel(); - gAlice->ResetDigits(); - gAlice->TreeD()->GetEvent(0); - TClonesArray *muonDigits = this->DigitsAddress(ich); + ResetDigits(); + fLoader->TreeD()->GetEvent(0); + //TClonesArray * + muonDigits = (TClonesArray *) Dchambers()->At(ich); ndig=muonDigits->GetEntriesFast(); - printf("\n 1 Found %d digits in %p %d", ndig, muonDigits,ich); + printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich); TClonesArray &lhits1 = *dig1; Int_t n = 0; for (k = 0; k < ndig; k++) { @@ -1065,9 +1024,10 @@ void AliMUON::FindClusters() if (rec->TestTrack(digit->Track(0))) new(lhits1[n++]) AliMUONDigit(*digit); } - gAlice->ResetDigits(); - gAlice->TreeD()->GetEvent(1); - muonDigits = this->DigitsAddress(ich); + ResetDigits(); + fLoader->TreeD()->GetEvent(1); + //muonDigits = this->DigitsAddress(ich); + muonDigits = (TClonesArray *) Dchambers()->At(ich); ndig=muonDigits->GetEntriesFast(); printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich); TClonesArray &lhits2 = *dig2; @@ -1240,7 +1200,7 @@ AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t iclu // Obsolete ?? TClonesArray *muonRawCluster = RawClustAddress(ichamber); ResetRawClusters(); - TTree *treeR = gAlice->TreeR(); + TTree *treeR = fLoader->TreeR(); Int_t nent=(Int_t)treeR->GetEntries(); treeR->GetEvent(nent-2+icathod-1); //treeR->GetEvent(icathod); diff --git a/MUON/AliMUON.h b/MUON/AliMUON.h index 16893fa08dc..2da64385b45 100644 --- a/MUON/AliMUON.h +++ b/MUON/AliMUON.h @@ -4,6 +4,8 @@ * See cxx source for full Copyright notice */ /* $Id$ */ +/* $Id$ */ + //////////////////////////////////////////////// // AliDetector Class for MUON subsystem // @@ -56,7 +58,7 @@ class AliMUON : public AliDetector { TClonesArray *PadHits() {return fPadHits;} TClonesArray *LocalTrigger() {return fLocalTrigger;} TClonesArray *GlobalTrigger() {return fGlobalTrigger;} - virtual void MakeBranch(Option_t *opt=" ", const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void MakeBranchInTreeD(TTree *treeD, const char *file=0); void SetTreeAddress(); virtual void ResetHits(); @@ -132,18 +134,18 @@ class AliMUON : public AliDetector { protected: Int_t fNCh; // Number of chambers Int_t fNTrackingCh; // Number of tracking chambers - TObjArray *fChambers; // List of Tracking Chambers - TObjArray *fTriggerCircuits; // List of Trigger Circuits + TObjArray *fChambers; //! List of Tracking Chambers + TObjArray *fTriggerCircuits; //! List of Trigger Circuits Int_t fNPadHits; // Number of pad hits - TClonesArray *fPadHits; // List of pad hits - TObjArray *fDchambers; // List of digits + TClonesArray *fPadHits; //! List of pad hits + TObjArray *fDchambers; //! List of digits Int_t *fNdch; // [fNCh] Number of digits per chamber - TObjArray *fRawClusters; // List of raw clusters + TObjArray *fRawClusters; //! List of raw clusters Int_t *fNrawch; // [fNTrackingCh] Number of raw clusters per chamber Int_t fNLocalTrigger; // Number of Local Trigger - TClonesArray *fLocalTrigger; // List of Local Trigger + TClonesArray *fLocalTrigger; //! List of Local Trigger Int_t fNGlobalTrigger; // Number of Global Trigger - TClonesArray *fGlobalTrigger; // List of Global Trigger + TClonesArray *fGlobalTrigger; //! List of Global Trigger // Bool_t fAccCut; //Transport acceptance cut @@ -166,7 +168,7 @@ class AliMUON : public AliDetector { Text_t *fFileName; // ! File with background hits AliMUONMerger *fMerger; // ! pointer to merger - ClassDef(AliMUON,2) // MUON Detector base class + ClassDef(AliMUON,3) // MUON Detector base class }; #endif diff --git a/MUON/AliMUONChamber.cxx b/MUON/AliMUONChamber.cxx index 70411531d0f..ee8cbadfff8 100644 --- a/MUON/AliMUONChamber.cxx +++ b/MUON/AliMUONChamber.cxx @@ -12,68 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2001/07/20 10:03:14 morsch -Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba) -Revision 1.10 2001/03/20 13:17:30 egangler -fChargeCorrel moved from AliMUONChamber to AliMUONResponse as decided by -January meeting. -Setters and Getters are modified accordingly. -This modification is transparent to the user code - -Revision 1.9 2001/01/26 21:35:54 morsch -All pointers set to 0 in default constructor. - -Revision 1.8 2001/01/17 20:53:40 hristov -Destructors corrected to avoid memory leaks - -Revision 1.7 2000/12/20 13:00:22 egangler - -Added charge correlation between cathods. -In Config_slat.C, use - MUON->Chamber(chamber-1).SetChargeCorrel(0.11); to set the RMS of - q1/q2 to 11 % (number from Alberto) - This is stored in AliMUONChamber fChargeCorrel member. - At generation time, when a tracks enters the volume, - AliMUONv1::StepManager calls - AliMUONChamber::ChargeCorrelationInit() to set the current value of - fCurrentCorrel which is then used at Disintegration level to scale - appropriately the PadHit charges. - -Revision 1.6 2000/10/09 14:01:12 morsch -Double inclusion of AliResponse removed. - -Revision 1.5 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.4 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.3 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.5 2000/06/09 21:27:01 morsch -Most coding rule violations corrected. - -Revision 1.1.2.4 2000/05/05 11:34:12 morsch -Log inside comments. - -Revision 1.1.2.3 2000/05/05 10:09:52 morsch -Log messages included -*/ +/* $Id$ */ // --- MUON includes --- #include "AliMUONChamber.h" diff --git a/MUON/AliMUONChamberTrigger.cxx b/MUON/AliMUONChamberTrigger.cxx index 8da0d68686f..bcf95ee045e 100644 --- a/MUON/AliMUONChamberTrigger.cxx +++ b/MUON/AliMUONChamberTrigger.cxx @@ -13,54 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.8 2000/11/20 21:44:17 pcrochet -some modifications to account for the new class AliMUONResponseTriggerV1 - -Revision 1.7 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.6 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.5 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.4 2000/06/29 06:52:02 pcrochet -pow changed to TMath::Power - -Revision 1.3 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.3 2000/06/09 21:27:35 morsch -Most coding rule violations corrected. - -Revision 1.1.2.2 2000/04/26 12:28:25 morsch -- flag pad hits with condition on ToF (CP) -- Tof included in the method DisIntegration (CP) - -Revision 1.1.2.1 2000/02/17 14:30:54 morsch -Draft version - -*/ +/* $Id$ */ #include "AliMUONChamberTrigger.h" #include "AliMUONSegmentationTrigger.h" diff --git a/MUON/AliMUONClusterFinderAZ.cxx b/MUON/AliMUONClusterFinderAZ.cxx index 0f7f9df8809..4763a707898 100644 --- a/MUON/AliMUONClusterFinderAZ.cxx +++ b/MUON/AliMUONClusterFinderAZ.cxx @@ -104,13 +104,18 @@ void AliMUONClusterFinderAZ::EventLoop(Int_t nev=0, Int_t ch=0) newev: Int_t nparticles = 0, nent; - if (!fReco) nparticles = gAlice->GetEvent(nev); + + //Loaders + AliRunLoader * rl = AliRunLoader::GetRunLoader(); + AliLoader * gime = rl->GetLoader("MUONLoader"); + + if (!fReco) nparticles = rl->GetEvent(nev); else nparticles = gAlice->GetNtrack(); cout << "nev " << nev <TreeH(); + TTree *TH = gime->TreeH(); Int_t ntracks = (Int_t) TH->GetEntries(); cout<<"ntracks "<Particles(); if (!fReco) { - TR = gAlice->TreeR(); + TR = gime->TreeR(); if (TR) { MUON->ResetRawClusters(); nent = (Int_t) TR->GetEntries(); @@ -131,7 +136,7 @@ newev: } // if (TR) } // if (!fReco) - TTree *TD = gAlice->TreeD(); + TTree *TD = gime->TreeD(); //MUON->ResetDigits(); TClonesArray *MUONrawclust; diff --git a/MUON/AliMUONClusterFinderVS.cxx b/MUON/AliMUONClusterFinderVS.cxx index d196fd65616..fff08878d02 100644 --- a/MUON/AliMUONClusterFinderVS.cxx +++ b/MUON/AliMUONClusterFinderVS.cxx @@ -12,128 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2001/05/18 08:54:59 morsch -Bug in decision on splitting corrected. - -Revision 1.20 2001/04/12 12:22:26 morsch -- some numerical problems caused by pad staggering cured. -- treatment of 1-2 and 2-1 ghosts -- debuglevel > 1 prints introduced - -Revision 1.19 2001/03/20 13:32:10 egangler -Code introduced to remove ghosts with the charge correlation between the 2 -cathods. A chi2 is performed for the 2 possibilities. -If one gets good chi2 (with respect to the fGhostChi2Cut parameter) and the -other wrong chi2, the ambiguity is solved -If both gets good or both bad chi2, no choice is made -By default the fGhostChi2Cut parameter is set to solve about 70% of ghost -problems with about 2% errors, with the current version of the code. - -Implementation : -fGhostChi2Cut is in AliMUONClusterFinderVS, with setters and getters. -a fDebugLevel was also introduced to switch off some of the output. -When an ambiguity is detected and not solved, the fGhost word in -AliMUONRawCluster is set to 1 or 2, depending whether both charge chi2 are -good or bad. -a DumpIndex method was also added in AliMUONRawCluster to produce a printout -of digit indexes. - -User incidences : -By default, the code makes ghost check. If you want previous behaviour, -put in MUONrawclusters the value of SetGhostChi2Cut to infinity (1e.6) is -sufficient. - -Revision 1.18 2001/01/26 21:37:53 morsch -Use access functions to AliMUONDigit member data. - -Revision 1.17 2001/01/23 18:58:19 hristov -Initialisation of some pointers - -Revision 1.16 2000/12/21 23:27:30 morsch -Error in argument list of AddRawCluster corrected. - -Revision 1.15 2000/12/21 22:14:38 morsch -Clean-up of coding rule violations. - -Revision 1.14 2000/10/23 16:03:45 morsch -Correct z-position of all clusters created "on the flight". - -Revision 1.13 2000/10/23 13:38:23 morsch -Set correct z-coordinate when cluster is split. - -Revision 1.12 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.11 2000/10/06 09:04:05 morsch -- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate - to make code work with slat chambers (AM) -- Replace GetPadI calls with unchecked x,y coordinates by pad iterator calls wherever possible. - -Revision 1.10 2000/10/03 13:51:57 egangler -Removal of useless dependencies via forward declarations - -Revision 1.9 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.8 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.7 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.6 2000/06/28 12:19:18 morsch -More consequent seperation of global input data services (AliMUONClusterInput singleton) and the -cluster and hit reconstruction algorithms in AliMUONClusterFinderVS. -AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. -It requires two cathode planes. Small modifications in the code will make it usable for -one cathode plane and, hence, more general (for test beam data). -AliMUONClusterFinder is now obsolete. - -Revision 1.5 2000/06/28 08:06:10 morsch -Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the -algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. -It also naturally takes care of the TMinuit instance. - -Revision 1.4 2000/06/27 16:18:47 gosset -Finally correct implementation of xm, ym, ixm, iym sizes -when at least three local maxima on cathode 1 or on cathode 2 - -Revision 1.3 2000/06/22 14:02:45 morsch -Parameterised size of xm[], ym[], ixm[], iym[] correctly implemented (PH) -Some HP scope problems corrected (PH) - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.3 2000/06/09 21:58:33 morsch -Most coding rule violations corrected. - -Revision 1.1.2.2 2000/02/15 08:33:52 morsch -Error in calculation of contribution map for double clusters (Split method) corrected (A.M.) -Error in determination of track list for double cluster (FillCluster method) corrected (A.M.) -Revised and extended SplitByLocalMaxima method (Isabelle Chevrot): - - For clusters with more than 2 maxima on one of the cathode planes all valid - combinations of maxima on the two cathodes are preserved. The position of the maxima is - taken as the hit position. - - New FillCluster method with 2 arguments to find tracks associated to the clusters - defined above added. (Method destinction by argument list not very elegant in this case, - should be revides (A.M.) - - Bug in if-statement to handle maximum 1 maximum per plane corrected - - Two cluster per cathode but only 1 combination valid is handled. - - More rigerous treatment of 1-2 and 2-1 combinations of maxima. -*/ +/* $Id$ */ #include "AliMUONClusterFinderVS.h" #include "AliMUONDigit.h" diff --git a/MUON/AliMUONClusterInput.cxx b/MUON/AliMUONClusterInput.cxx index ac86c76cb1f..3b7acc59493 100644 --- a/MUON/AliMUONClusterInput.cxx +++ b/MUON/AliMUONClusterInput.cxx @@ -13,56 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2001/03/20 13:33:23 egangler -Small cleanup +/* $Id$ */ -Revision 1.9 2001/01/26 21:38:49 morsch -Use access functions to AliMUONDigit member data. - -Revision 1.8 2001/01/23 18:58:19 hristov -Initialisation of some pointers - -Revision 1.7 2000/12/21 22:14:38 morsch -Clean-up of coding rule violations. - -Revision 1.6 2000/10/06 09:04:50 morsch - -- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate - to make code work with slat chambers. - -Revision 1.5 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.2 2000/06/28 12:19:18 morsch -More consequent seperation of global input data services (AliMUONClusterInput singleton) and the -cluster and hit reconstruction algorithms in AliMUONClusterFinderVS. -AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. -It requires two cathode planes. Small modifications in the code will make it usable for -one cathode plane and, hence, more general (for test beam data). -AliMUONClusterFinder is now obsolete. - -Revision 1.1 2000/06/28 08:06:10 morsch -Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the -algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. -It also naturally takes care of the TMinuit instance. - -*/ #include "AliRun.h" #include "AliMUON.h" #include "AliMUONChamber.h" diff --git a/MUON/AliMUONConstants.cxx b/MUON/AliMUONConstants.cxx index af46b1c5e21..6c2623fcba0 100644 --- a/MUON/AliMUONConstants.cxx +++ b/MUON/AliMUONConstants.cxx @@ -13,36 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2001/03/16 15:32:06 morsch -Corrections of overlap with beam shield and dipole (A. de Falco) - -Revision 1.7 2001/03/14 17:22:15 pcrochet -Geometry of the trigger chambers : a vertical gap of has been introduced around x=0 according fig.3.27 of the TDR (P.Dupieux) - -Revision 1.6 2001/01/30 12:19:39 morsch -Update chamber positions (AdTDR version update 4/12/2000). - -Revision 1.5 2000/10/18 13:26:10 morsch -New z-positions of chambers after Erice - -Revision 1.4 2000/10/06 09:09:56 morsch -Outer radius of chambers adjusted to accomodate slat chambers (to be checked and updated). - -Revision 1.3 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.2 2000/06/27 09:46:57 morsch -kMAXZOOM global constant now in AliMUONConstants - -Revision 1.1 2000/06/26 14:02:38 morsch -Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. - -*/ +/* $Id$ */ #include "AliMUONConstants.h" diff --git a/MUON/AliMUONDigit.cxx b/MUON/AliMUONDigit.cxx index 5a35a107e75..b97b51d29ed 100644 --- a/MUON/AliMUONDigit.cxx +++ b/MUON/AliMUONDigit.cxx @@ -13,24 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2001/10/31 16:40:07 jchudoba -change preprocessor constant to C++ constant - -Revision 1.4 2001/10/18 14:44:09 jchudoba -Define constant MAXTRACKS for maximum number of tracks associated with 1 digit - -Revision 1.3 2001/01/26 21:26:58 morsch -All data members private. Access functions provided. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 22:03:22 morsch -Was before in DataStructures.cxx - -*/ +/* $Id$ */ #include "AliMUONDigit.h" diff --git a/MUON/AliMUONDigitizer.cxx b/MUON/AliMUONDigitizer.cxx index dd45331cb8b..673c0351bbe 100644 --- a/MUON/AliMUONDigitizer.cxx +++ b/MUON/AliMUONDigitizer.cxx @@ -13,46 +13,20 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.12 2003/01/14 10:50:19 alibrary -Cleanup of STEER coding conventions +/* $Id$ */ -Revision 1.11 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.10 2002/03/13 07:55:04 jchudoba -Correction of the errourness last commit. - -Revision 1.8 2002/02/13 09:03:24 jchudoba -Remove some deletes from dtor, those objects are deleted earlier in Exec() method (where they are created) - -Revision 1.7 2001/11/22 11:15:41 jchudoba -Proper deletion of arrays (thanks to Rene Brun) - -Revision 1.6 2001/11/02 12:55:45 jchudoba -cleanup of the code, add const to Get methods - -Revision 1.4 2001/10/18 14:44:09 jchudoba -Define constant MAXTRACKS for maximum number of tracks associated with 1 digit - -Revision 1.3 2001/10/04 20:01:54 jchudoba -changes for TTask implementation, some other small editing - -Revision 1.2 2001/07/28 10:46:04 hristov -AliRunDigitizer.h included; typos corrected - -Revision 1.1 2001/07/27 15:41:01 jchudoba -merging/digitization classes - -*/ #include #include -#include -#include #include -#include +#include "AliRunLoader.h" +#include "AliLoader.h" +#include + +#include "AliMUONDigitizer.h" +#include "AliMUONConstants.h" +#include "AliMUONChamber.h" +#include "AliMUONHitMapA1.h" #include "AliMUON.h" #include "AliMUONChamber.h" #include "AliMUONConstants.h" @@ -89,7 +63,7 @@ AliMUONDigitizer::AliMUONDigitizer(AliRunDigitizer* manager) fDebug = 0; if (GetDebug()>2) cerr<<"AliMUONDigitizer::AliMUONDigitizer" - <<"(AliRunDigitizer* manager) was processed"<QPad(); // charge per pad pdigit->AddSignal(iqpad); - pdigit->AddPhysicsSignal(iqpad); + pdigit->AddPhysicsSignal(iqpad); // update list of tracks // @@ -184,10 +158,17 @@ void AliMUONDigitizer::Exec(Option_t* option) AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); if (!pMUON) { cerr<<"AliMUONDigitizer::Digitize Error:" - <<" module MUON not found in the input file"<MakeBranchInTreeD(fManager->GetTreeD()); + + AliRunLoader *rl, *orl; + AliLoader *gime, *ogime; + orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + ogime = orl->GetLoader("MUONLoader"); + + pMUON->MakeBranchInTreeD(ogime->TreeD()); + fHitMap= new AliMUONHitMapA1* [AliMUONConstants::NCh()]; // @@ -199,8 +180,8 @@ void AliMUONDigitizer::Exec(Option_t* option) for (Int_t i = 0; i < AliMUONConstants::NCh(); i++) { iChamber = &(pMUON->Chamber(i)); // if (!(iChamber->Nsec() == 1 && icat == 1)) { - segmentation = iChamber->SegmentationModel(icat+1); - fHitMap[i] = new AliMUONHitMapA1(segmentation, fTDList); + segmentation = iChamber->SegmentationModel(icat+1); + fHitMap[i] = new AliMUONHitMapA1(segmentation, fTDList); // } } @@ -208,35 +189,40 @@ void AliMUONDigitizer::Exec(Option_t* option) // Loop over files to digitize fSignal = kTRUE; for (Int_t inputFile=0; inputFileGetNinputs(); - inputFile++) { + inputFile++) { // Connect MUON branches if (inputFile > 0 ) fSignal = kFALSE; TBranch *branchHits = 0; TBranch *branchPadHits = 0; - TTree *treeH = fManager->GetInputTreeH(inputFile); + + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + gime = rl->GetLoader("MUONLoader"); + + + TTree *treeH = gime->TreeH(); if (GetDebug()>2) { - cerr<<" inputFile , cathode = "<GetBranch("MUON"); - if (branchHits) { - fHits->Clear(); - branchHits->SetAddress(&fHits); - } - else - Error("Exec","branch MUON was not found"); + branchHits = treeH->GetBranch("MUON"); + if (branchHits) { + fHits->Clear(); + branchHits->SetAddress(&fHits); + } + else + Error("Exec","branch MUON was not found"); } if (GetDebug()>2) cerr<<" branchHits = "<GetBranch("MUONCluster"); - if (branchPadHits) - branchPadHits->SetAddress(&fPadHits); - else - Error("Exec","branch MUONCluster was not found"); + branchPadHits = treeH->GetBranch("MUONCluster"); + if (branchPadHits) + branchPadHits->SetAddress(&fPadHits); + else + Error("Exec","branch MUONCluster was not found"); } if (GetDebug()>2) cerr<<" branchPadHits = "<GetEntries(); for (fTrack = 0; fTrack < ntracks; fTrack++) { - if (GetDebug()>2) cerr<<" fTrack = "<Clear(); - fPadHits->Clear(); - branchHits->GetEntry(fTrack); - branchPadHits->GetEntry(fTrack); - + if (GetDebug()>2) cerr<<" fTrack = "<Clear(); + fPadHits->Clear(); + branchHits->GetEntry(fTrack); + branchPadHits->GetEntry(fTrack); + // // Loop over hits - AliMUONHit* mHit; - for(Int_t i = 0; i < fHits->GetEntriesFast(); ++i) { - mHit = static_cast(fHits->At(i)); - fNch = mHit->Chamber()-1; // chamber number - if (fNch > AliMUONConstants::NCh()-1) { - cerr<<"AliMUONDigitizer: ERROR: " - <<"fNch > AliMUONConstants::NCh()-1, fNch, NCh(): " - <Chamber(fNch)); + AliMUONHit* mHit; + for(Int_t i = 0; i < fHits->GetEntriesFast(); ++i) { + mHit = static_cast(fHits->At(i)); + fNch = mHit->Chamber()-1; // chamber number + if (fNch > AliMUONConstants::NCh()-1) { + cerr<<"AliMUONDigitizer: ERROR: " + <<"fNch > AliMUONConstants::NCh()-1, fNch, NCh(): " + <Chamber(fNch)); // // Loop over pad hits - for (AliMUONPadHit* mPad = - (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits); - mPad; - mPad = (AliMUONPadHit*)pMUON->NextPad(fPadHits)) - { - Int_t cathode = mPad->Cathode(); // cathode number - Int_t ipx = mPad->PadX(); // pad number on X - Int_t ipy = mPad->PadY(); // pad number on Y - Int_t iqpad = Int_t(mPad->QPad()); // charge per pad - if (cathode != (icat+1)) continue; - - fMask = fManager->GetMask(inputFile); - fDigits[0] = ipx; - fDigits[1] = ipy; - fDigits[2] = icat; - fDigits[3] = iqpad; - if (inputFile == 0) { - fDigits[4] = iqpad; - } else { - fDigits[4] = 0; - } - if (mHit->Particle() == kMuonPlus || - mHit->Particle() == kMuonMinus) { - fDigits[5] = (mPad->HitNumber()) + fMask; - } else fDigits[5] = -1; - - // build the list of fired pads and update the info, - // fDigits is input for Update(mPad) - - if (!Exists(mPad)) { - CreateNew(mPad); - } else { - Update(mPad); - } // end if Exists(mPad) - } //end loop over clusters - } // hit loop + for (AliMUONPadHit* mPad = + (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits); + mPad; + mPad = (AliMUONPadHit*)pMUON->NextPad(fPadHits)) + { + Int_t cathode = mPad->Cathode(); // cathode number + Int_t ipx = mPad->PadX(); // pad number on X + Int_t ipy = mPad->PadY(); // pad number on Y + Int_t iqpad = Int_t(mPad->QPad()); // charge per pad + if (cathode != (icat+1)) continue; + + fMask = fManager->GetMask(inputFile); + fDigits[0] = ipx; + fDigits[1] = ipy; + fDigits[2] = icat; + fDigits[3] = iqpad; + if (inputFile == 0) { + fDigits[4] = iqpad; + } else { + fDigits[4] = 0; + } + if (mHit->Particle() == kMuonPlus || + mHit->Particle() == kMuonMinus) { + fDigits[5] = (mPad->HitNumber()) + fMask; + } else fDigits[5] = -1; + + // build the list of fired pads and update the info, + // fDigits is input for Update(mPad) + + if (!Exists(mPad)) { + CreateNew(mPad); + } else { + Update(mPad); + } // end if Exists(mPad) + } //end loop over clusters + } // hit loop } // track loop } // end file loop if (GetDebug()>2) cerr<<"END OF FILE LOOP"<GetEntriesFast(); - + for (Int_t nent = 0; nent < nentries; nent++) { AliMUONTransientDigit *address = (AliMUONTransientDigit*)fTDList->At(nent); if (address == 0) continue; @@ -325,63 +311,67 @@ void AliMUONDigitizer::Exec(Option_t* option) q = response->DigitResponse(q,address); if (!q) continue; - + fDigits[0] = address->PadX(); fDigits[1] = address->PadY(); fDigits[2] = address->Cathode(); fDigits[3] = q; fDigits[4] = address->Physics(); fDigits[5] = address->Hit(); - + Int_t nptracks = address->GetNTracks(); if (nptracks > kMAXTRACKS) { - if (GetDebug() >0) { - cerr<<"AliMUONDigitizer: nptracks > 10 "<0) { + cerr<<"AliMUONDigitizer: nptracks > 10 "< 2 && GetDebug() >2) { - cerr<<"AliMUONDigitizer: nptracks > 2 "< 2 "<GetTrack(tr); - charges[tr] = address->GetCharge(tr); + tracks[tr] = address->GetTrack(tr); + charges[tr] = address->GetCharge(tr); } //end loop over list of tracks for one pad // Sort list of tracks according to charge if (nptracks > 1) { - SortTracks(tracks,charges,nptracks); + SortTracks(tracks,charges,nptracks); } if (nptracks < kMAXTRACKS ) { - for (Int_t i = nptracks; i < kMAXTRACKS; i++) { - tracks[i] = 0; - charges[i] = 0; - } + for (Int_t i = nptracks; i < kMAXTRACKS; i++) { + tracks[i] = 0; + charges[i] = 0; + } } - + // fill digits pMUON->AddDigits(ich,tracks,charges,fDigits); } + +// fManager->GetTreeD()->Fill(); + ogime->TreeD()->Fill(); - fManager->GetTreeD()->Fill(); pMUON->ResetDigits(); // fTDList->Clear(); - + for(Int_t ii = 0; ii < AliMUONConstants::NCh(); ++ii) { if (fHitMap[ii]) { - delete fHitMap[ii]; - fHitMap[ii] = 0; + delete fHitMap[ii]; + fHitMap[ii] = 0; } } } //end loop over cathodes if (GetDebug()>2) cerr<<"AliMUONDigitizer::Exec: writing the TreeD: " - <GetTreeD()->GetName()<GetTreeD()->Write(0,TObject::kOverwrite); + << ogime->TreeD()->GetName()<WriteDigits("OVERWRITE"); + delete [] fHitMap; delete fTDList; @@ -418,11 +408,11 @@ void AliMUONDigitizer::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr) for(j=0;j qmax) { - qmax = charges[j]; - jmax=j; + qmax = charges[j]; + jmax=j; } } diff --git a/MUON/AliMUONDigitizerv1.cxx b/MUON/AliMUONDigitizerv1.cxx index 5681a19e662..cdc04ae56e9 100644 --- a/MUON/AliMUONDigitizerv1.cxx +++ b/MUON/AliMUONDigitizerv1.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include "AliMUON.h" #include "AliMUONChamber.h" @@ -18,6 +19,8 @@ #include "AliMUONTransientDigit.h" #include "AliRun.h" #include "AliRunDigitizer.h" +#include "AliRunLoader.h" +#include "AliLoader.h" ClassImp(AliMUONDigitizerv1) @@ -168,7 +171,6 @@ void AliMUONDigitizerv1::Exec(Option_t* option) cout<<"AliMUONDigitizerv1::Exec: called with option deb "<2) cerr<<"AliMUONDigitizerv1::Digitize() starts"<GetModule("MUON"); + //Loaders (We assume input0 to be the output too) + AliRunLoader * runloader; // Input loader + AliLoader * gime; + + runloader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + if (runloader == 0x0) { + cerr<<"AliMUONDigitizerv1::Digitize() opening file "<GetInputFileName(0,0)<GetLoader("MUONLoader"); + if (gime->TreeH()==0x0) { + Info("Digitize","TreeH is not loaded yet. Loading..."); + gime->LoadHits("READ"); + Info("Digitize","Now treeH is %#x. MUONLoader is %#x",gime->TreeH(),gime); + } + + if (GetDebug()>2) cerr<<"AliMUONDigitizerv1::Digitize() loaders"<GetAliRun() == 0x0) runloader->LoadgAlice(); + gAlice = runloader->GetAliRun(); + + // Getting Module MUON + AliMUON *pMUON = (AliMUON *) gAlice->GetDetector("MUON"); if (!pMUON) { cerr<<"AliMUONDigitizerv1::Digitize Error:" <<" module MUON not found in the input file"<MakeBranchInTreeD(fManager->GetTreeD()); + } + + // Loading Event + Int_t currentevent = fManager->GetOutputEventNr(); + + if (GetDebug()>2) cerr<<"AliMUONDigitizerv1::Digitize() Event Number is "<GetOutputFolderName()); + AliLoader * gimeout = runloaderout->GetLoader("MUONLoader"); + // New branch per chamber for MUON digit in the tree of digits + if (gime->TreeD() == 0x0) gimeout->MakeDigitsContainer(); + TTree* treeD = gimeout->TreeD(); + pMUON->MakeBranchInTreeD(treeD); // Array of pointer of the AliMUONHitMapA1: // two HitMaps per chamber, or one HitMap per cahtode plane @@ -202,10 +239,29 @@ void AliMUONDigitizerv1::Exec(Option_t* option) // Loop over files to merge and to digitize fSignal = kTRUE; for (Int_t inputFile=0; inputFileGetNinputs(); inputFile++) { - // Connect MUON Hit branch - if (inputFile > 0 ) fSignal = kFALSE; + if (GetDebug()>2) cerr<<"AliMUONDigitizerv1::Digitize() Input File is "<GetInputTreeH(inputFile); + + // Connect MUON Hit branch + if (inputFile > 0 ) { + fSignal = kFALSE; + runloader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + if (runloader == 0x0) { + cerr<<"AliMUONDigitizerv1::Digitize() RunLoader for inputFile "<GetLoader("MUONLoader"); + if (gime->TreeH() == 0x0) gime->LoadHits("READ"); + } + + // Setting the address of fHits list + TTree *treeH = gime->TreeH(); + if (treeH == 0x0) { + Error("Digitize","Can not get TreeH from input %d",inputFile); + Info("Digitize","Now treeH is %#x. MUONLoader is %#x",gime->TreeH(),gime); + return; + } if (GetDebug()>2) { cerr<<"AliMUONDigitizerv1::Exec inputFile is "<2) cerr<<"AliMUONDigitizerv1::Exec branchHits = "<GetMask(inputFile); // // Loop over tracks @@ -229,7 +286,7 @@ void AliMUONDigitizerv1::Exec(Option_t* option) for (itrack = 0; itrack < ntracks; itrack++) { if (GetDebug()>2) cerr<<"AliMUONDigitizerv1::Exec itrack = "<Clear(); - branchHits->GetEntry(itrack); + treeH->GetEvent(itrack); // // Loop over hits Int_t ihit, ichamber; @@ -271,7 +328,6 @@ void AliMUONDigitizerv1::Exec(Option_t* option) } // end file loop if (GetDebug()>2) cerr<<"AliMUONDigitizer::Exec End of hits, track and file loops"<2) cerr<<"AliMUONDigitzerv1::Exex TransientDigit to Digit"<3) cerr<<"AliMUONDigitzerv1::Exex TransientDigit to Digit"<AddDigits(ich,tracks,charges,digits); } - fManager->GetTreeD()->Fill(); - pMUON->ResetDigits(); // + // Filling list of digits per chamber for a given cathode. + treeD->Fill(); + pMUON->ResetDigits(); } // end loop cathode fTDList->Delete(); @@ -347,8 +404,9 @@ void AliMUONDigitizerv1::Exec(Option_t* option) if (GetDebug()>2) cerr<<"AliMUONDigitizer::Exec: writing the TreeD: " - <GetTreeD()->GetName()<GetTreeD()->Write(0,TObject::kOverwrite); + <GetName()<WriteDigits("OVERWRITE"); delete [] fHitMap; delete fTDList; diff --git a/MUON/AliMUONDisplay.cxx b/MUON/AliMUONDisplay.cxx index 41fe8084309..5fc6f3af124 100644 --- a/MUON/AliMUONDisplay.cxx +++ b/MUON/AliMUONDisplay.cxx @@ -13,121 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2001/09/03 14:54:55 gosset -Corrections for suppressing "segmentation violation" errors -when using buttons "Chamber +", "Chamber -", "Cathode <>" - -Revision 1.16 2001/08/31 08:18:43 jchudoba -Changes needed to run with Root 3.01 - -Revision 1.15 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.14 2001/04/05 08:30:48 gosset -Cleaning: suppression of Cpoints and (R2points + CoG2) -Correction: TreeR->GetEvent(0) for raw clusters - -Revision 1.13 2001/03/30 13:01:50 gosset -Centroid of raw clusters displayed for each cathode plane - -Revision 1.12 2001/03/05 23:50:08 morsch -Correct access to digit and recpoint data. - -Revision 1.11 2001/01/26 21:41:55 morsch -Use access functions to AliMUONDigit member data. - -Revision 1.10 2001/01/25 20:41:56 morsch -Protect against empty TreeD and TreeR. - -Revision 1.9 2001/01/23 18:58:19 hristov -Initialisation of some pointers - -Revision 1.8 2000/10/06 09:09:01 morsch -Pad colour according to z-position (slats). - -Revision 1.7 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.5 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.4 2000/06/27 09:46:57 morsch -kMAXZOOM global constant now in AliMUONConstants - -Revision 1.3 2000/06/26 14:02:38 morsch -Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.15 2000/06/14 14:37:53 morsch -method Trigger() modified - -Revision 1.1.2.14 2000/06/09 21:57:09 morsch -Bug in color scale diplay corrected. -Most coding rule violations corrected. - -Revision 1.1.2.13 2000/05/02 11:57:27 morsch -Coding rules RN3, RN13, RN17 violations corrected. - -Revision 1.1.2.12 2000/04/26 12:27:33 morsch -Mods for trigger display (P. Crochet): -- color code versus time for pad hits in trigger chambers -- call to TriggerDecision corrected - -Revision 1.1.2.11 2000/04/26 09:04:46 morsch -Obsolete cathode correlation related code removed. - -Revision 1.1.2.10 2000/04/19 19:43:47 morsch -change NCH to kNCH as in AliMUON.h -no more TreeC related methods - -Revision 1.1.2.9 2000/03/20 18:10:33 morsch -Trigger method for "online" trigger decission added - -Revision 1.1.2.8 2000/02/23 10:12:01 morsch -Dont't try to draw reconstructed hit coordinates for Trigger Chambers. -General clean-up of commented code. - -Revision 1.1.2.7 2000/02/17 14:36:55 morsch -Display of Trigger hits and clusters added. -Displacement between clusters and hits has to be investigated and corrected ! (A.M.) - -Revision 1.1.2.6 2000/02/15 10:19:42 morsch -Previous log messages included - -Revision 1.1.2.5 2000/02/15 10:09:09 morsch -Log Message added - -Revision 1.1.2.4 2000/02/08 09:17:16 gosset -One more improvement of MUON display: -same zoom for both cathode planes in a chamber - -Revision 1.1.2.3 2000/02/07 15:37:21 gosset -A few improvements of the MUON display: -new buttons to change either chamber or cathode, -added to the more complicated way -(right mouse click and explicit filling of chamber and cathode) - -Revision 1.1.2.2 2000/02/04 10:57:34 gosset -Z position of the chambers: -it was the Z position of the stations; -it is now really the Z position of the chambers. - !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS" - !!!! AND "AliMUONChamber::ZPosition" - !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ" - !!!! AND "AliMUONChamber::Z" -*/ +/* $Id$ */ ////////////////////////////////////////////////////////////////////////// // // @@ -1057,11 +943,11 @@ void AliMUONDisplay::LoadHits(Int_t chamber) iChamber = &(pMUON->Chamber(chamber-1)); Float_t zpos=iChamber->Z(); - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); + Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries(); //skowron Int_t nthits = 0; for (track = 0; track < ntracks; track++) { gAlice->ResetHits(); - gAlice->TreeH()->GetEvent(track); + pMUON->TreeH()->GetEvent(track);//skowron TClonesArray *muonHits = pMUON->Hits(); if (muonHits == 0) return; nthits += muonHits->GetEntriesFast(); @@ -1070,7 +956,7 @@ void AliMUONDisplay::LoadHits(Int_t chamber) Int_t nhold=0; for (track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pMUON->TreeH()->GetEvent(track);//skowron TClonesArray *muonHits = pMUON->Hits(); if (muonHits == 0) return; Int_t nhits = muonHits->GetEntriesFast(); diff --git a/MUON/AliMUONEventReconstructor.cxx b/MUON/AliMUONEventReconstructor.cxx index de5f4207f5b..39986d2a1c2 100644 --- a/MUON/AliMUONEventReconstructor.cxx +++ b/MUON/AliMUONEventReconstructor.cxx @@ -13,147 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.31 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.30 2002/10/14 14:57:29 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.28.8.1 2002/10/11 06:56:47 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.29 2002/09/20 13:32:26 cussonno -Minor bugs in the definition of the bending impact parameter corrected (thanks to A. Zinchenko) - -Revision 1.28 2001/08/31 06:50:11 gosset -Different handling of TreeR for track reconstruction from raw clusters - -Revision 1.27 2001/07/27 13:03:12 hristov -Default Branch split level set to 99 - -Revision 1.26 2001/05/03 08:11:31 hristov -stdlib.h included to define exit() - -Revision 1.25 2001/04/25 14:50:42 gosset -Corrections to violations of coding conventions - -Revision 1.24 2001/03/30 09:37:58 gosset -Initialisations of pointers... for GEANT background events in the constructor - -Revision 1.23 2001/01/26 21:44:45 morsch -Use access functions to AliMUONDigit, ... member data. - -Revision 1.22 2001/01/26 20:00:53 hristov -Major upgrade of AliRoot code -Revision 1.20 2001/01/08 11:01:02 gosset -Modifications used for addendum to Dimuon TDR (JP Cussonneau): -*. MaxBendingMomentum to make both a segment and a track (default 500) -*. MaxChi2 per degree of freedom to make a track (default 100) -*. MinBendingMomentum used also to make a track - and not only a segment (default 3) -*. wider roads for track search in stations 1 to 3 -*. extrapolation to actual Z instead of Z(chamber) in FollowTracks -*. in track fit: - - limits on parameters X and Y (+/-500) - - covariance matrices in double precision - - normalization of covariance matrices before inversion - - suppression of Minuit printouts -*. correction against memory leak (delete extrapHit) in FollowTracks -*. RMax to 10 degrees with Z(chamber) instead of fixed values; - RMin and Rmax cuts suppressed in NewHitForRecFromGEANT, - because useless with realistic geometry - -Revision 1.19 2000/11/20 11:24:10 gosset -New package for reconstructed tracks (A. Gheata): -* tree output in the file "tree_reco.root" -* display events and make histograms from this file - -Revision 1.18 2000/10/26 12:47:03 gosset -Real distance between chambers of each station taken into account -for the reconstruction parameters "fSegmentMaxDistBending[5]" - -Revision 1.17 2000/10/24 09:26:20 gosset -Comments updated - -Revision 1.16 2000/10/24 09:22:35 gosset -Method AddHitsForRecFromRawClusters: real Z of raw cluster and not Z of chamber - -Revision 1.15 2000/10/12 15:17:30 gosset -Sign of fSimpleBValue corrected: sign ox Bx and not Bz (thanks to Galina) - -Revision 1.14 2000/10/04 18:21:26 morsch -Include stdlib.h - -Revision 1.13 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.12 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.11 2000/09/22 09:16:33 hristov -Casting needed on DEC - -Revision 1.10 2000/09/19 09:49:50 gosset -AliMUONEventReconstructor package -* track extrapolation independent from reco_muon.F, use of AliMagF... -* possibility to use new magnetic field (automatic from generated root file) - -Revision 1.9 2000/07/20 12:45:27 gosset -New "EventReconstructor..." structure, - hopefully more adapted to tree/streamer. -"AliMUONEventReconstructor::RemoveDoubleTracks" - to keep only one track among similar ones. - -Revision 1.8 2000/07/18 16:04:06 gosset -AliMUONEventReconstructor package: -* a few minor modifications and more comments -* a few corrections - * right sign for Z of raw clusters - * right loop over chambers inside station - * symmetrized covariance matrix for measurements (TrackChi2MCS) - * right sign of charge in extrapolation (ExtrapToZ) - * right zEndAbsorber for Branson correction below 3 degrees -* use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit -* no parameter for AliMUONTrack::Fit() but more fit parameters in Track object - -Revision 1.7 2000/07/03 12:28:06 gosset -Printout at the right place after extrapolation to vertex - -Revision 1.6 2000/06/30 12:01:06 gosset -Correction for hit search in the right chamber (JPC) - -Revision 1.5 2000/06/30 10:15:48 gosset -Changes to EventReconstructor...: -precision fit with multiple Coulomb scattering; -extrapolation to vertex with Branson correction in absorber (JPC) - -Revision 1.4 2000/06/27 14:11:36 gosset -Corrections against violations of coding conventions - -Revision 1.3 2000/06/16 07:27:08 gosset -To remove problem in running RuleChecker, like in MUON-dev - -Revision 1.1.2.5 2000/06/16 07:00:26 gosset -To remove problem in running RuleChecker - -Revision 1.1.2.4 2000/06/12 08:00:07 morsch -Dummy streamer to solve CINT compilation problem (to be investigated !) - -Revision 1.1.2.3 2000/06/09 20:59:57 morsch -Make includes consistent with new file structure. - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ //////////////////////////////////// // @@ -188,6 +48,9 @@ Addition of files for track reconstruction in C++ #include "AliMUONTrackHit.h" #include "AliMagF.h" #include "AliRun.h" // for gAlice +#include "AliConfig.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliMUONTrackK.h" //AZ #include //AZ @@ -541,16 +404,47 @@ void AliMUONEventReconstructor::MakeEventToBeReconstructed(void) // To make the list of hits to be reconstructed, // either from the GEANT hits or from the raw clusters // according to the parameter set for the reconstructor + TString evfoldname = AliConfig::fgkDefaultEventFolderName;//to be interfaced properly + + AliRunLoader* rl = AliRunLoader::GetRunLoader(evfoldname); + if (rl == 0x0) + { + Error("MakeEventToBeReconstructed", + "Can not find Run Loader in Event Folder named %s.", + evfoldname.Data()); + return; + } + AliLoader* gime = rl->GetLoader("MUONLoader"); + if (gime == 0x0) + { + Error("MakeEventToBeReconstructed","Can not get MUON Loader from Run Loader."); + return; + } + if (fPrintLevel >= 1) cout << "enter MakeEventToBeReconstructed" << endl; ResetHitsForRec(); if (fRecGeantHits == 1) { // Reconstruction from GEANT hits // Back to the signal file - ((gAlice->TreeK())->GetCurrentFile())->cd(); - // Signal hits - // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? - // Security on MUON ???? - AddHitsForRecFromGEANT(gAlice->TreeH()); + TTree* treeH = gime->TreeH(); + if (treeH == 0x0) + { + Int_t retval = gime->LoadHits(); + if ( retval) + { + Error("MakeEventToBeReconstructed","Error occured while loading hits."); + return; + } + treeH = gime->TreeH(); + if (treeH == 0x0) + { + Error("MakeEventToBeReconstructed","Can not get TreeH"); + return; + } + } + + AddHitsForRecFromGEANT(treeH); + // Background hits AddHitsForRecFromBkgGEANT(fBkgGeantTH, fBkgGeantHits); // Sort HitsForRec in increasing order with respect to chamber number @@ -562,7 +456,7 @@ void AliMUONEventReconstructor::MakeEventToBeReconstructed(void) // Security on MUON ???? // TreeR assumed to be be "prepared" in calling function // by "MUON->GetTreeR(nev)" ???? - TTree *treeR = gAlice->TreeR(); + TTree *treeR = gime->TreeR(); AddHitsForRecFromRawClusters(treeR); // No sorting: it is done automatically in the previous function } @@ -798,9 +692,32 @@ void AliMUONEventReconstructor::AddHitsForRecFromRawClusters(TTree* TR) Int_t iclus, nclus, nTRentries; TClonesArray *rawclusters; if (fPrintLevel >= 1) cout << "enter AddHitsForRecFromRawClusters" << endl; - AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? + + TString evfoldname = AliConfig::fgkDefaultEventFolderName;//to be interfaced properly + AliRunLoader* rl = AliRunLoader::GetRunLoader(evfoldname); + if (rl == 0x0) + { + Error("MakeEventToBeReconstructed", + "Can not find Run Loader in Event Folder named %s.", + evfoldname.Data()); + return; + } + AliLoader* gime = rl->GetLoader("MUONLoader"); + if (gime == 0x0) + { + Error("MakeEventToBeReconstructed","Can not get MUON Loader from Run Loader."); + return; + } + // Loading AliRun master + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + + // Loading MUON subsystem + AliMUON * pMUON = (AliMUON *) gAlice->GetDetector("MUON"); + + // AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? // Security on MUON ???? - pMUON->ResetRawClusters(); + //pMUON->ResetRawClusters(); nTRentries = Int_t(TR->GetEntries()); if (nTRentries != 1) { cout << "Error in AliMUONEventReconstructor::AddHitsForRecFromRawClusters" @@ -808,7 +725,7 @@ void AliMUONEventReconstructor::AddHitsForRecFromRawClusters(TTree* TR) cout << "nTRentries = " << nTRentries << " not equal to 1" << endl; exit(0); } - TR->GetEvent(0); // only one entry + gime->TreeR()->GetEvent(0); // only one entry // Loop over tracking chambers for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) { // number of HitsForRec to 0 for the chamber @@ -1543,11 +1460,11 @@ void AliMUONEventReconstructor::EventDump(void) np = gAlice->GetNtrack(); printf(" **** number of generated particles: %d \n", np); - for (Int_t iPart = 0; iPart < np; iPart++) { - p = gAlice->Particle(iPart); - printf(" particle %d: type= %d px= %f py= %f pz= %f pdg= %d\n", - iPart, p->GetPdgCode(), p->Px(), p->Py(), p->Pz(), p->GetPdgCode()); - } +// for (Int_t iPart = 0; iPart < np; iPart++) { +// p = gAlice->Particle(iPart); +// printf(" particle %d: type= %d px= %f py= %f pz= %f pdg= %d\n", +// iPart, p->GetPdgCode(), p->Px(), p->Py(), p->Pz(), p->GetPdgCode()); +// } return; } diff --git a/MUON/AliMUONFactory.cxx b/MUON/AliMUONFactory.cxx index 933af1401f0..c4c156bac5e 100644 --- a/MUON/AliMUONFactory.cxx +++ b/MUON/AliMUONFactory.cxx @@ -17,25 +17,8 @@ // Factory for muon chambers, segmentations and response // //////////////////////////////////////////////////////////// -/* -$Log$ -Revision 1.4 2002/10/14 14:57:29 hristov -Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ -Revision 1.2.10.1 2002/10/11 06:56:47 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.3 2002/09/02 14:35:14 morsch -New segmentation radii for Station 2. - -Revision 1.2 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.1 2001/04/06 11:24:43 morsch -Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class. -Static method Build() builds the MUON system out of chambers, segmentation and response. - -*/ #include "AliMUONFactory.h" #include "AliMUON.h" #include "AliMUONChamber.h" diff --git a/MUON/AliMUONHit.cxx b/MUON/AliMUONHit.cxx index 2438d04f390..d59ea595806 100644 --- a/MUON/AliMUONHit.cxx +++ b/MUON/AliMUONHit.cxx @@ -13,18 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2001/03/17 10:07:20 morsch -Correct inconsistent variable name / method name / comments. +/* $Id$ */ -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 22:02:14 morsch -Was before in DataStructures.cxx - -*/ #include "AliMUONHit.h" ClassImp(AliMUONHit) diff --git a/MUON/AliMUONHitForRec.cxx b/MUON/AliMUONHitForRec.cxx index 976bd1656ee..6740d280275 100644 --- a/MUON/AliMUONHitForRec.cxx +++ b/MUON/AliMUONHitForRec.cxx @@ -13,36 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2001/02/05 14:49:29 hristov -Compare() declared const (R.Brun) - -Revision 1.5 2001/01/26 21:46:33 morsch -Use access functions to MUONHit, ... data members. - -Revision 1.4 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.3 2000/06/25 13:06:39 hristov -Inline functions moved from *.cxx to *.h files instead of forward declarations - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.4 2000/06/12 10:11:10 morsch -Dummy copy constructor and assignment operator added - -Revision 1.1.2.3 2000/06/09 22:14:43 morsch -Make includes consistent with new file naming. - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ //__________________________________________________________________________ // diff --git a/MUON/AliMUONHitMapA1.cxx b/MUON/AliMUONHitMapA1.cxx index bda8df51b17..3c562662277 100644 --- a/MUON/AliMUONHitMapA1.cxx +++ b/MUON/AliMUONHitMapA1.cxx @@ -13,44 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2001/11/02 12:43:21 jchudoba -remove fNdigits data member, it could have wrong value if fDigits is updated. Make this class non-persistent - -Revision 1.9 2001/03/20 13:34:05 egangler -Obvious small bug - -Revision 1.8 2001/01/26 21:47:21 morsch -Use access functions to AliMUONDigit member data. - -Revision 1.7 2001/01/25 11:43:48 morsch -Add a "real" default constructor. - -Revision 1.6 2000/10/06 09:05:42 morsch -Correction on upper limits for x- and y- coordinates to make code work with slat chambers. - -Revision 1.5 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/07/13 16:19:44 fca -Mainly coding conventions + some small bug fixes - -Revision 1.3 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.2 2000/06/12 07:58:06 morsch -include TMath.h - -Revision 1.1.2.1 2000/06/09 22:01:09 morsch -Code from AliMUONHitMap.h -Most coding rule violations corrected. - -*/ +/* $Id$ */ #include "AliMUONHitMapA1.h" #include "AliSegmentation.h" diff --git a/MUON/AliMUONMerger.cxx b/MUON/AliMUONMerger.cxx index 9cc4308026b..69d69102da0 100644 --- a/MUON/AliMUONMerger.cxx +++ b/MUON/AliMUONMerger.cxx @@ -13,46 +13,14 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2003/01/14 10:50:19 alibrary -Cleanup of STEER coding conventions +/* $Id$ */ -Revision 1.9 2002/03/13 07:04:11 jchudoba -Connect only MUON branches when reading the event to speed up digitisation. - -Revision 1.8 2002/02/22 12:14:21 morsch -Validate pad hit before digitization. - -Revision 1.7 2001/11/22 11:15:41 jchudoba -Proper deletion of arrays (thanks to Rene Brun) - -Revision 1.6 2001/11/02 12:55:45 jchudoba -cleanup of the code, add const to Get methods - -Revision 1.5 2001/10/31 16:35:07 jchudoba -some functionality move to AliMUONTransientDigit class - -Revision 1.4 2001/03/20 13:36:11 egangler -TFile memory leak and "too many files open" problem solved (?): -the backgroud file is open only once forever, and not once for each event. - -Revision 1.3 2001/03/05 23:57:44 morsch -Writing of digit tree moved to macro. - -Revision 1.2 2001/03/05 08:40:25 morsch -Method SortTracks(..) imported from AliMUON. - -Revision 1.1 2001/02/02 14:11:53 morsch -AliMUONMerger prototype to be called by the merge manager. - -*/ - -#include -#include +#include +#include #include +#include +#include #include -#include #include "AliHitMap.h" #include "AliMUON.h" @@ -241,7 +209,17 @@ void AliMUONMerger::Digitise() // Loop over tracks // - TTree *treeH = gAlice->TreeH(); +/******************************************************************/ + TTree* treeH = pMUON->TreeH(); + if (treeH == 0x0) + { + cerr<<"AliMUONMerger::Exec: Can not get TreeH"<GetEntries(); treeH->SetBranchStatus("*",0); // switch off all branches treeH->SetBranchStatus("MUON*",1); // switch on only MUON diff --git a/MUON/AliMUONPadHit.cxx b/MUON/AliMUONPadHit.cxx index 676a3f7c389..0b4b3ac4c5b 100644 --- a/MUON/AliMUONPadHit.cxx +++ b/MUON/AliMUONPadHit.cxx @@ -13,15 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 22:02:45 morsch -Was before in DataStructures.cxx - -*/ +/* $Id$ */ #include "AliMUONPadHit.h" diff --git a/MUON/AliMUONPoints.cxx b/MUON/AliMUONPoints.cxx index 28022d57f05..4352e730a85 100644 --- a/MUON/AliMUONPoints.cxx +++ b/MUON/AliMUONPoints.cxx @@ -12,33 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2000/10/03 13:51:57 egangler -Removal of useless dependencies via forward declarations - -Revision 1.5 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/27 10:13:01 morsch -Obsolete global variables removed from file. -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.6 2000/06/09 21:57:40 morsch -Most coding rule violations corrected. - -Revision 1.1.2.5 2000/05/05 11:33:56 morsch -Log inside comments. - -Revision 1.1.2.4 2000/05/05 10:12:09 morsch -Log messages included -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -241,7 +216,8 @@ AliMUONHit *AliMUONPoints::GetHit() const // Returns pointer to hit index in AliRun::fParticles // AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); - gAlice->TreeH()->GetEvent(fTrackIndex); + + pMUON->TreeH()->GetEvent(fTrackIndex); TClonesArray *muonHits = pMUON->Hits(); Int_t nhits = muonHits->GetEntriesFast(); if (fHitIndex < 0 || fHitIndex >= nhits) return 0; diff --git a/MUON/AliMUONRawCluster.cxx b/MUON/AliMUONRawCluster.cxx index a1cba235bc7..293afc4d70b 100644 --- a/MUON/AliMUONRawCluster.cxx +++ b/MUON/AliMUONRawCluster.cxx @@ -13,18 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2001/02/05 14:49:29 hristov -Compare() declared const (R.Brun) - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 22:04:50 morsch -Was before in DataStructures.cxx - -*/ +/* $Id$ */ #include "AliMUONRawCluster.h" #include diff --git a/MUON/AliMUONRecoDisplay.cxx b/MUON/AliMUONRecoDisplay.cxx index 610372888b4..14fe22fc7ed 100644 --- a/MUON/AliMUONRecoDisplay.cxx +++ b/MUON/AliMUONRecoDisplay.cxx @@ -13,44 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.6 2001/01/26 21:50:43 morsch -Use access functions to AliMUONHit member data. - -Revision 1.5 2001/01/26 20:00:53 hristov -Major upgrade of AliRoot code - -Revision 1.4 2000/12/21 22:14:38 morsch -Clean-up of coding rule violations. - -Revision 1.3 2000/12/21 17:51:54 morsch -RN3 violations corrected - -Revision 1.2 2000/11/23 10:09:39 gosset -Bug correction in AliMUONRecoDisplay. -Copyright, $Log$ -Copyright, Revision 1.7 2001/05/16 14:57:17 alibrary -Copyright, New files for folders and Stack -Copyright, -Copyright, Revision 1.6 2001/01/26 21:50:43 morsch -Copyright, Use access functions to AliMUONHit member data. -Copyright, -Copyright, Revision 1.5 2001/01/26 20:00:53 hristov -Copyright, Major upgrade of AliRoot code -Copyright, -Copyright, Revision 1.4 2000/12/21 22:14:38 morsch -Copyright, Clean-up of coding rule violations. -Copyright, -Copyright, Revision 1.3 2000/12/21 17:51:54 morsch -Copyright, RN3 violations corrected -Copyright,, $Id$, comments at the right place for automatic documentation, -in AliMUONRecoEvent and AliMUONRecoDisplay - -*/ +/* $Id$ */ //Authors: Mihaela Gheata, Andrei Gheata 09/10/00 ////////////////////////////////////////////////////////////////////// @@ -82,16 +45,22 @@ in AliMUONRecoEvent and AliMUONRecoDisplay ////////////////////////////////////////////////////////////////////// #include -#include -#include -#include "AliMUONRecoEvent.h" -#include "AliMUONRecoDisplay.h" -#include "AliHeader.h" + #include -#include +#include +#include +#include #include -#include #include +#include + +#include +#include +#include +#include + +#include "AliMUONRecoEvent.h" +#include "AliMUONRecoDisplay.h" ClassImp(AliMUONRecoDisplay) @@ -204,7 +173,7 @@ void AliMUONRecoDisplay::MapEvent(Int_t nevent) gApplication->Terminate(0); } // get the number of generated tracks - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); + Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries(); // Fill the fEvGen object AliMUONRecoTrack *gtrack = 0; AliMUONHit *hit = 0; @@ -441,7 +410,29 @@ void AliMUONRecoDisplay::ShowNextEvent(Int_t delta) if (newEvent<0 || newEvent>(gAlice->TreeE()->GetEntries() - 1)) return; Int_t nparticles = gAlice->GetEvent(newEvent); cout << "Event : " << newEvent << " with " << nparticles << " particles\n"; - if (!gAlice->TreeH()) return; + +/******************************************************************/ + AliConfig* config = AliConfig::Instance(); + TFolder* topfold = (TFolder*)config->GetTopFolder(); + if (topfold == 0x0) + { + Error("Exec","Can not get Alice top folder"); + return; + } + TString fmdfoldname(config->GetDataFolderName()+"/"+"MUON"); + TFolder* fmdfold = (TFolder*)topfold->FindObject(fmdfoldname); + if (fmdfold == 0x0) + { + Error("Exec","Can not get MUON folder"); + return; + } + TTree* treeH = dynamic_cast(fmdfold->FindObject("TreeH")); + if (treeH == 0x0) + { + Error("Exec","Can not get TreeH"); + return; + } +/******************************************************************/ MapEvent(newEvent); fHighlited = -1; } diff --git a/MUON/AliMUONRecoEvent.cxx b/MUON/AliMUONRecoEvent.cxx index cc79167957e..177ab32e4dd 100644 --- a/MUON/AliMUONRecoEvent.cxx +++ b/MUON/AliMUONRecoEvent.cxx @@ -13,46 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ - -Revision 1.7 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.6 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.5 2001/05/11 07:59:03 hristov -Index corrected - -Revision 1.4 2001/01/26 20:00:53 hristov -Major upgrade of AliRoot code - -Revision 1.3 2000/12/21 17:51:54 morsch -RN3 violations corrected - -Revision 1.2 2000/11/23 10:09:38 gosset -Bug correction in AliMUONRecoDisplay. -Copyright, $Log$ -Copyright, Revision 1.7 2002/10/23 07:24:56 alibrary -Copyright, Introducing Riostream.h -Copyright, -Copyright, Revision 1.6 2001/05/16 14:57:17 alibrary -Copyright, New files for folders and Stack -Copyright, -Copyright, Revision 1.5 2001/05/11 07:59:03 hristov -Copyright, Index corrected -Copyright, -Copyright, Revision 1.4 2001/01/26 20:00:53 hristov -Copyright, Major upgrade of AliRoot code -Copyright, -Copyright, Revision 1.3 2000/12/21 17:51:54 morsch -Copyright, RN3 violations corrected -Copyright,, $Id$, comments at the right place for automatic documentation, -in AliMUONRecoEvent and AliMUONRecoDisplay - - -*/ +/* $Id$ */ //Authors: Mihaela Gheata, Andrei Gheata 09/10/00 //////////////////////////////////////////////////////////////////// diff --git a/MUON/AliMUONReconstHit.cxx b/MUON/AliMUONReconstHit.cxx index 63d1a398550..ca567a52f24 100644 --- a/MUON/AliMUONReconstHit.cxx +++ b/MUON/AliMUONReconstHit.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log $ -*/ +/* $Id$ */ #include "AliMUONReconstHit.h" diff --git a/MUON/AliMUONResponse.cxx b/MUON/AliMUONResponse.cxx index 44911daf7eb..d17a80695ec 100644 --- a/MUON/AliMUONResponse.cxx +++ b/MUON/AliMUONResponse.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1.2.1 2000/06/09 21:31:45 morsch -AliMUONResponse code from AliMUONSegRes.cxx - -*/ +/* $Id$ */ #include "AliMUONResponse.h" diff --git a/MUON/AliMUONResponseTrigger.cxx b/MUON/AliMUONResponseTrigger.cxx index b115bd50275..9e29856a376 100644 --- a/MUON/AliMUONResponseTrigger.cxx +++ b/MUON/AliMUONResponseTrigger.cxx @@ -13,25 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.4 2000/11/20 21:44:17 pcrochet -some modifications to account for the new class AliMUONResponseTriggerV1 - -Revision 1.3 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:48:28 morsch -Code from AliMUONSegResTrigger.cxx - -*/ +/* $Id$ */ #include "AliMUONResponseTrigger.h" #include "AliSegmentation.h" diff --git a/MUON/AliMUONResponseV0.cxx b/MUON/AliMUONResponseV0.cxx index d01cc1b23e0..25b16d06ed1 100644 --- a/MUON/AliMUONResponseV0.cxx +++ b/MUON/AliMUONResponseV0.cxx @@ -13,34 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2000/12/04 17:48:23 gosset -Modifications for stations 1 et 2 mainly: -* station 1 with 4 mm gas gap and smaller cathode segmentation... -* stations 1 and 2 with "grey" frame crosses -* mean noise at 1.5 ADC channel -* Ar-CO2 gas (80%+20%) - -Revision 1.5 2000/11/21 13:47:55 gosset -All Mathieson parameters (Sqrt(K3), K2 and K4) set in one function, -SetSqrtKx3AndDeriveKx2Kx4 or SetSqrtKx3AndDeriveKx2Kx4, -for each cathode plane - -Revision 1.4 2000/10/25 10:41:52 morsch -IntPH(..): Protec Log against random numbers equal to 0. - -Revision 1.3 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:33:35 morsch -AliMUONResponse code from AliMUONSegResV0.cxx - -*/ +/* $Id$ */ #include "AliMUONResponseV0.h" #include "AliSegmentation.h" diff --git a/MUON/AliMUONSegment.cxx b/MUON/AliMUONSegment.cxx index f932bbb6e59..0d250be0631 100644 --- a/MUON/AliMUONSegment.cxx +++ b/MUON/AliMUONSegment.cxx @@ -13,65 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8.10.1 2002/10/11 06:56:48 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.9 2002/09/20 13:32:26 cussonno -Minor bugs in the definition of the bending impact parameter corrected (thanks to A. Zinchenko) - -Revision 1.8 2001/04/25 14:50:42 gosset -Corrections to violations of coding conventions - -Revision 1.7 2001/02/08 10:34:41 gosset -Add a "real" default constructor. - -Revision 1.6 2001/02/05 14:49:29 hristov -Compare() declared const (R.Brun) - -Revision 1.5 2001/01/08 11:01:02 gosset -Modifications used for addendum to Dimuon TDR (JP Cussonneau): -*. MaxBendingMomentum to make both a segment and a track (default 500) -*. MaxChi2 per degree of freedom to make a track (default 100) -*. MinBendingMomentum used also to make a track - and not only a segment (default 3) -*. wider roads for track search in stations 1 to 3 -*. extrapolation to actual Z instead of Z(chamber) in FollowTracks -*. in track fit: - - limits on parameters X and Y (+/-500) - - covariance matrices in double precision - - normalization of covariance matrices before inversion - - suppression of Minuit printouts -*. correction against memory leak (delete extrapHit) in FollowTracks -*. RMax to 10 degrees with Z(chamber) instead of fixed values; - RMin and Rmax cuts suppressed in NewHitForRecFromGEANT, - because useless with realistic geometry - -Revision 1.4 2000/06/30 10:15:48 gosset -Changes to EventReconstructor...: -precision fit with multiple Coulomb scattering; -extrapolation to vertex with Branson correction in absorber (JPC) - -Revision 1.3 2000/06/25 13:06:39 hristov -Inline functions moved from *.cxx to *.h files instead of forward declarations - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.4 2000/06/12 10:10:21 morsch -Dummy copy constructor and assignment operator added - -Revision 1.1.2.3 2000/06/09 21:01:16 morsch -Make includes consistent with new file structure. - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ /////////////////////////////////////////////////////////// // diff --git a/MUON/AliMUONSegmentationSlat.cxx b/MUON/AliMUONSegmentationSlat.cxx index 78570e3a009..7d03209f096 100644 --- a/MUON/AliMUONSegmentationSlat.cxx +++ b/MUON/AliMUONSegmentationSlat.cxx @@ -13,65 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2002/02/20 09:14:37 morsch -Protection against numerical inprecission for hits on slat boundaries. - -Revision 1.17 2001/12/01 20:00:45 hristov -New protections added - -Revision 1.16 2001/10/30 08:25:14 jchudoba -Small correction to prevent crash when hit is at the edge of a slat - -Revision 1.15 2001/09/07 08:38:30 hristov -Pointers initialised to 0 in the default constructors - -Revision 1.14 2001/08/30 09:52:12 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. - -Revision 1.13 2001/07/20 10:03:14 morsch -Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba) - -Revision 1.12 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.11 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.10 2001/01/23 18:58:19 hristov -Initialisation of some pointers - -Revision 1.9 2001/01/17 20:53:40 hristov -Destructors corrected to avoid memory leaks - -Revision 1.8 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.7 2000/11/08 13:01:40 morsch -Chamber half-planes of stations 3-5 at different z-positions. - -Revision 1.6 2000/11/06 09:20:43 morsch -AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the -Draw() method. This avoids code and parameter replication. - -Revision 1.5 2000/10/23 13:37:40 morsch -Correct z-position of slat planes. - -Revision 1.4 2000/10/22 16:55:43 morsch -Use only x-symmetry in global to local transformations and delegation. - -Revision 1.3 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.2 2000/10/09 14:06:18 morsch -Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.) - -Revision 1.1 2000/10/06 09:00:47 morsch -Segmentation class for chambers built out of slats. - -*/ +/* $Id$ */ #include "AliMUONSegmentationSlat.h" #include "AliMUONSegmentationSlatModule.h" diff --git a/MUON/AliMUONSegmentationSlat.h b/MUON/AliMUONSegmentationSlat.h index 049964475c4..de6172f0bfc 100644 --- a/MUON/AliMUONSegmentationSlat.h +++ b/MUON/AliMUONSegmentationSlat.h @@ -4,7 +4,6 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - ///////////////////////////////////////////////////// // Segmentation classes for slat modules // // to be used with AluMUONSegmentationSlat // diff --git a/MUON/AliMUONSegmentationSlatModule.cxx b/MUON/AliMUONSegmentationSlatModule.cxx index 8ea48b4c6fe..142c63f11cb 100644 --- a/MUON/AliMUONSegmentationSlatModule.cxx +++ b/MUON/AliMUONSegmentationSlatModule.cxx @@ -13,44 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2001/11/28 16:34:01 morsch -In DC, fNDiv, fDpxD set to 0. - -Revision 1.10 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.9 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.8 2001/01/17 20:53:40 hristov -Destructors corrected to avoid memory leaks - -Revision 1.7 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.6 2000/11/06 09:20:43 morsch -AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the -Draw() method. This avoids code and parameter replication. - -Revision 1.5 2000/10/26 19:32:04 morsch -Problem with iteration over y-pads for 2nd cathode corrected. - -Revision 1.4 2000/10/25 19:56:55 morsch -Handle correctly slats with less than 3 segmentation zones. - -Revision 1.3 2000/10/22 16:56:32 morsch -- Store chamber number as slat id. - -Revision 1.2 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.1 2000/10/06 08:59:03 morsch -Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch) - -*/ +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation classes for slat modules // diff --git a/MUON/AliMUONSegmentationSlatModuleN.cxx b/MUON/AliMUONSegmentationSlatModuleN.cxx index 3f78241f636..aed21fdca79 100644 --- a/MUON/AliMUONSegmentationSlatModuleN.cxx +++ b/MUON/AliMUONSegmentationSlatModuleN.cxx @@ -13,34 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.7 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.6 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.5 2000/10/26 19:32:04 morsch -Problem with iteration over y-pads for 2nd cathode corrected. - -Revision 1.4 2000/10/25 19:56:55 morsch -Handle correctly slats with less than 3 segmentation zones. - -Revision 1.3 2000/10/22 16:56:33 morsch -- Store chamber number as slat id. - -Revision 1.2 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.1 2000/10/06 08:59:03 morsch -Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch) - -*/ +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation classes for slat modules // diff --git a/MUON/AliMUONSegmentationSlatN.cxx b/MUON/AliMUONSegmentationSlatN.cxx index d7add715f1a..32056305a5f 100644 --- a/MUON/AliMUONSegmentationSlatN.cxx +++ b/MUON/AliMUONSegmentationSlatN.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.3 2000/10/22 16:55:43 morsch -Use only x-symmetry in global to local transformations and delegation. - -Revision 1.2 2000/10/09 14:06:18 morsch -Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.) - -Revision 1.1 2000/10/06 09:00:47 morsch -Segmentation class for chambers built out of slats. - -*/ +/* $Id$ */ #include "AliMUONSegmentationSlatN.h" #include "AliMUONSegmentationSlatModuleN.h" diff --git a/MUON/AliMUONSegmentationTrigger.cxx b/MUON/AliMUONSegmentationTrigger.cxx index c58edf2ee68..91183666e17 100644 --- a/MUON/AliMUONSegmentationTrigger.cxx +++ b/MUON/AliMUONSegmentationTrigger.cxx @@ -13,55 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.7 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.6 2000/11/12 17:17:03 pcrochet -BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers) - -Revision 1.5 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.4 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.3 2000/06/26 10:00:14 pcrochet -global variables removed, problem with HP compiler solved (PH) - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:47:24 morsch -Code from AliMUONSegResTrigger.cxx - -*/ - -/* -old Log: -AliMUONSegResTrigger.cxx,v $ -Revision 1.1.2.3 2000/04/26 12:32:39 morsch -Mods by P. Crochet: -- adapted to the new Trigger chamber geometry -- method SetZScale removed - -Revision 1.1.2.2 2000/02/21 16:13:33 morsch -Full cluster simulation activated by uncommenting corresponding lines in IntXY() - -Revision 1.1.2.1 2000/02/17 14:32:40 morsch -Draft version from P. Crochet - -*/ +/* $Id$ */ #include "AliMUONSegmentationTrigger.h" #include "AliMUONTriggerConstants.h" diff --git a/MUON/AliMUONSegmentationTriggerX.cxx b/MUON/AliMUONSegmentationTriggerX.cxx index 027cddc49cc..390d7c9ff22 100644 --- a/MUON/AliMUONSegmentationTriggerX.cxx +++ b/MUON/AliMUONSegmentationTriggerX.cxx @@ -13,79 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.14 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.13 2002/10/14 14:57:29 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.11.10.1 2002/10/11 06:56:48 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.12 2002/09/23 13:29:15 hristov -nameNode enlarged (HP) - -Revision 1.11 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.10 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.9 2000/11/20 21:44:17 pcrochet -some modifications to account for the new class AliMUONResponseTriggerV1 - -Revision 1.8 2000/11/12 17:17:03 pcrochet -BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers) - -Revision 1.7 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.6 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.5 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.4 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.3 2000/06/26 10:01:26 pcrochet -global variables removed - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:51:03 morsch -Code from AliMUONSegResTrigger.cxx - -*/ - - - -/* -Old Log: -Revision 1.1.2.4 2000/04/26 12:33:25 morsch -Minor changes in some methods (CP) - -Revision 1.1.2.3 2000/03/20 18:14:16 morsch -Missing sector added. - -Revision 1.1.2.2 2000/02/20 07:50:49 morsch -Bugs in Dpx, Dpy and ISector methods corrected (P.C.) - -Revision 1.1.2.1 2000/02/17 14:33:49 morsch -Draft version from P. Crochet - -*/ +/* $Id$ */ #include #include diff --git a/MUON/AliMUONSegmentationTriggerY.cxx b/MUON/AliMUONSegmentationTriggerY.cxx index 4ea7a0d8c5f..a0907d36202 100644 --- a/MUON/AliMUONSegmentationTriggerY.cxx +++ b/MUON/AliMUONSegmentationTriggerY.cxx @@ -13,63 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.9 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.8 2000/11/20 21:44:17 pcrochet -some modifications to account for the new class AliMUONResponseTriggerV1 - -Revision 1.7 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.6 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.5 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.4 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.3 2000/06/26 10:01:26 pcrochet -global variables removed - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:51:58 morsch -Code from AliMUONSegResTriggerY.cxx - -*/ - - -/* -Old Log: -Revision 1.1.2.4 2000/05/05 10:17:04 morsch -Y strip numerotation changed (CP) - -Revision 1.1.2.3 2000/04/26 12:33:40 morsch -Minor changes in some methods (CP) - -Revision 1.1.2.2 2000/02/20 07:49:50 morsch -Bugs in Dpx, Dpy and ISector methods corrected (P.C.) - -Revision 1.1.2.1 2000/02/17 14:34:57 morsch -Draft version from P. Crochet - -*/ +/* $Id$ */ #include "AliMUONSegmentationTriggerY.h" #include "AliMUONTriggerConstants.h" diff --git a/MUON/AliMUONSegmentationV0.cxx b/MUON/AliMUONSegmentationV0.cxx index 2b5d7c5c4c9..abc7866f029 100644 --- a/MUON/AliMUONSegmentationV0.cxx +++ b/MUON/AliMUONSegmentationV0.cxx @@ -12,48 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2000/11/06 09:20:43 morsch -AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the -Draw() method. This avoids code and parameter replication. -Revision 1.8 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.7 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.6 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.5 2000/07/13 16:19:44 fca -Mainly coding conventions + some small bug fixes - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.2 2000/06/12 07:57:23 morsch -include TMath.h - -Revision 1.1.2.1 2000/06/09 21:30:33 morsch -AliMUONSegmentationV0 code from AliMUONSegResV0.cxx - -*/ +/* $Id$ */ #include "AliMUONSegmentationV0.h" #include "TArc.h" diff --git a/MUON/AliMUONSegmentationV01.cxx b/MUON/AliMUONSegmentationV01.cxx index e8145e291fd..3d7e6b3820c 100644 --- a/MUON/AliMUONSegmentationV01.cxx +++ b/MUON/AliMUONSegmentationV01.cxx @@ -13,83 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2001/08/30 09:52:12 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. - -Revision 1.20 2001/07/20 10:03:14 morsch -Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba) - -Revision 1.19 2001/05/16 14:57:17 alibrary -New files for folders and Stack - -Revision 1.18 2001/04/11 12:33:56 morsch -Bug in GetPadC in case of staggered planes corrected. (Thanks to J.P. Cussonneau) - -Revision 1.17 2001/01/30 12:17:04 morsch -Remove obolete print-statement. - -Revision 1.16 2001/01/30 09:23:14 hristov -Streamers removed (R.Brun) - -Revision 1.15 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.14 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.13 2000/12/07 10:41:51 hristov -fCorr replaced by fCorrA - -Revision 1.12 2000/12/06 11:55:41 morsch -Introduce SetOffsetY(Float_t off) method as simplified simulation of pad staggering. -fOffset is the staggering offset in y. - -Revision 1.11 2000/11/06 09:20:43 morsch -AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the -Draw() method. This avoids code and parameter replication. - -Revision 1.10 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.9 2000/10/18 08:41:32 morsch -Make NextPad() and MorePads() to iterate until the end. - -Revision 1.8 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.7 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.5 2000/07/13 16:19:44 fca -Mainly coding conventions + some small bug fixes - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:37:30 morsch -AliMUONSegmentationV01 code from AliMUONSegResV01.cxx - -*/ - +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation and Response classes version 01 // diff --git a/MUON/AliMUONSegmentationV02.cxx b/MUON/AliMUONSegmentationV02.cxx index fa5a048c171..4edc3bcf5d6 100644 --- a/MUON/AliMUONSegmentationV02.cxx +++ b/MUON/AliMUONSegmentationV02.cxx @@ -13,39 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2001/01/26 21:25:48 morsch -Empty default constructors and. - -Revision 1.7 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.6 2000/10/18 08:41:32 morsch -Make NextPad() and MorePads() to iterate until the end. - -Revision 1.5 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.4 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.3 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:37:56 morsch -AliMUONSegmentationV02 code from AliMUONSegResV02.cxx - -*/ - - +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation and Response classes version 02 // diff --git a/MUON/AliMUONSegmentationV04.cxx b/MUON/AliMUONSegmentationV04.cxx index 647240b8c56..1a08ccb5560 100644 --- a/MUON/AliMUONSegmentationV04.cxx +++ b/MUON/AliMUONSegmentationV04.cxx @@ -13,34 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.6 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.5 2000/10/04 18:50:05 morsch -In Init(): (*fDpxD)[fNsec-1]=fDpx; - -Revision 1.4 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.3 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:38:15 morsch -AliMUONSegmentationV04 code from AliMUONSegResV04.cxx - -*/ +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation and Response classes version 04 // diff --git a/MUON/AliMUONSegmentationV05.cxx b/MUON/AliMUONSegmentationV05.cxx index 44fb90a7677..e29df14c3d7 100644 --- a/MUON/AliMUONSegmentationV05.cxx +++ b/MUON/AliMUONSegmentationV05.cxx @@ -13,31 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2000/12/21 22:12:41 morsch -Clean-up of coding rule violations, - -Revision 1.5 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.4 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.3 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/06/09 21:38:46 morsch -AliMUONSegmentationV05 code from AliMUONSegResV05.cxx - -*/ +/* $Id$ */ ///////////////////////////////////////////////////// // Segmentation and Response classes version 05 // diff --git a/MUON/AliMUONSegmentationV1.cxx b/MUON/AliMUONSegmentationV1.cxx index 60ea0ae49be..872c63e56dd 100644 --- a/MUON/AliMUONSegmentationV1.cxx +++ b/MUON/AliMUONSegmentationV1.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2000/10/18 11:42:06 morsch -- AliMUONRawCluster contains z-position. -- Some clean-up of useless print statements during initialisations. - -Revision 1.6 2000/10/03 21:48:07 morsch -Adopt to const declaration of some of the methods in AliSegmentation. - -Revision 1.5 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/29 12:34:09 morsch -AliMUONSegmentation class has been made independent of AliMUONChamber. This makes -it usable with any other geometry class. The link to the object to which it belongs is -established via an index. This assumes that there exists a global geometry manager -from which the pointer to the parent object can be obtained (in our case gAlice). - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.2 2000/06/12 07:57:43 morsch -include TMath.cxx - -Revision 1.1.2.1 2000/06/09 21:41:29 morsch -AliMUONSegmentationV1 code from AliMUONSegResV1.cxx - -*/ - +/* $Id$ */ ///////////////////////////////////////////////////////// // Manager and hits classes for set:MUON version LYON // diff --git a/MUON/AliMUONSt1Decoder.cxx b/MUON/AliMUONSt1Decoder.cxx index 5334752e575..f3bd950e1f2 100644 --- a/MUON/AliMUONSt1Decoder.cxx +++ b/MUON/AliMUONSt1Decoder.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/01/28 13:21:06 morsch -Improved response simulation for station 1. -(M. Mac Cormick, I. Hrivnacova, D. Guez) - -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1ElectronicElement.cxx b/MUON/AliMUONSt1ElectronicElement.cxx index 7e63ca5f5b6..f09382b2fde 100644 --- a/MUON/AliMUONSt1ElectronicElement.cxx +++ b/MUON/AliMUONSt1ElectronicElement.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/01/28 13:21:06 morsch -Improved response simulation for station 1. -(M. Mac Cormick, I. Hrivnacova, D. Guez) - -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1IniReader.cxx b/MUON/AliMUONSt1IniReader.cxx index 1a22e158c51..4d95eccdd0b 100644 --- a/MUON/AliMUONSt1IniReader.cxx +++ b/MUON/AliMUONSt1IniReader.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/01/28 13:21:06 morsch -Improved response simulation for station 1. -(M. Mac Cormick, I. Hrivnacova, D. Guez) - -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1ResponseParameter.cxx b/MUON/AliMUONSt1ResponseParameter.cxx index eccedb8a2b2..aad145bea5a 100644 --- a/MUON/AliMUONSt1ResponseParameter.cxx +++ b/MUON/AliMUONSt1ResponseParameter.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1ResponseRule.cxx b/MUON/AliMUONSt1ResponseRule.cxx index f08b4bd451b..099b25ac120 100644 --- a/MUON/AliMUONSt1ResponseRule.cxx +++ b/MUON/AliMUONSt1ResponseRule.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/01/28 13:21:06 morsch -Improved response simulation for station 1. -(M. Mac Cormick, I. Hrivnacova, D. Guez) - -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1Segmentation.cxx b/MUON/AliMUONSt1Segmentation.cxx index 5e38c8db1b9..7c111ff645d 100644 --- a/MUON/AliMUONSt1Segmentation.cxx +++ b/MUON/AliMUONSt1Segmentation.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/01/28 13:21:06 morsch -Improved response simulation for station 1. -(M. Mac Cormick, I. Hrivnacova, D. Guez) - -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONSt1SpecialMotif.cxx b/MUON/AliMUONSt1SpecialMotif.cxx index e6e34933231..5a95949d238 100644 --- a/MUON/AliMUONSt1SpecialMotif.cxx +++ b/MUON/AliMUONSt1SpecialMotif.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONTrack.cxx b/MUON/AliMUONTrack.cxx index 700e2aa2242..fba6099aea7 100644 --- a/MUON/AliMUONTrack.cxx +++ b/MUON/AliMUONTrack.cxx @@ -13,88 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.14 2001/08/30 09:52:12 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. - -Revision 1.13 2001/05/03 08:11:31 hristov -stdlib.h included to define exit() - -Revision 1.12 2001/04/25 14:50:42 gosset -Corrections to violations of coding conventions - -Revision 1.11 2001/04/23 12:33:17 hristov -Arrays with variable size created by new and deleted at the end - -Revision 1.10 2001/04/09 12:25:09 gosset -Inversion of covariance matrices with local copy of TMinuit::mnvert, -for symmetric positive definite matrices, instead of TMatrixD::Invert - -Revision 1.9 2001/01/17 20:59:24 hristov -chPrev initialised - -Revision 1.8 2001/01/08 11:01:02 gosset -Modifications used for addendum to Dimuon TDR (JP Cussonneau): -*. MaxBendingMomentum to make both a segment and a track (default 500) -*. MaxChi2 per degree of freedom to make a track (default 100) -*. MinBendingMomentum used also to make a track - and not only a segment (default 3) -*. wider roads for track search in stations 1 to 3 -*. extrapolation to actual Z instead of Z(chamber) in FollowTracks -*. in track fit: - - limits on parameters X and Y (+/-500) - - covariance matrices in double precision - - normalization of covariance matrices before inversion - - suppression of Minuit printouts -*. correction against memory leak (delete extrapHit) in FollowTracks -*. RMax to 10 degrees with Z(chamber) instead of fixed values; - RMin and Rmax cuts suppressed in NewHitForRecFromGEANT, - because useless with realistic geometry - -Revision 1.7 2000/09/19 15:50:46 gosset -TrackChi2MCS function: covariance matrix better calculated, -taking into account missing planes... - -Revision 1.6 2000/07/20 12:45:27 gosset -New "EventReconstructor..." structure, - hopefully more adapted to tree/streamer. -"AliMUONEventReconstructor::RemoveDoubleTracks" - to keep only one track among similar ones. - -Revision 1.5 2000/07/18 16:04:06 gosset -AliMUONEventReconstructor package: -* a few minor modifications and more comments -* a few corrections - * right sign for Z of raw clusters - * right loop over chambers inside station - * symmetrized covariance matrix for measurements (TrackChi2MCS) - * right sign of charge in extrapolation (ExtrapToZ) - * right zEndAbsorber for Branson correction below 3 degrees -* use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit -* no parameter for AliMUONTrack::Fit() but more fit parameters in Track object - -Revision 1.4 2000/06/30 10:15:48 gosset -Changes to EventReconstructor...: -precision fit with multiple Coulomb scattering; -extrapolation to vertex with Branson correction in absorber (JPC) - -Revision 1.3 2000/06/25 13:23:28 hristov -stdlib.h needed for non-Linux compilation - -Revision 1.2 2000/06/15 07:58:48 morsch -Code from MUON-dev joined - -Revision 1.1.2.3 2000/06/12 10:11:34 morsch -Dummy copy constructor and assignment operator added - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ /////////////////////////////////////////////////// // diff --git a/MUON/AliMUONTrackHit.cxx b/MUON/AliMUONTrackHit.cxx index 8f256ea3157..bd5d16c0e96 100644 --- a/MUON/AliMUONTrackHit.cxx +++ b/MUON/AliMUONTrackHit.cxx @@ -13,45 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2001/02/05 14:49:29 hristov -Compare() declared const (R.Brun) - -Revision 1.5 2000/07/20 12:45:27 gosset -New "EventReconstructor..." structure, - hopefully more adapted to tree/streamer. -"AliMUONEventReconstructor::RemoveDoubleTracks" - to keep only one track among similar ones. - -Revision 1.4 2000/07/18 16:04:06 gosset -AliMUONEventReconstructor package: -* a few minor modifications and more comments -* a few corrections - * right sign for Z of raw clusters - * right loop over chambers inside station - * symmetrized covariance matrix for measurements (TrackChi2MCS) - * right sign of charge in extrapolation (ExtrapToZ) - * right zEndAbsorber for Branson correction below 3 degrees -* use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit -* no parameter for AliMUONTrack::Fit() but more fit parameters in Track object - -Revision 1.3 2000/06/25 13:06:39 hristov -Inline functions moved from *.cxx to *.h files instead of forward declarations - -Revision 1.2 2000/06/15 07:58:49 morsch -Code from MUON-dev joined - -Revision 1.1.2.3 2000/06/12 10:11:45 morsch -Dummy copy constructor and assignment operator added - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ /////////////////////////////////////////////////////// // diff --git a/MUON/AliMUONTrackParam.cxx b/MUON/AliMUONTrackParam.cxx index 7516193f0f0..34e1a157f44 100644 --- a/MUON/AliMUONTrackParam.cxx +++ b/MUON/AliMUONTrackParam.cxx @@ -13,76 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.13 2002/10/14 14:57:29 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.11.6.1 2002/10/11 06:56:48 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.12 2002/09/19 10:14:00 cussonno -Modified absorber correction. Added function FieldCorrection() to account -for the effect of magnetic field in absorber. - -Revision 1.11 2002/03/08 17:25:36 cussonno -Update absorber energy loss and Branson corrections : simplified functions -BransonCorrection and TotalMomentumEnergyLoss. - -Revision 1.10 2001/04/25 14:50:42 gosset -Corrections to violations of coding conventions - -Revision 1.9 2000/10/16 15:30:40 gosset -TotalMomentumEnergyLoss: -correction for change in the absorber composition (JP Cussonneau) - -Revision 1.8 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.7 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.6 2000/09/19 09:49:50 gosset -AliMUONEventReconstructor package -* track extrapolation independent from reco_muon.F, use of AliMagF... -* possibility to use new magnetic field (automatic from generated root file) - -Revision 1.5 2000/07/18 16:04:06 gosset -AliMUONEventReconstructor package: -* a few minor modifications and more comments -* a few corrections - * right sign for Z of raw clusters - * right loop over chambers inside station - * symmetrized covariance matrix for measurements (TrackChi2MCS) - * right sign of charge in extrapolation (ExtrapToZ) - * right zEndAbsorber for Branson correction below 3 degrees -* use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit -* no parameter for AliMUONTrack::Fit() but more fit parameters in Track object - -Revision 1.4 2000/07/03 07:53:31 morsch -Double declaration problem on HP solved. - -Revision 1.3 2000/06/30 10:15:48 gosset -Changes to EventReconstructor...: -precision fit with multiple Coulomb scattering; -extrapolation to vertex with Branson correction in absorber (JPC) - -Revision 1.2 2000/06/15 07:58:49 morsch -Code from MUON-dev joined - -Revision 1.1.2.3 2000/06/09 21:03:09 morsch -Make includes consistent with new file structure. - -Revision 1.1.2.2 2000/06/09 12:58:05 gosset -Removed comment beginnings in Log sections of .cxx files -Suppressed most violations of coding rules - -Revision 1.1.2.1 2000/06/07 14:44:53 gosset -Addition of files for track reconstruction in C++ -*/ +/* $Id$ */ /////////////////////////////////////////////////// // diff --git a/MUON/AliMUONTransientDigit.cxx b/MUON/AliMUONTransientDigit.cxx index fa37a69eb92..7a1a47a3bd1 100644 --- a/MUON/AliMUONTransientDigit.cxx +++ b/MUON/AliMUONTransientDigit.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log $ -*/ +/* $Id$ */ #include "AliMUONTransientDigit.h" #include diff --git a/MUON/AliMUONTriggerCircuit.cxx b/MUON/AliMUONTriggerCircuit.cxx index a565c6c7add..479981b0f2e 100644 --- a/MUON/AliMUONTriggerCircuit.cxx +++ b/MUON/AliMUONTriggerCircuit.cxx @@ -12,38 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.8 2001/03/20 13:32:37 egangler -includes cleanup - -Revision 1.7 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.6 2000/07/13 16:19:44 fca -Mainly coding conventions + some small bug fixes - -Revision 1.5 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.4 2000/06/28 15:16:35 morsch -(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) -to allow development of slat-muon chamber simulation and reconstruction code in the MUON -framework. The changes should have no side effects (mostly dummy arguments). -(2) Hit disintegration uses 3-dim hit coordinates to allow simulation -of chambers with overlapping modules (MakePadHits, Disintegration). - -Revision 1.3 2000/06/26 10:04:49 pcrochet -problem with HP compiler solved (PH), static variables removed : now defined in AliMUONTriggerConstants - -*/ + +/* $Id$ */ #include "AliRun.h" #include "AliMUON.h" diff --git a/MUON/AliMUONTriggerConstants.cxx b/MUON/AliMUONTriggerConstants.cxx index 80a44754ee2..99190fabab4 100644 --- a/MUON/AliMUONTriggerConstants.cxx +++ b/MUON/AliMUONTriggerConstants.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2000/06/26 09:57:57 pcrochet -New class which contains quantities previously defined as global variables - -*/ +/* $Id$ */ #include "AliMUONTriggerConstants.h" diff --git a/MUON/AliMUONTriggerDecision.cxx b/MUON/AliMUONTriggerDecision.cxx index 78383fc7d68..b02773d36e7 100644 --- a/MUON/AliMUONTriggerDecision.cxx +++ b/MUON/AliMUONTriggerDecision.cxx @@ -12,62 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2002/12/20 09:05:31 pcrochet -cout replaced by printf - -Revision 1.10 2002/10/23 07:24:56 alibrary -Introducing Riostream.h - -Revision 1.9 2001/03/23 17:31:32 pcrochet -correct access to digits in SetBit() - -Revision 1.8 2001/03/20 16:13:01 pcrochet -bug fixed in the rejection of soft background (thanks to FM) - -Revision 1.7 2001/03/20 13:32:37 egangler -includes cleanup - -Revision 1.6 2001/01/26 21:57:09 morsch -Use access functions to AliMUONDigit member data. - -Revision 1.5 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.4 2000/07/03 11:54:57 morsch -AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER -The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. - -Revision 1.3 2000/06/25 17:02:19 pcrochet -scope problem on HP, i declared once, pow replaced by TMath::Power (PH) - -Revision 1.2 2000/06/15 07:58:49 morsch -Code from MUON-dev joined - -Revision 1.1.2.8 2000/06/14 14:54:34 morsch -Complete redesign, make use of TriggerCircuit and TriggerLut (PC) - -Revision 1.1.2.5 2000/04/26 19:59:57 morsch -Constructor added. -Revision 1.1.2.4 2000/04/26 12:31:30 morsch -Modifications by P. Crochet: -- adapted to the new Trigger chamber geometry -- condition on soft background added -- contructor added in AliMUONTriggerDecision.h -- single-undefined taken into account in the output of GlobalTrigger() -- some bugs fixed - -Revision 1.1.2.3 2000/03/21 09:29:58 morsch -Put back comments - -Revision 1.1.2.2 2000/03/21 09:24:34 morsch -Author and responsible for the code: Philippe Crochet -*/ +/* $Id$ */ #include "AliMUONTriggerCircuit.h" #include "AliMUONTriggerDecision.h" @@ -75,6 +21,8 @@ Author and responsible for the code: Philippe Crochet #include "AliMUONHitMapA1.h" #include "AliRun.h" #include "AliMUON.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliSegmentation.h" #include "AliMUONResponse.h" #include "AliMUONChamber.h" @@ -243,32 +191,24 @@ void AliMUONTriggerDecision::SetBit(){ // 3) remove soft background // 4) set the bit patterns - AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); + + AliMUON *pMUON = (AliMUON*)gAlice->GetDetector("MUON"); AliMUONTriggerCircuit* triggerCircuit; + AliRunLoader * rl = AliRunLoader::GetRunLoader(); + AliLoader * gime = rl->GetLoader("MUONLoader"); for (Int_t chamber=11; chamber<15; chamber++){ for (Int_t cathode=1; cathode<3; cathode++){ - AliMUONChamber* iChamber; + AliMUONChamber* iChamber = &(pMUON->Chamber(chamber-1)); AliSegmentation* segmentation; - - TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1); - if (muonDigits == 0) return; - -//pc 27/05/03 gAlice->ResetDigits(); - Int_t nent = 0; - - if (gAlice->TreeD()) { - nent = (Int_t) gAlice->TreeD()->GetEntries(); - //printf(" entries %d \n", nent); - // gAlice->TreeD()->GetEvent(nent-2+cathode-1); - gAlice->TreeD()->GetEvent(cathode-1); - } - + gime->TreeD()->GetEvent(cathode-1); + TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1); Int_t ndigits = muonDigits->GetEntriesFast(); -//pc 27/05/03 if (ndigits == 0) return; +// printf("\n 1 Found %d digits in %p %d \n ", ndigits, muonDigits,chamber-1); +// if (ndigits == 0) return; - iChamber = &(pMUON->Chamber(chamber-1)); +// iChamber = &(pMUON->Chamber(chamber-1)); segmentation=iChamber->SegmentationModel(cathode); AliMUONDigit *mdig; @@ -277,6 +217,7 @@ void AliMUONTriggerDecision::SetBit(){ // get the center of the pad Id Int_t ix=mdig->PadX(); Int_t iy=mdig->PadY(); + // get the sum of the coded charge // see coding convention in AliMUONChamberTrigger::DisIntegration Int_t sumCharge=0; @@ -284,7 +225,7 @@ void AliMUONTriggerDecision::SetBit(){ sumCharge=sumCharge+mdig->TrackCharge(icharge); } // apply condition on soft background - Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10; + Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10; if(sumCharge<=10||testCharge>0) { // code pad Int_t code=TMath::Abs(ix)*100+iy; @@ -382,6 +323,7 @@ void AliMUONTriggerDecision::SetBit(){ } // if cathode } // remove soft background } // end loop on digit + pMUON->ResetDigits(); } // end loop on cathode } // end loop on chamber } diff --git a/MUON/AliMUONTriggerLut.cxx b/MUON/AliMUONTriggerLut.cxx index a5de273af2b..2ec3c011745 100644 --- a/MUON/AliMUONTriggerLut.cxx +++ b/MUON/AliMUONTriggerLut.cxx @@ -12,27 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2002/10/23 07:24:57 alibrary -Introducing Riostream.h -Revision 1.6 2001/03/20 13:32:37 egangler -includes cleanup - -Revision 1.5 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/10/02 16:58:29 egangler -Cleaning of the code : --> coding conventions --> void Streamers --> some useless includes removed or replaced by "class" statement - -Revision 1.3 2000/06/25 16:47:43 pcrochet -pow replaced by TMath::Power - -*/ +/* $Id$ */ #include "AliMUONTriggerCircuit.h" #include "AliMUONTriggerLut.h" @@ -154,10 +135,12 @@ void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev, if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1; // get back to the first file +/* no need for this with NewIO TTree *tK = gAlice->TreeK(); TFile *file1 = 0; if (tK) file1 = tK->GetCurrentFile(); file1->cd(); +*/ } //---------------------------------------------------------------------- diff --git a/MUON/AliMUONproto.cxx b/MUON/AliMUONproto.cxx index 8565890d8d4..81e051357f4 100644 --- a/MUON/AliMUONproto.cxx +++ b/MUON/AliMUONproto.cxx @@ -12,26 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2002/10/23 07:24:57 alibrary -Introducing Riostream.h - -Revision 1.4 2001/01/26 20:00:53 hristov -Major upgrade of AliRoot code - -Revision 1.3 2000/10/11 09:19:12 egangler -Corrected some bugs - it should compile now -Revision 1.2 2000/06/15 07:58:49 morsch -Code from MUON-dev joined - -Revision 1.1.2.1 2000/04/18 09:11:15 morsch -Implementation of MUON Chamber Prototype Class -Both read digits from raw data or use the Monte-Carlo. -Rachid GUERNANE, IPN Lyon guernane@ipnl.in2p3.fr - -*/ +/* $Id$ */ /* Implementation of MUON Chamber Prototype Class diff --git a/MUON/AliMUONv0.cxx b/MUON/AliMUONv0.cxx index c188255418a..32790218971 100644 --- a/MUON/AliMUONv0.cxx +++ b/MUON/AliMUONv0.cxx @@ -13,107 +13,31 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.25 2003/01/14 10:50:19 alibrary -Cleanup of STEER coding conventions - -Revision 1.24 2002/11/21 17:01:56 alibrary -Removing AliMCProcess and AliMC - -Revision 1.23 2002/10/23 07:24:57 alibrary -Introducing Riostream.h - -Revision 1.22 2002/10/14 14:57:29 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.20.6.2 2002/07/24 10:07:21 alibrary -Updating VirtualMC - -Revision 1.21 2002/07/23 10:02:46 morsch -All volume names start with "S". - -Revision 1.20 2001/10/30 12:18:45 morsch -Place station 3 into DDIP only if DDIP is present. - -Revision 1.19 2001/07/17 09:51:38 morsch -Place station 3 inside Dipole. - -Revision 1.18 2001/04/06 11:24:43 morsch -Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class. -Static method Build() builds the MUON system out of chambers, segmentation and response. - -Revision 1.17 2001/03/17 10:07:20 morsch -Correct inconsistent variable name / method name / comments. - -Revision 1.16 2001/01/27 08:50:50 morsch -Call non default constructors of segmentation classes. - -Revision 1.15 2001/01/17 20:57:45 hristov -Unused variable removed - -Revision 1.14 2000/12/21 22:42:55 morsch -Constructor contains default set-up for segmentation. -Record charged particles only. - -Revision 1.13 2000/10/06 10:03:38 morsch -Call to gMC->VolId() moved to Init() - -Revision 1.12 2000/10/02 21:28:09 fca -Removal of useless dependecies via forward declarations - -Revision 1.11 2000/06/27 07:31:07 morsch -fChambers = 0; deleted from constructor. - -Revision 1.10 2000/06/26 14:02:38 morsch -Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. - -Revision 1.9 2000/06/15 07:58:49 morsch -Code from MUON-dev joined - -Revision 1.8.4.9 2000/06/12 19:20:49 morsch -Constructor sets default geometry, segmentation and response parameters. - -Revision 1.8.4.8 2000/06/09 21:55:28 morsch -Most coding rule violations corrected. - -Revision 1.8.4.7 2000/05/02 13:15:18 morsch -Coding rule violations RS3, RN13 corected - -Revision 1.8.4.6 2000/05/02 10:24:26 morsch -Public access to fdGas and fdAlu of AliMUONChamber replaced by getters. - -Revision 1.8.4.5 2000/04/26 19:58:47 morsch -Obsolete reference to trig_ removed. - -Revision 1.8.4.4 2000/04/19 19:42:47 morsch -change NCH to kNCH - -Revision 1.8.4.3 2000/02/17 08:17:43 morsch -Gammas and neutrons are also scored in the stepmanager -*/ +/* $Id$ */ ///////////////////////////////////////////////////////// // Manager and hits classes for set:MUON version 0 // ///////////////////////////////////////////////////////// #include -#include + #include #include #include #include +#include -#include "AliMUONv0.h" -#include "AliMUONChamber.h" -#include "AliRun.h" -#include "AliMagF.h" -#include "AliMUONHit.h" -#include "AliMUONPadHit.h" #include "AliCallf77.h" #include "AliConst.h" +#include "AliMUONChamber.h" #include "AliMUONConstants.h" #include "AliMUONFactory.h" +#include "AliMUONHit.h" +#include "AliMUONPadHit.h" +#include "AliMUONv0.h" +#include "AliMagF.h" +#include "AliRun.h" + ClassImp(AliMUONv0) //___________________________________________ diff --git a/MUON/AliMUONv1.cxx b/MUON/AliMUONv1.cxx index 2ea4d821185..ada0dd83ebe 100644 --- a/MUON/AliMUONv1.cxx +++ b/MUON/AliMUONv1.cxx @@ -13,8 +13,15 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ /* $Log$ +Revision 1.29.4.5 2003/05/14 15:24:30 martinez +Merging with NewIO: Merging v3 in v1 + +Revision 1.42 2003/05/13 17:03:54 martinez +Merging AliMUONv3 in AliMUONv1 + Revision 1.41 2003/05/02 15:09:38 hristov Code for MUON Station1 (I.Hrivnacova) @@ -188,18 +195,19 @@ Log messages included. #include #include #include +#include -#include "AliMUONv1.h" -#include "AliRun.h" -#include "AliMagF.h" #include "AliCallf77.h" #include "AliConst.h" #include "AliMUONChamber.h" +#include "AliMUONConstants.h" +#include "AliMUONFactory.h" #include "AliMUONHit.h" #include "AliMUONPadHit.h" -#include "AliMUONConstants.h" #include "AliMUONTriggerCircuit.h" -#include "AliMUONFactory.h" +#include "AliMUONv1.h" +#include "AliMagF.h" +#include "AliRun.h" ClassImp(AliMUONv1) diff --git a/MUON/AliMUONv1.h b/MUON/AliMUONv1.h index 9c990a67d46..04955c09d83 100644 --- a/MUON/AliMUONv1.h +++ b/MUON/AliMUONv1.h @@ -4,6 +4,7 @@ * See cxx source for full Copyright notice */ /* $Id$ */ +/* $Id$ */ ///////////////////////////////////////////////////////// // Manager and hits classes for set:MUON version 0 // diff --git a/MUON/AliMUONv2.cxx b/MUON/AliMUONv2.cxx index d0ab102f7b8..ebbb84b4568 100644 --- a/MUON/AliMUONv2.cxx +++ b/MUON/AliMUONv2.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // diff --git a/MUON/AliMUONv3.cxx b/MUON/AliMUONv3.cxx index 2a589504e30..993dbad1e61 100644 --- a/MUON/AliMUONv3.cxx +++ b/MUON/AliMUONv3.cxx @@ -13,17 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -// AliMUONv3 Addapted for AliMUONv1 -// This was the last revision of AliMUONv1 -// $Log$ -// Revision 1.1 2003/02/07 15:40:53 morsch -// New class for testing new Stepmanager added. (G. Martinez) -// -// Revision 1.40 2003/01/28 13:21:06 morsch -// Improved response simulation for station 1. -// (M. Mac Cormick, I. Hrivnacova, D. Guez) -// -// Gines Martinez (Subatech) jan 2003 +/* $Id$ */ ///////////////////////////////////////////////////////// // Manager and hits classes for set:MUON version 2 // diff --git a/MUON/Config_MUON_test.C b/MUON/Config_MUON_test.C new file mode 100644 index 00000000000..427a29cdb8d --- /dev/null +++ b/MUON/Config_MUON_test.C @@ -0,0 +1,142 @@ + +// Config file test for MUON spectormeter +// Remember to define the directory and option +// gAlice->SetConfigFunction("Config('$HOME','box');"); + +void Config(char directory[100]="", char option[6]="box") +{ + // + // Config file for MUON test + // Gines MARITNEZ, Subatech, mai 2003 + // + + //===================================================================== + // Libraries required by geant321 + gSystem->Load("libgeant321.so"); + + new TGeant3("C++ Interface to Geant3"); + + //======================================================================= + // Create the output file + Text_t filename[100]; + sprintf(filename,"%sgalice.root",directory); + cout << ">>> Output file is " << filename << endl; + cout << ">>> Config_MUON_test.C: Creating Run Loader ..."<Fatal("Config_MUON_test.C","Can not instatiate the Run Loader"); + return; + } + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(100); + gAlice->SetRunLoader(rl); + + //======================================================================= + // MonteCarlo + TGeant3 *geant3 = (TGeant3*)gMC; + + //======================================================================= + // Set External decayer + AliDecayer* decayer = new AliDecayerPythia(); + decayer->SetForceDecay(kAll); + decayer->Init(); + gMC->SetExternalDecayer(decayer); + + // + //======================================================================= + // ******* GEANT STEERING parameters FOR ALICE SIMULATION ******* + geant3->SetTRIG(1); //Number of events to be processed + geant3->SetSWIT(4,10); + geant3->SetDEBU(0,0,1); + //geant3->SetSWIT(2,2); + geant3->SetDCAY(1); + geant3->SetPAIR(1); + geant3->SetCOMP(1); + geant3->SetPHOT(1); + geant3->SetPFIS(0); + geant3->SetDRAY(0); + geant3->SetANNI(1); + geant3->SetBREM(1); + geant3->SetMUNU(1); + geant3->SetCKOV(1); + geant3->SetHADR(1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3) + geant3->SetLOSS(2); + geant3->SetSTRA(0); // Simulation des collisions dans the thin layers + geant3->SetMULS(1); + geant3->SetRAYL(1); + geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0) + geant3->SetABAN(0); //Restore 3.16 behaviour for abandoned tracks + geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2) + geant3->SetERAN(5.e-7); + Float_t cut = 1.e-3; // 1MeV cut by default + Float_t tofmax = 1.e10; + // GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX + geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); + // + //======================================================================= + // ************* STEERING parameters FOR ALICE SIMULATION ************** + // Chamber positions + // From AliMUONConstants class we get : + // Position Z (along beam) of the chambers (in cm) + // (from AliMUONConstants class): + // 533.5, 546.5, 678.5, 693.5, 964.0, 986.0, 1251.5, 1278.5, + // 1416.5, 1443.5, 1610, 1625., 1710., 1725. + // Internal Radius (in cm) + // 36.4, 46.2, 66.0, 80., 80., 100., 100. + // External Radius (in cm) + // 183., 245., 395., 560., 563., 850., 900. + //======================================================================= + if (!strcmp(option,"box")) { + AliGenBox * gener = new AliGenBox(1); + gener->SetMomentumRange(7.,7.1); + gener->SetPhiRange(-180., 180.); + gener->SetThetaRange(2.000,9.000); + gener->SetPart(13); // Muons + gener->SetOrigin(0.,0., 0.); //vertex position + gener->SetSigma(0.0, 0.0, 0.0); //Sigma in (X,Y,Z) (cm) on IP position + } + if (!strcmp(option,"gun")) { + //********************************************* + // Example for Fixed Particle Gun * + //********************************************* + AliGenFixed *gener = new AliGenFixed(ntracks); + gener->SetMomentum(10); + gener->SetPhiRange(0.); + gener->SetThetaRange(0.); + gener->SetOrigin(30,30,1200);//vertex position + gener->SetPart(13); //GEANT particle type 13 is muons + } + if (!strcmp(option,"param")) { + //******************************************************* + // Example for J/psi or Upsilon Production from Parameterisation * + //******************************************************* + AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kUpsilon); + gener->SetMomentumRange(0,999); + gener->SetPtRange(0,100.); + gener->SetPhiRange(-180, 180); + gener->SetYRange(2.5,4); + gener->SetCutOnChild(1); + gener->SetChildThetaRange(2.0,9); + gener->SetOrigin(0,0,0); //vertex position gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position + gener->SetForceDecay(kDiMuon); + gener->SetTrackingFlag(1); + } + + //============================================================= + //Specify maximum magnetic field in Tesla (neg. ==> default field) + gAlice->SetField(2,1) ; //(-999,2); + + //=================== Alice BODY parameters ============================= + AliBODY *BODY = new AliBODY("BODY","Alice envelop"); + + + //=================== MUON Subsystem =========================== + AliMUONv1 *MUON = new AliMUONv1("MUON","default"); + +} + + +Float_t EtaToTheta(Float_t arg){ + return (180./TMath::Pi())*2.*atan(exp(-arg)); +} diff --git a/MUON/MUONCheck.C b/MUON/MUONCheck.C new file mode 100644 index 00000000000..519894c5f63 --- /dev/null +++ b/MUON/MUONCheck.C @@ -0,0 +1,382 @@ +// +// Macro for checking aliroot output and associated files contents +// Gines Martinez, Subatech June 2003 +// + +// ROOT includes +#include "TBranch.h" +#include "TClonesArray.h" +#include "TFile.h" +#include "TH1.h" +#include "TParticle.h" +#include "TTree.h" + +// STEER includes +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliHeader.h" +#include "AliLoader.h" +#include "AliStack.h" + +// MUON includes +#include "AliMUON.h" +#include "AliMUONHit.h" +#include "AliMUONConstants.h" +#include "AliMUONDigit.h" +#include "AliMUONRawCluster.h" +#include "AliMUONGlobalTrigger.h" +#include "AliMUONLocalTrigger.h" + +void MUONkine(char * filename="galice.root") +{ + TClonesArray * ListOfParticles = new TClonesArray("TParticle",1000); + TParticle * particle = new TParticle(); + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + RunLoader->LoadKinematics("READ"); + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + for(ievent=0; ieventGetEvent(ievent); + RunLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle); + nparticles = RunLoader->TreeK()->GetEntries(); + printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles); + for(iparticle=0; iparticleTreeK()->GetEvent(iparticle); + particle->Print(""); + } + } + RunLoader->UnloadKinematics(); +} + + +void MUONhits(char * filename="galice.root") +{ + // List of Hits per event and per track + TClonesArray * ListOfHits = new TClonesArray("AliMUONHit",1000); + + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + + // Loading MUON subsystem + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + MUONLoader->LoadHits("READ"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + for(ievent=0; ievent>> Event %d \n",ievent); + + // Getting event ievent + RunLoader->GetEvent(ievent); + MUONLoader->TreeH()->GetBranch("MUON")->SetAddress(&ListOfHits); + + Int_t itrack, ntracks; + ntracks = (Int_t) (MUONLoader->TreeH())->GetEntries(); + for (itrack=0; itrack>> Track %d \n",itrack); + + //Getting List of Hits of Track itrack + (MUONLoader->TreeH())->GetEvent(itrack); + + Int_t ihit, nhits; + nhits = (Int_t) ListOfHits->GetEntriesFast(); + printf(">>> Number of hits %d \n",nhits); + AliMUONHit* mHit; + for(ihit=0; ihit(ListOfHits->At(ihit)); + Int_t Nch = mHit->Chamber(); // chamber number + Int_t hittrack = mHit->Track(); + Float_t x = mHit->X(); + Float_t y = mHit->Y(); + Float_t z = mHit->Z(); + Float_t elos = mHit->Eloss(); + Float_t theta = mHit->Theta(); + Float_t phi = mHit->Phi(); + Float_t momentum = mHit->Momentum(); + printf(">>> Hit %2d Chamber %2d Track %4d x %6.3f y %6.3f z %7.3f elos %g theta %6.3f phi %5.3f momentum %5.3f\n", + ihit, Nch,hittrack,x,y,z,elos,theta,phi, momentum); + } + ListOfHits->Clear(); + } // end track loop + } // end event loop + MUONLoader->UnloadHits(); +} + + +void MUONdigits(char * filename="galice.root") +{ + TClonesArray * ListOfDigits; + + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + + // Loading AliRun master + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); + // Getting Module MUON + AliMUON *pMUON = (AliMUON *) gAlice->GetDetector("MUON"); + + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + MUONLoader->LoadDigits("READ"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + AliMUONDigit * mDigit; + + + for(ievent=0; ievent>> Event %d \n",ievent); + RunLoader->GetEvent(ievent); + + // Addressing + Int_t ichamber, nchambers; + nchambers = AliMUONConstants::NCh(); ; + pMUON->SetTreeAddress(); + char branchname[30]; + //for( ichamber=0; ichamberTreeD()->GetBranch(branchname))->SetAddress(&((*pMUON->Dchambers())[ichamber])); + //} + + + Int_t icathode, ncathodes; + ncathodes=2; + //Loop on cathodes + for(icathode=0; icathode>> Cathode %d\n",icathode); + MUONLoader->TreeD()->GetEvent(icathode); + // Loop on chambers + for( ichamber=0; ichamber>> Chamber %d\n",ichamber); + // sprintf(branchname,"MUONDigits%d",ichamber+1); + //printf(">>> branchname %s\n",branchname); + ListOfDigits = (TClonesArray *) pMUON->Dchambers()->At(ichamber); + + Int_t idigit, ndigits; + + ndigits = (Int_t) ListOfDigits->GetEntriesFast(); + + for(idigit=0; idigit(ListOfDigits->At(idigit)); + Int_t PadX = mDigit->PadX(); // Pad X number + Int_t PadY = mDigit->PadY(); // Pad Y number + Int_t Signal = mDigit->Signal(); // Physics Signal + Int_t Hit = mDigit->Hit(); // iHit + Int_t Cathode= mDigit->Cathode(); // Cathode + Int_t Track0 = mDigit->Track(0); + Int_t Track1 = mDigit->Track(1); + Int_t Track2 = mDigit->Track(2); + + printf(">>> Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Track0 %4d Track1 %'d Track2 %4d \n",idigit, Cathode,Hit, PadX, PadY, Signal, Track0, Track1, Track2); + } // end digit loop + } // end chamber loop + } // end cathode loop + } // end event loop + MUONLoader->UnloadDigits(); +} + +void MUONrecpoints(char * filename="galice.root") { + + TClonesArray * ListOfRecPoints; + + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + + // Loading AliRun master + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); + // Getting Module MUON + AliMUON *pMUON = (AliMUON *) gAlice->GetDetector("MUON"); + + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + MUONLoader->LoadRecPoints("READ"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + AliMUONRawCluster * mRecPoint; + + + for(ievent=0; ievent>> Event %d \n",ievent); + RunLoader->GetEvent(ievent); + + // Addressing + Int_t ichamber, nchambers; + nchambers = AliMUONConstants::NTrackingCh(); + pMUON->SetTreeAddress(); + char branchname[30]; + + MUONLoader->TreeR()->GetEvent(0); + // Loop on chambers + for( ichamber=0; ichamber>> Chamber %d\n",ichamber); + sprintf(branchname,"MUONRawClusters%d",ichamber+1); + //printf(">>> branchname %s\n",branchname); + ListOfRecPoints = (TClonesArray *) pMUON->RawClusters()->At(ichamber); + + Int_t irecpoint, nrecpoints; + + nrecpoints = (Int_t) ListOfRecPoints->GetEntriesFast(); + + for(irecpoint=0; irecpoint(ListOfRecPoints->At(irecpoint)); +// Int_t fTracks[3]; //labels of overlapped tracks +// Int_t fQ[2] ; // Q of cluster (in ADC counts) +// Float_t fX[2] ; // X of cluster +// Float_t fY[2] ; // Y of cluster +// Float_t fZ[2] ; // Z of cluster +// Int_t fPeakSignal[2]; // Peak signal +// Int_t fIndexMap[50][2]; // indeces of digits +// Int_t fOffsetMap[50][2]; // Emmanuel special +// Float_t fContMap[50][2]; // Contribution from digit +// Int_t fPhysicsMap[50]; // Distinguish signal and background contr. +// Int_t fMultiplicity[2]; // Cluster multiplicity +// Int_t fNcluster[2]; // Number of clusters +// Int_t fClusterType; // Cluster type +// Float_t fChi2[2]; // Chi**2 of fit +// Int_t fGhost; // 0 if not a ghost or ghost problem solved +// // >0 if ghost problem remains because +// // 1 both (true and ghost) satify +// // charge chi2 compatibility +// // 2 none give satisfactory chi2 + + Int_t Track0 = mRecPoint->fTracks[0]; + Int_t Track1 = mRecPoint->fTracks[1]; + Int_t Track2 = mRecPoint->fTracks[2]; + Int_t Q0 = mRecPoint->fQ[0]; + Int_t Q1 = mRecPoint->fQ[1]; + Float_t x0 = mRecPoint->fX[0]; + Float_t x1 = mRecPoint->fX[1]; + Float_t y0 = mRecPoint->fY[0]; + Float_t y1 = mRecPoint->fY[1]; + Float_t z0 = mRecPoint->fZ[0]; + Float_t z1 = mRecPoint->fZ[1]; + Float_t chi2_0 = mRecPoint->fChi2[0]; + Float_t chi2_1 = mRecPoint->fChi2[1]; + + printf(">>> RecPoint %4d x %6.3f %6.3f y %6.3f %6.3f z %6.3f %6.3f Q0 %4d Q1 %4d Hit %4d Track1 %4d Track2 %4d Chi2 %6.3f %6.3f \n", +irecpoint, x0, x1, y0, y1, z0, z1, Q0, Q1, Track0, Track1, Track2, chi2_0, chi2_1); + } // end recpoint loop + } // end chamber loop + } // end event loop + MUONLoader->UnloadRecPoints(); +} + +void MUONTestTrigger (char * filename="galice.root"){ +// reads and dumps trigger objects from MUON.RecPoints.root + TClonesArray * globalTrigger; + TClonesArray * localTrigger; + + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + + // Loading AliRun master + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); + // Getting Module MUON + AliMUON *pMUON = (AliMUON *) gAlice->GetDetector("MUON"); + + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + MUONLoader->LoadRecPoints("READ"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + AliMUONGlobalTrigger *gloTrg; + AliMUONLocalTrigger *locTrg; + + for (ievent=0; ieventGetEvent(ievent); + + pMUON->SetTreeAddress(); + MUONLoader->TreeR()->GetEvent(0); + + globalTrigger = (TClonesArray *) pMUON->GlobalTrigger(); + localTrigger = (TClonesArray *) pMUON->LocalTrigger(); + + Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1 + Int_t nlocals = (Int_t) localTrigger->GetEntriesFast(); // up to 234 + printf("###################################################\n"); + cout << " event " << ievent + << " nglobals nlocals: " << nglobals << " " << nlocals << "\n"; + + for (Int_t iglobal=0; iglobal(globalTrigger->At(iglobal)); + + printf("===================================================\n"); + printf(" Global Trigger output Low pt High pt All\n"); + printf(" number of Single Plus :\t"); + printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(), + gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt()); + printf("\n"); + printf(" number of Single Minus :\t"); + printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(), + gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt()); + printf("\n"); + printf(" number of Single Undefined :\t"); + printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(), + gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt()); + printf("\n"); + printf(" number of UnlikeSign pair :\t"); + printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(), + gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt()); + printf("\n"); + printf(" number of LikeSign pair :\t"); + printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(), + gloTrg->PairLikeHpt(),gloTrg->PairLikeApt()); + printf("\n"); + printf("===================================================\n"); + + } // end of loop on Global Trigger + + for (Int_t ilocal=0; ilocal>> Output for Local Trigger " << ilocal << "\n"; + + locTrg = static_cast(localTrigger->At(ilocal)); + + cout << "Circuit StripX Dev StripY: " + << locTrg->LoCircuit() << " " + << locTrg->LoStripX() << " " + << locTrg->LoDev() << " " + << locTrg->LoStripY() + << "\n"; + cout << "Lpt Hpt Apt: " + << locTrg->LoLpt() << " " + << locTrg->LoHpt() << " " + << locTrg->LoApt() << "\n"; + + } // end of loop on Local Trigger + } // end loop on event +} + + + + + diff --git a/MUON/MUONLinkDef.h b/MUON/MUONLinkDef.h index f810d9b7503..6ba0618a6bb 100644 --- a/MUON/MUONLinkDef.h +++ b/MUON/MUONLinkDef.h @@ -5,6 +5,7 @@ #pragma link C++ class AliMUON+; #pragma link C++ class AliMUONv0+; #pragma link C++ class AliMUONv1+; +#pragma link C++ class AliMUONv3+; #pragma link C++ class AliMUONHit+; #pragma link C++ class AliMUONPadHit+; #pragma link C++ class AliMUONDigit+; diff --git a/MUON/MUONrawclusters.C b/MUON/MUONrawclusters.C index 1fb461fca3e..0fdf3c6b5c2 100644 --- a/MUON/MUONrawclusters.C +++ b/MUON/MUONrawclusters.C @@ -1,6 +1,6 @@ #include "iostream.h" -void MUONrawclusters (Int_t evNumber1=0,Int_t evNumber2=0) +void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0) { ////////////////////////////////////// // // @@ -22,42 +22,57 @@ void MUONrawclusters (Int_t evNumber1=0,Int_t evNumber2=0) // //__________________________________________________________________________ -// Dynamically link some shared libs +// // Dynamically link some shared libs - if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); - } + //if (gClassTable->GetID("AliRun") < 0) { + // gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C"); + // loadlibs(); + // } -// Connect the Root Galice file containing Geometry, Kine and Hits + // Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","UPDATE"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); - if (!file) file = new TFile("galice.root","UPDATE"); + // Loading AliRun master + RunLoader->UnloadgAlice(); + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); -// Get AliRun object from file or create it if not on file + // Loading MUON subsystem + AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON"); + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); - if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) printf("AliRun object found on file\n"); - if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); - } + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); -// Set reconstruction models -// -// Get pointers to Alice detectors and Digits containers - AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); - for (Int_t i=0; i<10; i++) { - RecModel = new AliMUONClusterFinderVS(); -// RecModel->SetTracks(16,17); -// RecModel->SetTracks(266,267); - RecModel->SetGhostChi2Cut(10); - MUON->SetReconstructionModel(i,RecModel); - } + for (Int_t i=0; i<10; i++) { + RecModel = new AliMUONClusterFinderVS(); + // RecModel->SetTracks(16,17); + // RecModel->SetTracks(266,267); + RecModel->SetGhostChi2Cut(10); + MUON->SetReconstructionModel(i,RecModel); + } // // Loop over events -// + // Int_t Nh=0; Int_t Nh1=0; - gAlice->RunReco("MUON", evNumber1, evNumber2); + // gAlice->RunReco("MUON", evNumber1, evNumber2); + for(Int_t ievent=evNumber1; ieventGetEvent(ievent); + MUONLoader->LoadDigits("read"); + if (MUONLoader->TreeR() == 0x0) MUONLoader->MakeTree("R"); + MUON->MakeBranch("R"); + MUON->SetTreeAddress(); + MUON->Digits2Reco(); + MUONLoader->UnloadDigits(); + MUONLoader->UnloadRecPoints(); + } + } + diff --git a/MUON/MUONrecoNtuple.C b/MUON/MUONrecoNtuple.C index e4777a5a4cc..856a55dec2d 100644 --- a/MUON/MUONrecoNtuple.C +++ b/MUON/MUONrecoNtuple.C @@ -30,6 +30,7 @@ #include "AliHeader.h" #include "AliRun.h" +#include "AliMUON.h" #include "AliMUONEventReconstructor.h" #include "AliMUONTrack.h" #include "AliMUONTrackHit.h" @@ -92,6 +93,7 @@ void AliMUONEventRecNtupleFill(AliMUONEventReconstructor *Reco, Int_t FillWrite Double_t bendingSlope, nonBendingSlope, pYZ; if (FillWrite == -1) { + printf(">>> Writing Ntuple of reconstructed tracks\n"); // better to create the file before the Ntuple ???? TFile *file = new TFile("MUONtrackReco.root","recreate"); ntuple->Write(); @@ -102,12 +104,14 @@ void AliMUONEventRecNtupleFill(AliMUONEventReconstructor *Reco, Int_t FillWrite if (firstTime) { firstTime = kFALSE; // first call: create tree for Ntuple... + printf(">>> Creating Ntuple of reconstructed tracks\n"); ntuple = new TTree("MUONtrackReco", "MUONtrackReco"); ntuple->Branch("Header","AliMUONHeaderRecNtuple", &header); ntuple->Branch("Tracks", &recTracks); } // header + header->fEvent = gAlice->GetHeader()->GetEvent(); TClonesArray *recoTracksPtr = Reco->GetRecTracksPtr(); @@ -139,16 +143,17 @@ void AliMUONEventRecNtupleFill(AliMUONEventReconstructor *Reco, Int_t FillWrite recTrackNt->fNHits = track->GetNTrackHits(); // track parameters at vertex of best compatible generated track: // in fact muon with the right charge - for (int iPart = 0; iPart < gAlice->Particles()->GetEntriesFast(); iPart++) { - TParticle *particle = (TParticle*) gAlice->Particles()->UncheckedAt(iPart); - if ((particle->GetPdgCode() * recTrackNt->fCharge) == -13) { - recTrackNt->fPxGen = particle->Px(); - recTrackNt->fPyGen = particle->Py(); - recTrackNt->fPzGen = particle->Pz(); - } - } + // for (int iPart = 0; iPart < gAlice->Particles()->GetEntriesFast(); iPart++) { +// TParticle *particle = (TParticle*) gAlice->Particles()->UncheckedAt(iPart); +// if ((particle->GetPdgCode() * recTrackNt->fCharge) == -13) { +// recTrackNt->fPxGen = particle->Px(); +// recTrackNt->fPyGen = particle->Py(); +// recTrackNt->fPzGen = particle->Pz(); +// } // commented by Gines + // } } // for (trackIndex = 0;... + printf(">>> Filling Ntuple of reconstructed tracks\n"); ntuple->Fill(); return; @@ -169,24 +174,25 @@ void MUONrecoNtuple (Int_t FirstEvent = 0, Int_t LastEvent = 0, Int_t RecGeantHi // loadlibs(); // } - // Connect the Root Galice file containing Geometry, Kine, Hits - // and eventually RawClusters - TFile *file = (TFile*) gROOT->GetListOfFiles()->FindObject(FileName); - if (!file) { - printf("\n Creating file %s\n", FileName); - file = new TFile(FileName); - } - else printf("\n File %s found in file list\n", FileName); - - // Get AliRun object from file or create it if not on file - if (!gAlice) { - gAlice = (AliRun*) file->Get("gAlice"); - if (gAlice) printf("AliRun object found on file\n"); - if (!gAlice) { - printf("\n Create new gAlice object"); - gAlice = new AliRun("gAlice","Alice test program"); - } + + // Creating Run Loader and openning file containing Hits, Digits and RecPoints + AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"Event","UPDATE"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",FileName); + return; } + // Loading AliRun master + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); + + // Loading MUON subsystem + AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON"); + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + MUONLoader->LoadHits("READ"); + MUONLoader->LoadRecPoints("READ"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); // Initializations // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? @@ -197,7 +203,7 @@ void MUONrecoNtuple (Int_t FirstEvent = 0, Int_t LastEvent = 0, Int_t RecGeantHi // The right place for changing AliMUONEventReconstructor parameters // with respect to the default ones // Reco->SetMaxSigma2Distance(100.0); - Reco->SetPrintLevel(0); + Reco->SetPrintLevel(20); // Reco->SetPrintLevel(1); // Reco->SetBendingResolution(0.0); // Reco->SetNonBendingResolution(0.0); @@ -207,10 +213,16 @@ void MUONrecoNtuple (Int_t FirstEvent = 0, Int_t LastEvent = 0, Int_t RecGeantHi // Loop over events for (Int_t event = FirstEvent; event <= LastEvent; event++) { + MUON->ResetRawClusters(); cout << "Event: " << event << endl; -// AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? - Int_t nparticles = gAlice->GetEvent(event); - cout << "nparticles: " << nparticles << endl; + RunLoader->GetEvent(event); + // Addressing + MUON->SetTreeAddress(); + + + + // Int_t nparticles = gAlice->GetEvent(event); +// cout << "nparticles: " << nparticles << endl; // prepare background file and/or event if necessary if (RecGeantHits == 1) { if (event == FirstEvent) Reco->SetBkgGeantFile(BkgGeantFileName); diff --git a/MUON/MUONtrigger.C b/MUON/MUONtrigger.C index ed1bd1242aa..151d93a2bd6 100644 --- a/MUON/MUONtrigger.C +++ b/MUON/MUONtrigger.C @@ -1,41 +1,41 @@ #include "iostream.h" -//Add the Trigger output in the tree TR of the ROOT file galice.root +//get trigger decision and write it in TreeR of MUON.RecPoints.root -void MUONtrigger (Int_t evNumber1=0, Int_t evNumber2=0) +void MUONtrigger (char* filename="galice.root", + Int_t evNumber1=0, Int_t evNumber2=0) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// Dynamically link some shared libs - if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); - } - -// Connect the Root Galice file containing Geometry, Kine and Hits - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); - if (file) file->Close(); - file = new TFile("galice.root","UPDATE"); - -// Get AliRun object from file or create it if not on file - if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) printf("AliRun object found on file\n"); - if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); - } - printf ("I'm after gAlice \n"); - - AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); +// Creating Run Loader and openning file containing Hits + AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","UPDATE"); + if (RunLoader ==0x0) { + printf(">>> Error : Error Opening %s file \n",filename); + return; + } + + // Loading AliRun master + RunLoader->UnloadgAlice(); + RunLoader->LoadgAlice(); + gAlice = RunLoader->GetAliRun(); + + // Loading MUON subsystem + AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON"); + AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); + + Int_t ievent, nevents; + nevents = RunLoader->GetNumberOfEvents(); + + MUONLoader->LoadDigits("READ"); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - for (int nev=evNumber1; nev<= evNumber2; nev++) { // event loop - Int_t nparticles = gAlice->GetEvent(nev); - cout << "nev " <Trigger(nev); - + for (Int_t ievent=evNumber1; ievent<=evNumber2; ievent++) { // event loop + printf("event %d\n",ievent); + RunLoader->GetEvent(ievent); + if (MUONLoader->TreeR() == 0x0) MUONLoader->MakeTree("R"); + MUON->MakeBranch("R"); + MUON->SetTreeAddress(); + MUON->Trigger(ievent); } // event loop - file->Close(); + MUONLoader->UnloadDigits(); } diff --git a/MUON/README b/MUON/README new file mode 100644 index 00000000000..01bb0378d41 --- /dev/null +++ b/MUON/README @@ -0,0 +1,90 @@ +========================================================== +Please add to this README file all information concerning +config files, simulation, digitalization, clusterization, +reconstruction and macro analysis + +========================================================== + How to run a MUON simulation +========================================================== +aliroot +root [0] gAlice->Run(10,"$ALICE_ROOT/MUON/Config_MUON_test.C"); + +1 single muon of 7 GeV/c in the MUON spectrometer +acceptance will be simulated using geant3. +Hit information will be store in the root file in the +execution directory. + +If you want to change the option or to define a new directory +for hits, you have to do the following before: +root [0] gAlice->SetConfigFunction("Config( \"/home/martinez/aliroot/work_NewIO/test/\" , \"box\" );"); + +============================================================ + How to run MUON Digitalization +============================================================ +To process the digitalization of hits the AliRunDigitizer +framework is used: + +root [0] AliRunDigitizer * manager = new AliRunDigitizer(1,1); +root [1] manager->SetInputStream(0,"galice.root"); +root [2] AliMUONDigitizerv1* dMUON = new AliMUONDigitizerv1(manager); +root [3] manager->AddDigitizer(dMUON); +root [4] manager->Exec("deb"); + +============================================================ + How to run MUON RecPoint clusterization +============================================================ +aliroot -b << EOF +root [0].L $ALICE_ROOT/MUON/MUONrawclusters.C +root [1] MUONrawclusters("galice.root",0,2); + +First event and last event are given by hand, but this will change. + +============================================================ + How to run MUON Trigger +============================================================ +root [0].L $ALICE_ROOT/MUON/MUONtrigger.C +root [1] MUONtrigger("galice.root",0,9); +>> IMPORTANT NOTE: in the present version, one can only have either +>> rawclusters or trigger information written in MUON.RecPoints.root +>> but not both of them i.e. running MUONtrigger after MUONrawclusters +>> will erase rawclusters from TreeR and vice versa. + +First event and last event are given by hand, but this will change. + +============================================================ + How to run MUON Tracking reconstruction +============================================================ + +root [0] .includepath $ALICE_ROOT/STEER +root [1] .includepath $ALICE_ROOT/MUON +root [2] .L $ALICE_ROOT/MUON/MUONrecoNtuple.C++ +root [3] MUONrecoNtuple(0,1,0,"galice.root") + +First event and last event are given by hand, but this will change. + +============================================================ + How to run MUONCheck macro +============================================================ +To check the content of a root data file, the MUONCheck +provides a ascii output on screen. + +To compile MUONCheck.C +root [0] .includepath $ALICE_ROOT/STEER +root [1] .includepath $ALICE_ROOT/MUON +root [2] .L $ALICE_ROOT/MUON/MUONCheck.C++ + +To print hits : (default file is galice.root if not MUONhits("toto.root""); ) +root [3] MUONhits() + +To print digits : (default file is galice.root) +root [4] MUONdigits() + +To print rawcluster : (default file is galice.root) +root [5] MUONrecpoints() + +To print trigger : (default file is galice.root) +root [5] MUONTestTrigger() + +=========================================================== + Still working .............. +=========================================================== diff --git a/MUON/libMUON.pkg b/MUON/libMUON.pkg index 79fd5756de0..452ce97342a 100644 --- a/MUON/libMUON.pkg +++ b/MUON/libMUON.pkg @@ -9,7 +9,7 @@ SRCS = AliMUONChamber.cxx AliMUONChamberTrigger.cxx \ AliMUONSegmentationTrigger.cxx AliMUONResponseTrigger.cxx\ AliMUONResponseTriggerV1.cxx\ AliMUONSegmentationTriggerX.cxx AliMUONSegmentationTriggerY.cxx \ - AliMUONSegmentationV1.cxx AliMUON.cxx AliMUONv0.cxx AliMUONv1.cxx \ + AliMUONSegmentationV1.cxx AliMUON.cxx AliMUONv0.cxx AliMUONv1.cxx AliMUONv3.cxx \ AliMUONDisplay.cxx AliMUONPoints.cxx \ AliMUONClusterFinderVS.cxx \ AliMUONHitMapA1.cxx \ diff --git a/PHOS/AliPHOS.cxx b/PHOS/AliPHOS.cxx index ff91cd13ad4..fdad9ed75cb 100644 --- a/PHOS/AliPHOS.cxx +++ b/PHOS/AliPHOS.cxx @@ -27,18 +27,21 @@ // --- ROOT system --- class TFile; -#include "TROOT.h" -#include "TTree.h" -#include "TFolder.h" +#include +#include +#include +#include // --- Standard library --- +#include // --- AliRoot header files --- -#include "AliPHOS.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliPHOS.h" #include "AliPHOSGeometry.h" -#include "AliPHOSQAChecker.h" +#include "AliPHOSLoader.h" +#include "AliPHOSQAChecker.h" +#include "AliRun.h" ClassImp(AliPHOS) //____________________________________________________________________________ @@ -368,16 +371,21 @@ AliPHOSGeometry * AliPHOS::GetGeometry() const //____________________________________________________________________________ void AliPHOS::SetTreeAddress() { - // Set tree address to hit array + TBranch *branch; char branchname[20]; sprintf(branchname,"%s",GetName()); // Branch address for hit tree - TTree *treeH = gAlice->TreeH(); - if (treeH && fHits) { + TTree *treeH = TreeH(); + if (treeH) { branch = treeH->GetBranch(branchname); - if (branch) branch->SetAddress(&fHits); + if (branch) + { + if (fHits == 0x0) fHits= new TClonesArray("AliPHOSHit",1000); + //Info("SetTreeAddress","<%s> Setting Hits Address",GetName()); + branch->SetAddress(&fHits); + } } } @@ -386,13 +394,24 @@ void AliPHOS::WriteQA() { // Make TreeQA in the output file. + if(fTreeQA == 0) fTreeQA = new TTree("TreeQA", "QA Alarms") ; // Create Alarms branches Int_t bufferSize = 32000 ; Int_t splitlevel = 0 ; - TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ; - TString branchName(alarmsF->GetName()); + + TFolder* topfold = GetLoader()->GetTopFolder(); //get top aliroot folder; skowron + TString phosqafn(AliConfig::Instance()->GetQAFolderName()+"/"); //get name of QAaut folder relative to top event; skowron + phosqafn+=GetName(); //hard wired string!!! add the detector name to the pathname; skowron + TFolder * alarmsF = (TFolder*)topfold->FindObjectAny(phosqafn); //get the folder + + if (alarmsF == 0x0) + { + Error("WriteQA","Can not find folder with qa alarms"); + return; + } + TString branchName(alarmsF->GetName()); TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel); TString branchTitle = branchName + " QA alarms" ; alarmsBranch->SetTitle(branchTitle); @@ -401,3 +420,11 @@ void AliPHOS::WriteQA() //fTreeQA->Fill() ; } +//____________________________________________________________________________ +AliLoader* AliPHOS::MakeLoader(const char* topfoldername) +{ +//different behaviour than standard (singleton getter) +// --> to be discussed and made eventually coherent + fLoader = new AliPHOSLoader(GetName(),topfoldername); + return fLoader; +} diff --git a/PHOS/AliPHOS.h b/PHOS/AliPHOS.h index dbce7c0fec6..a4b786d8188 100644 --- a/PHOS/AliPHOS.h +++ b/PHOS/AliPHOS.h @@ -9,7 +9,7 @@ // //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) -//#include +#include // --- ROOT system --- @@ -52,9 +52,13 @@ class AliPHOS : public AliDetector { virtual const TString Version() const {return TString(" ") ; } virtual void WriteQA() ; AliPHOS & operator = (const AliPHOS & rvalue) { - // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *this ; + // assignement operator requested by coding convention + // but not needed + Fatal("operator =", "not implemented") ; + return *this ; } + + virtual AliLoader* MakeLoader(const char* topfoldername); protected: diff --git a/PHOS/AliPHOSAnalyze.cxx b/PHOS/AliPHOSAnalyze.cxx index a41ba5c664a..1f6e1db41b5 100644 --- a/PHOS/AliPHOSAnalyze.cxx +++ b/PHOS/AliPHOSAnalyze.cxx @@ -79,6 +79,7 @@ // --- AliRoot header files --- #include "AliRun.h" +#include "AliStack.h" #include "AliPHOSv1.h" #include "AliPHOSAnalyze.h" #include "AliPHOSDigit.h" @@ -86,7 +87,7 @@ #include "AliPHOSTrackSegment.h" #include "AliPHOSRecParticle.h" #include "AliPHOSCpvRecPoint.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" ClassImp(AliPHOSAnalyze) @@ -96,14 +97,20 @@ ClassImp(AliPHOSAnalyze) { // default ctor (useless) fCorrection = 1.2 ; //Value calculated for default parameters of reconstruction + fRunLoader = 0x0; } //____________________________________________________________________________ AliPHOSAnalyze::AliPHOSAnalyze(Text_t * fileName) { // ctor: analyze events from root file "name" - ffileName = fileName ; + ffileName = fileName; fCorrection = 1.05 ; //Value calculated for default parameters of reconstruction + fRunLoader = AliRunLoader::Open(fileName,"AliPHOSAnalyze"); + if (fRunLoader == 0x0) + { + Error("AliPHOSAnalyze","Error Loading session"); + } } //____________________________________________________________________________ @@ -120,19 +127,32 @@ AliPHOSAnalyze::~AliPHOSAnalyze() } //____________________________________________________________________________ -void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const char* branchTitle){ +void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * branchName,const char* branchTitle){ //Draws pimary particles and reconstructed //digits, RecPoints, RecPartices etc //for event Nevent in the module Nmod. - //========== Create ObjectGetter - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ; - if(Nevent >= gAlice->TreeE()->GetEntries() ) { - Error("DrawRecon", "There is no event %d only %d events available", Nevent, gAlice->TreeE()->GetEntries() ) ; + //========== Create ObjectLoader + if (fRunLoader == 0x0) + { + Error("DrawRecon","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("DrawRecon","Could not obtain the Loader object !"); + return ; + } + + + if(Nevent >= fRunLoader->GetNumberOfEvents() ) { + Error("DrawRecon", "There is no event %d only %d events available", Nevent, fRunLoader->GetNumberOfEvents() ) ; return ; } const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ; - gime->Event(Nevent); + fRunLoader->GetEvent(Nevent); Int_t nx = phosgeom->GetNPhi() ; Int_t nz = phosgeom->GetNZ() ; @@ -176,16 +196,21 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c recPhot->Delete() ; recPhot = new TH2F("recPhot","RecParticles with primary Photon",nx,-x,x,nz,-z,z); - if(strstr(what,"P") || strstr(what,"p")){ + //Plot Primary Particles + + if (fRunLoader->Stack() == 0x0) fRunLoader->LoadKinematics("READ"); + + const TParticle * primary ; Int_t iPrimary ; - for ( iPrimary = 0 ; iPrimary < gime->NPrimaries() ; iPrimary++) + for ( iPrimary = 0 ; iPrimary < fRunLoader->Stack()->GetNprimary() ; iPrimary++) { - primary = gime->Primary(iPrimary) ; - Int_t primaryType = primary->GetPdgCode() ; + primary = fRunLoader->Stack()->Particle(iPrimary); + + Int_t primaryType = primary->GetPdgCode(); // if( (primaryType == 211)||(primaryType == -211)||(primaryType == 2212)||(primaryType == -2212) -// ||(primaryType == 11)||(primaryType == -11) ) { +// ||(primaryType == 11)||(primaryType == -11) ) { // Int_t moduleNumber ; // Double_t primX, primZ ; // phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; @@ -209,11 +234,8 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c // } // } } - phot->Draw("box") ; - } - if(strstr(what,"S") || strstr(what,"s")){ Int_t iSDigit ; AliPHOSDigit * sdigit ; const TClonesArray * sdigits = gime->SDigits() ; @@ -221,29 +243,27 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c if(sdigits){ for(iSDigit = 0; iSDigit < sdigits->GetEntriesFast() ; iSDigit++) { - sdigit = (AliPHOSDigit *) sdigits->At(iSDigit) ; - Int_t relid[4]; - phosgeom->AbsToRelNumbering(sdigit->GetId(), relid) ; - Float_t x,z ; - phosgeom->RelPosInModule(relid,x,z) ; - Float_t e = gime->SDigitizer()->Calibrate(sdigit->GetAmp()) ; - nsdig[relid[0]-1]++ ; - if(relid[0]==Nmod){ - if(relid[1]==0) //EMC - emcSdigits->Fill(x,z,e) ; - if( relid[1]!=0 ) - cpvSdigits->Fill(x,z,e) ; - } + sdigit = (AliPHOSDigit *) sdigits->At(iSDigit) ; + Int_t relid[4]; + phosgeom->AbsToRelNumbering(sdigit->GetId(), relid) ; + Float_t x,z ; + phosgeom->RelPosInModule(relid,x,z); + AliPHOSSDigitizer* sd = dynamic_cast(gime->SDigitizer()); + Float_t e = sd->Calibrate(sdigit->GetAmp()) ; + nsdig[relid[0]-1]++ ; + if(relid[0]==Nmod){ + if(relid[1]==0) //EMC + emcSdigits->Fill(x,z,e) ; + if( relid[1]!=0 ) + cpvSdigits->Fill(x,z,e) ; + } } } TString message ; message = "Number of EMC + CPV SDigits per module: \n" ; message += "%d %d %d %d %d\n"; Info("DrawRecon", message.Data(), nsdig[0], nsdig[1], nsdig[2], nsdig[3], nsdig[4] ) ; - emcSdigits->Draw("box") ; - } - if(strstr(what,"D") || strstr(what,"d")){ //Plot digits Int_t iDigit ; AliPHOSDigit * digit ; @@ -251,25 +271,23 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c if(digits) { for(iDigit = 0; iDigit < digits->GetEntriesFast(); iDigit++) { - digit = (AliPHOSDigit *) digits->At(iDigit) ; - Int_t relid[4]; - phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; - Float_t x,z ; - phosgeom->RelPosInModule(relid,x,z) ; - Float_t e = gime->SDigitizer()->Calibrate(digit->GetAmp()) ; - if(relid[0]==Nmod){ - if(relid[1]==0) //EMC - emcDigits->Fill(x,z,e) ; - if( relid[1]!=0 ) - cpvDigits->Fill(x,z,e) ; - } + digit = (AliPHOSDigit *) digits->At(iDigit) ; + Int_t relid[4]; + phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; + Float_t x,z ; + phosgeom->RelPosInModule(relid,x,z) ; + AliPHOSSDigitizer* sd = dynamic_cast(gime->SDigitizer()); + Float_t e = sd->Calibrate(digit->GetAmp()) ; + if(relid[0]==Nmod){ + if(relid[1]==0) //EMC + emcDigits->Fill(x,z,e) ; + if( relid[1]!=0 ) + cpvDigits->Fill(x,z,e) ; + } } } - emcDigits->SetLineColor(5) ; - emcDigits->Draw("boxsame") ; - } - if(strstr(what,"R") || strstr(what,"r")){ + //Plot RecPoints Int_t irecp ; TVector3 pos ; @@ -278,8 +296,8 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c for(irecp = 0; irecp < emcrp->GetEntriesFast() ; irecp ++){ AliPHOSEmcRecPoint * emc = (AliPHOSEmcRecPoint *) emcrp->At(irecp) ; if(emc->GetPHOSMod()==Nmod){ - emc->GetLocalPosition(pos) ; - emcRecPoints->Fill(pos.X(),pos.Z(),emc->GetEnergy()); + emc->GetLocalPosition(pos) ; + emcRecPoints->Fill(pos.X(),pos.Z(),emc->GetEnergy()); } } } @@ -289,8 +307,8 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c for(irecp = 0; irecp < cpvrp->GetEntriesFast() ; irecp ++){ AliPHOSRecPoint * cpv = (AliPHOSCpvRecPoint *) cpvrp->At(irecp) ; if(cpv->GetPHOSMod()==Nmod){ - cpv->GetLocalPosition(pos) ; - cpvRecPoints->Fill(pos.X(),pos.Z(),cpv->GetEnergy()); + cpv->GetLocalPosition(pos) ; + cpvRecPoints->Fill(pos.X(),pos.Z(),cpv->GetEnergy()); } } } @@ -303,71 +321,92 @@ void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod,const char * what,const c if(rp && ts && emcrp) { for(iRecParticle = 0; iRecParticle < rp->GetEntriesFast() ; iRecParticle++ ) { - recParticle = (AliPHOSRecParticle *) rp->At(iRecParticle) ; - Int_t moduleNumberRec ; - Double_t recX, recZ ; - phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ; - if(moduleNumberRec == Nmod){ - - Double_t minDistance = 5. ; - Int_t closestPrimary = -1 ; - - //extract list of primaries: it is stored at EMC RecPoints - Int_t emcIndex = ((AliPHOSTrackSegment *) ts->At(recParticle->GetPHOSTSIndex()))->GetEmcIndex() ; - Int_t numberofprimaries ; - Int_t * listofprimaries = ((AliPHOSRecPoint*) emcrp->At(emcIndex))->GetPrimaries(numberofprimaries) ; - Int_t index ; - const TParticle * primary ; - Double_t distance = minDistance ; - - for ( index = 0 ; index < numberofprimaries ; index++){ - primary = gime->Primary(listofprimaries[index]) ; - Int_t moduleNumber ; - Double_t primX, primZ ; - phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; - if(moduleNumberRec == moduleNumber) - distance = TMath::Sqrt((recX-primX)*(recX-primX)+(recZ-primZ)*(recZ-primZ) ) ; - if(minDistance > distance) - { - minDistance = distance ; - closestPrimary = listofprimaries[index] ; - } - } - - if(closestPrimary >=0 ){ - - Int_t primaryType = gime->Primary(closestPrimary)->GetPdgCode() ; - - if(primaryType==22) - recPhot->Fill(recZ,recX,recParticle->Energy()) ; -// else -// if(primaryType==-2112) -// recNbar->Fill(recZ,recX,recParticle->Energy()) ; - } - } + recParticle = (AliPHOSRecParticle *) rp->At(iRecParticle) ; + Int_t moduleNumberRec ; + Double_t recX, recZ ; + phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ; + if(moduleNumberRec == Nmod){ + + Double_t minDistance = 5. ; + Int_t closestPrimary = -1 ; + + //extract list of primaries: it is stored at EMC RecPoints + Int_t emcIndex = ((AliPHOSTrackSegment *) ts->At(recParticle->GetPHOSTSIndex()))->GetEmcIndex() ; + Int_t numberofprimaries ; + Int_t * listofprimaries = ((AliPHOSRecPoint*) emcrp->At(emcIndex))->GetPrimaries(numberofprimaries) ; + Int_t index ; + const TParticle * primary ; + Double_t distance = minDistance ; + + for ( index = 0 ; index < numberofprimaries ; index++){ + primary = fRunLoader->Stack()->Particle(listofprimaries[index]) ; + Int_t moduleNumber ; + Double_t primX, primZ ; + phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; + if(moduleNumberRec == moduleNumber) + distance = TMath::Sqrt((recX-primX)*(recX-primX)+(recZ-primZ)*(recZ-primZ) ) ; + if(minDistance > distance) + { + minDistance = distance ; + closestPrimary = listofprimaries[index] ; + } + } + + if(closestPrimary >=0 ){ + + Int_t primaryType = fRunLoader->Stack()->Particle(closestPrimary)->GetPdgCode() ; + + if(primaryType==22) + recPhot->Fill(recZ,recX,recParticle->Energy()) ; +// else +// if(primaryType==-2112) +// recNbar->Fill(recZ,recX,recParticle->Energy()) ; + } + } } } + //Plot made histograms + emcSdigits->Draw("box") ; + emcDigits->SetLineColor(5) ; + emcDigits->Draw("boxsame") ; emcRecPoints->SetLineColor(2) ; emcRecPoints->Draw("boxsame") ; cpvSdigits->SetLineColor(1) ; cpvSdigits->Draw("boxsame") ; - } - - } //____________________________________________________________________________ void AliPHOSAnalyze::Ls(){ //lists branches and titles of PHOS-related branches of TreeR, TreeD, TreeS - AliPHOSGetter::GetInstance(ffileName.Data()) ; + if (fRunLoader == 0x0) + { + Error("Ls","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("Ls","Could not obtain the Loader object !"); + return ; + } + Int_t ibranch; TObjArray * branches; - branches = gAlice->TreeS()->GetListOfBranches() ; + if (gime->TreeS() == 0x0) + { + if (gime->LoadSDigits("READ")) + { + Error("Ls","Problems with loading summable digits"); + return; + } + } + branches = gime->TreeS()->GetListOfBranches() ; TString message ; message = "TreeS:\n" ; @@ -381,7 +420,16 @@ void AliPHOSAnalyze::Ls(){ message += "\n" ; } } - branches = gAlice->TreeD()->GetListOfBranches() ; + if (gime->TreeD() == 0x0) + { + if (gime->LoadDigits("READ")) + { + Error("Ls","Problems with loading digits"); + return; + } + } + + branches = gime->TreeD()->GetListOfBranches() ; message += "TreeD:\n" ; for(ibranch = 0;ibranch GetEntries();ibranch++){ @@ -395,7 +443,16 @@ void AliPHOSAnalyze::Ls(){ } } - branches = gAlice->TreeR()->GetListOfBranches() ; + if (gime->TreeR() == 0x0) + { + if (gime->LoadRecPoints("READ")) + { + Error("Ls","Problems with loading rec points"); + return; + } + } + + branches = gime->TreeR()->GetListOfBranches() ; message += "TreeR: \n" ; for(ibranch = 0;ibranch GetEntries();ibranch++){ @@ -414,10 +471,24 @@ void AliPHOSAnalyze::Ls(){ void AliPHOSAnalyze::InvariantMass(const char* branchTitle) { // Calculates Real and Mixed invariant mass distributions - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ; - + if (fRunLoader == 0x0) + { + Error("DrawRecon","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("DrawRecon","Could not obtain the Loader object !"); + return ; + } + + gime->LoadRecParticles("READ"); + Int_t nMixedEvents = 4 ; //# of events used for calculation of 'mixed' distribution - + + //opening file TFile * mfile = new TFile("invmass.root","update"); @@ -453,10 +524,18 @@ void AliPHOSAnalyze::Ls(){ //scan over all events Int_t event ; - Int_t maxevent = (Int_t)gAlice->TreeE()->GetEntries() ; + + + if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader(); + + + Int_t maxevent = (Int_t)fRunLoader->TreeE()->GetEntries(); // for(event = 0; event < gime->MaxEvent(); event++ ){ + + + for(event = 0; event < maxevent; event++ ){ - gime->Event(event,"R"); //will read only TreeR + fRunLoader->GetEvent(event); //will read only TreeR //copy EM RecParticles to the "total" list const AliPHOSRecParticle * recParticle ; @@ -469,10 +548,10 @@ void AliPHOSAnalyze::Ls(){ for(iRecParticle = 0; iRecParticle < rp->GetEntriesFast(); iRecParticle++ ) { - recParticle = (AliPHOSRecParticle *) rp->At(iRecParticle) ; - if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| - (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW)) - new( (*allRecParticleList)[iRecPhot++] ) AliPHOSRecParticle(*recParticle) ; + recParticle = (AliPHOSRecParticle *) rp->At(iRecParticle) ; + if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| + (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW)) + new( (*allRecParticleList)[iRecPhot++] ) AliPHOSRecParticle(*recParticle) ; } Int_t mevent = event%nMixedEvents ; //event number in the "mixed" cicle @@ -489,46 +568,46 @@ void AliPHOSAnalyze::Ls(){ Int_t nCurEvent = 0 ; for(irp1 = 0; irp1 < allRecParticleList->GetEntries()-1; irp1++){ - AliPHOSRecParticle * rp1 = (AliPHOSRecParticle *)allRecParticleList->At(irp1) ; - - for(irp2 = irp1+1; irp2 < allRecParticleList->GetEntries(); irp2++){ - AliPHOSRecParticle * rp2 = (AliPHOSRecParticle *)allRecParticleList->At(irp2) ; - - Double_t invMass ; - invMass = (rp1->Energy()+rp2->Energy())*(rp1->Energy()+rp2->Energy())- - (rp1->Px()+rp2->Px())*(rp1->Px()+rp2->Px())- - (rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py())- - (rp1->Pz()+rp2->Pz())*(rp1->Pz()+rp2->Pz()) ; - - if(invMass> 0) - invMass = TMath::Sqrt(invMass); - - Double_t pt ; - pt = TMath::Sqrt((rp1->Px()+rp2->Px() )*( rp1->Px()+rp2->Px() ) + - (rp1->Py()+rp2->Py() )*( rp1->Py()+rp2->Py() ) ); - - if(irp1 > nRecParticles[nCurEvent]) - nCurEvent++; - - if(irp2 <= nRecParticles[nCurEvent]){ //'Real' event - hRealEM->Fill(invMass,pt); - if((rp1->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)&& - (rp2->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST) ) - hRealPhot->Fill(invMass,pt); - } - else{ - hMixedEM->Fill(invMass,pt); - if((rp1->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)&& - (rp2->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST) ) - hMixedPhot->Fill(invMass,pt); - } //real-mixed - + AliPHOSRecParticle * rp1 = (AliPHOSRecParticle *)allRecParticleList->At(irp1) ; + + for(irp2 = irp1+1; irp2 < allRecParticleList->GetEntries(); irp2++){ + AliPHOSRecParticle * rp2 = (AliPHOSRecParticle *)allRecParticleList->At(irp2) ; + + Double_t invMass ; + invMass = (rp1->Energy()+rp2->Energy())*(rp1->Energy()+rp2->Energy())- + (rp1->Px()+rp2->Px())*(rp1->Px()+rp2->Px())- + (rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py())- + (rp1->Pz()+rp2->Pz())*(rp1->Pz()+rp2->Pz()) ; + + if(invMass> 0) + invMass = TMath::Sqrt(invMass); + + Double_t pt ; + pt = TMath::Sqrt((rp1->Px()+rp2->Px() )*( rp1->Px()+rp2->Px() ) + + (rp1->Py()+rp2->Py() )*( rp1->Py()+rp2->Py() ) ); + + if(irp1 > nRecParticles[nCurEvent]) + nCurEvent++; + + if(irp2 <= nRecParticles[nCurEvent]){ //'Real' event + hRealEM->Fill(invMass,pt); + if((rp1->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)&& + (rp2->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST) ) + hRealPhot->Fill(invMass,pt); + } + else{ + hMixedEM->Fill(invMass,pt); + if((rp1->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)&& + (rp2->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST) ) + hMixedPhot->Fill(invMass,pt); + } //real-mixed + } //loop over second rp }//loop over first rp //Make some cleanings for(Int_t index = 0; index < nMixedEvents; index ++) - nRecParticles[index] = 0 ; + nRecParticles[index] = 0 ; iRecPhot = 0 ; allRecParticleList->Clear() ; @@ -576,15 +655,32 @@ void AliPHOSAnalyze::Ls(){ hEMEnergy = new TH2F("hEMEnergy", "Energy of EM with primary photon", 100, 0., 5., 100, 0., 5.); - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ; - const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ; + if (fRunLoader == 0x0) + { + Error("DrawRecon","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("DrawRecon","Could not obtain the Loader object !"); + return ; + } + + + const AliPHOSGeometry * phosgeom = gime->PHOSGeometry(); Int_t ievent; - Int_t maxevent = (Int_t)gAlice->TreeE()->GetEntries() ; + Int_t maxevent = (Int_t)fRunLoader->TreeE()->GetEntries(); + + fRunLoader->LoadKinematics("READ"); + gime->LoadTracks("READ"); + for ( ievent=0; ievent < maxevent ; ievent++){ //read the current event - gime->Event(ievent) ; + fRunLoader->GetEvent(ievent) ; const AliPHOSRecParticle * recParticle ; Int_t iRecParticle ; @@ -627,36 +723,38 @@ void AliPHOSAnalyze::Ls(){ Double_t dXmin = 0.; Double_t dZmin = 0. ; for ( index = 0 ; index < numberofprimaries ; index++){ - primary = gime->Primary(listofprimaries[index]) ; - Int_t moduleNumber ; - Double_t primX, primZ ; - phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; - if(moduleNumberRec == moduleNumber) { - dX = recX - primX; - dZ = recZ - primZ; - distance = TMath::Sqrt(dX*dX + dZ*dZ) ; - if(minDistance > distance) { - minDistance = distance ; - dXmin = dX; - dZmin = dZ; - closestPrimary = listofprimaries[index] ; - } - } + + primary = fRunLoader->Stack()->Particle(listofprimaries[index]) ; + + Int_t moduleNumber ; + Double_t primX, primZ ; + phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; + if(moduleNumberRec == moduleNumber) { + dX = recX - primX; + dZ = recZ - primZ; + distance = TMath::Sqrt(dX*dX + dZ*dZ) ; + if(minDistance > distance) { + minDistance = distance ; + dXmin = dX; + dZmin = dZ; + closestPrimary = listofprimaries[index] ; + } + } } //if found primary, fill histograms if(closestPrimary >=0 ){ - const TParticle * primary = gime->Primary(closestPrimary) ; - if(primary->GetPdgCode() == 22){ - hAllEnergy->Fill(primary->Energy(), recParticle->Energy()) ; - if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ - hPhotEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; - hEMEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; - } - else - if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) - hEMEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; - } + const TParticle * primary = fRunLoader->Stack()->Particle(closestPrimary) ; + if(primary->GetPdgCode() == 22){ + hAllEnergy->Fill(primary->Energy(), recParticle->Energy()) ; + if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ + hPhotEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; + hEMEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; + } + else + if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) + hEMEnergy->Fill(primary->Energy(), recParticle->Energy() ) ; + } } } } @@ -692,34 +790,47 @@ void AliPHOSAnalyze::PositionResolution(const char * branchTitle) hAllPosition = (TH2F*)pfile->Get("hAllPosition"); if(hAllPosition == 0) hAllPosition = new TH2F("hAllPosition", - "Position of any RP with primary photon",100, 0., 5., 100, 0., 5.); + "Position of any RP with primary photon",100, 0., 5., 100, 0., 5.); hPhotPosition= (TH2F*)pfile->Get("hPhotPosition"); if(hPhotPosition == 0) hPhotPosition = new TH2F("hPhotPosition", - "Position of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.); + "Position of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.); hEMPosition= (TH2F*)pfile->Get("hEMPosition") ; if(hEMPosition == 0) hEMPosition = new TH2F("hEMPosition", - "Position of EM with primary photon", 100, 0., 5., 100, 0., 5.); - hAllPositionX = (TH1F*)pfile->Get("hAllPositionX") ; + "Position of EM with primary photon", 100, 0., 5., 100, 0., 5.); + hAllPositionX = (TH1F*)pfile->Get("hAllPositionX") ; if(hAllPositionX == 0) hAllPositionX = new TH1F("hAllPositionX", - "Delta X of any RP with primary photon",100, -2., 2.); + "Delta X of any RP with primary photon",100, -2., 2.); hAllPositionZ =(TH1F*) pfile->Get("hAllPositionZ") ; if(hAllPositionZ == 0) hAllPositionZ = new TH1F("hAllPositionZ", - "Delta X of any RP with primary photon",100, -2., 2.); + "Delta X of any RP with primary photon",100, -2., 2.); + if (fRunLoader == 0x0) + { + Error("DrawRecon","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("DrawRecon","Could not obtain the Loader object !"); + return ; + } + + if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader(); - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ; const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ; Int_t ievent; - Int_t maxevent = (Int_t)gAlice->TreeE()->GetEntries() ; + Int_t maxevent = (Int_t)fRunLoader->TreeE()->GetEntries() ; for ( ievent=0; ievent < maxevent ; ievent++){ //read the current event - gime->Event(ievent) ; + fRunLoader->GetEvent(ievent) ; TClonesArray * rp = gime->RecParticles() ; if(!rp) { Error("PositionResolution", "Event %d, Can't find RecParticles", ievent) ; @@ -763,38 +874,38 @@ void AliPHOSAnalyze::PositionResolution(const char * branchTitle) Double_t dXmin = 0.; Double_t dZmin = 0. ; for ( index = 0 ; index < numberofprimaries ; index++){ - primary = gime->Primary(listofprimaries[index]) ; - Int_t moduleNumber ; - Double_t primX, primZ ; - phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; - if(moduleNumberRec == moduleNumber) { - dX = recX - primX; - dZ = recZ - primZ; - distance = TMath::Sqrt(dX*dX + dZ*dZ) ; - if(minDistance > distance) { - minDistance = distance ; - dXmin = dX; - dZmin = dZ; - closestPrimary = listofprimaries[index] ; - } - } + primary = fRunLoader->Stack()->Particle(listofprimaries[index]) ; + Int_t moduleNumber ; + Double_t primX, primZ ; + phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; + if(moduleNumberRec == moduleNumber) { + dX = recX - primX; + dZ = recZ - primZ; + distance = TMath::Sqrt(dX*dX + dZ*dZ) ; + if(minDistance > distance) { + minDistance = distance ; + dXmin = dX; + dZmin = dZ; + closestPrimary = listofprimaries[index] ; + } + } } //if found primary, fill histograms if(closestPrimary >=0 ){ - const TParticle * primary = gime->Primary(closestPrimary) ; - if(primary->GetPdgCode() == 22){ - hAllPosition->Fill(primary->Energy(), minDistance) ; - hAllPositionX->Fill(primary->Energy(), dX) ; - hAllPositionZ->Fill(primary->Energy(), dZ) ; - if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ - hPhotPosition->Fill(primary->Energy(), minDistance ) ; - hEMPosition->Fill(primary->Energy(), minDistance ) ; - } - else - if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) - hEMPosition->Fill(primary->Energy(), minDistance ) ; - } + const TParticle * primary = fRunLoader->Stack()->Particle(closestPrimary) ; + if(primary->GetPdgCode() == 22){ + hAllPosition->Fill(primary->Energy(), minDistance) ; + hAllPositionX->Fill(primary->Energy(), dX) ; + hAllPositionZ->Fill(primary->Energy(), dZ) ; + if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ + hPhotPosition->Fill(primary->Energy(), minDistance ) ; + hEMPosition->Fill(primary->Energy(), minDistance ) ; + } + else + if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) + hEMPosition->Fill(primary->Energy(), minDistance ) ; + } } } } @@ -919,14 +1030,27 @@ void AliPHOSAnalyze::Contamination(const char* RecPointsTitle){ - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),RecPointsTitle) ; + if (fRunLoader == 0x0) + { + Error("DrawRecon","Error Loading session"); + return; + } + + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("DrawRecon","Could not obtain the Loader object !"); + return ; + } + + if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader(); const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ; Int_t ievent; - Int_t maxevent = (Int_t)gAlice->TreeE()->GetEntries() ; + Int_t maxevent = (Int_t)fRunLoader->TreeE()->GetEntries() ; for ( ievent=0; ievent < maxevent ; ievent++){ - gime->Event(ievent) ; + fRunLoader->GetEvent(ievent) ; TClonesArray * rp = gime->RecParticles() ; if(!rp) { @@ -948,17 +1072,17 @@ void AliPHOSAnalyze::Contamination(const char* RecPointsTitle){ //=========== Make spectrum of the primary photons const TParticle * primary ; Int_t iPrimary ; - for( iPrimary = 0 ; iPrimary < gime->NPrimaries() ; iPrimary++){ - primary = gime->Primary(iPrimary) ; + for( iPrimary = 0 ; iPrimary < fRunLoader->Stack()->GetNprimary() ; iPrimary++){ + primary = fRunLoader->Stack()->Particle(iPrimary) ; Int_t primaryType = primary->GetPdgCode() ; if( primaryType == 22 ) { - //check, if photons folls onto PHOS - Int_t moduleNumber ; - Double_t primX, primZ ; - phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; - if(moduleNumber) - hPrimary->Fill(primary->Energy()) ; - + //check, if photons folls onto PHOS + Int_t moduleNumber ; + Double_t primX, primZ ; + phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; + if(moduleNumber) + hPrimary->Fill(primary->Energy()) ; + } } @@ -971,7 +1095,7 @@ void AliPHOSAnalyze::Contamination(const char* RecPointsTitle){ //fill histo spectrum of all RecParticles hAllRP->Fill(CorrectedEnergy(recParticle->Energy())) ; - //==========find the closest primary + //==========find the closest primary Int_t moduleNumberRec ; Double_t recX, recZ ; phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ; @@ -990,105 +1114,105 @@ void AliPHOSAnalyze::Contamination(const char* RecPointsTitle){ Double_t dXmin = 0.; Double_t dZmin = 0. ; for ( index = 0 ; index < numberofprimaries ; index++){ - primary = gime->Primary(listofprimaries[index]) ; - Int_t moduleNumber ; - Double_t primX, primZ ; - phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; - if(moduleNumberRec == moduleNumber) { - dX = recX - primX; - dZ = recZ - primZ; - distance = TMath::Sqrt(dX*dX + dZ*dZ) ; - if(minDistance > distance) { - minDistance = distance ; - dXmin = dX; - dZmin = dZ; - closestPrimary = listofprimaries[index] ; - } - } + primary = fRunLoader->Stack()->Particle(listofprimaries[index]) ; + Int_t moduleNumber ; + Double_t primX, primZ ; + phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ; + if(moduleNumberRec == moduleNumber) { + dX = recX - primX; + dZ = recZ - primZ; + distance = TMath::Sqrt(dX*dX + dZ*dZ) ; + if(minDistance > distance) { + minDistance = distance ; + dXmin = dX; + dZmin = dZ; + closestPrimary = listofprimaries[index] ; + } + } } //===========define the "type" of closest primary if(closestPrimary >=0 ){ - Int_t primaryCode = -1; - const TParticle * primary = gime->Primary(closestPrimary) ; - Int_t primaryType = primary->GetPdgCode() ; - if(primaryType == 22) // photon ? - primaryCode = 0 ; - else - if(primaryType == 2112) // neutron - primaryCode = 1 ; - else - if(primaryType == -2112) // Anti neutron - primaryCode = 2 ; - else - if(primaryType == -2122) //Anti proton - primaryCode = 4 ; - else { - TParticle tempo(*primary) ; - if(tempo.GetPDG()->Charge()) - primaryCode = 3 ; - } - - //==========Now look at the type of RecParticle - Float_t energy = CorrectedEnergy(recParticle->Energy()) ; - if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ - hPhot->Fill(energy ) ; - switch(primaryCode){ - case 0: - hPhotReg->Fill(energy ) ; - break ; - case 1: - hNReg->Fill(energy ) ; - break ; - case 2: - hNBarReg->Fill(energy ) ; - break ; - case 3: - hChargedReg->Fill(energy ) ; - break ; - case 4: - hPbarReg->Fill(energy ) ; - break ; - default: - break ; - } - } - if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| - (recParticle->GetType() == AliPHOSFastRecParticle::kCHARGEDEMFAST)|| - (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW)|| - (recParticle->GetType() == AliPHOSFastRecParticle::kCHARGEDEMSLOW) ){ //with EM shower - hShape->Fill(energy ) ; - switch(primaryCode){ - case 0: - hPhotEM->Fill(energy ) ; - break ; - case 1: - hNEM->Fill(energy ) ; - break ; - case 2: - hNBarEM->Fill(energy ) ; - break ; - case 3: - hChargedEM->Fill(energy ) ; - break ; - case 4: - hPbarEM->Fill(energy ) ; - break ; - default: - break ; - } - } - - if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| - (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALHAFAST) || - (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) || - (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALHASLOW) ) //nuetral - hVeto->Fill(energy ) ; - - //fill number of primaries identified as ... - if(primaryCode >= 0) // Primary code defined - counter[recParticle->GetType()][primaryCode]++ ; - + Int_t primaryCode = -1; + const TParticle * primary = fRunLoader->Stack()->Particle(closestPrimary) ; + Int_t primaryType = primary->GetPdgCode() ; + if(primaryType == 22) // photon ? + primaryCode = 0 ; + else + if(primaryType == 2112) // neutron + primaryCode = 1 ; + else + if(primaryType == -2112) // Anti neutron + primaryCode = 2 ; + else + if(primaryType == -2122) //Anti proton + primaryCode = 4 ; + else { + TParticle tempo(*primary) ; + if(tempo.GetPDG()->Charge()) + primaryCode = 3 ; + } + + //==========Now look at the type of RecParticle + Float_t energy = CorrectedEnergy(recParticle->Energy()) ; + if(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST){ + hPhot->Fill(energy ) ; + switch(primaryCode){ + case 0: + hPhotReg->Fill(energy ) ; + break ; + case 1: + hNReg->Fill(energy ) ; + break ; + case 2: + hNBarReg->Fill(energy ) ; + break ; + case 3: + hChargedReg->Fill(energy ) ; + break ; + case 4: + hPbarReg->Fill(energy ) ; + break ; + default: + break ; + } + } + if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| + (recParticle->GetType() == AliPHOSFastRecParticle::kCHARGEDEMFAST)|| + (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW)|| + (recParticle->GetType() == AliPHOSFastRecParticle::kCHARGEDEMSLOW) ){ //with EM shower + hShape->Fill(energy ) ; + switch(primaryCode){ + case 0: + hPhotEM->Fill(energy ) ; + break ; + case 1: + hNEM->Fill(energy ) ; + break ; + case 2: + hNBarEM->Fill(energy ) ; + break ; + case 3: + hChargedEM->Fill(energy ) ; + break ; + case 4: + hPbarEM->Fill(energy ) ; + break ; + default: + break ; + } + } + + if((recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMFAST)|| + (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALHAFAST) || + (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEMSLOW) || + (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALHASLOW) ) //nuetral + hVeto->Fill(energy ) ; + + //fill number of primaries identified as ... + if(primaryCode >= 0) // Primary code defined + counter[recParticle->GetType()][primaryCode]++ ; + } } // no closest primary found @@ -1164,6 +1288,3 @@ void AliPHOSAnalyze::Contamination(const char* RecPointsTitle){ totalInd ) ; } - - - diff --git a/PHOS/AliPHOSAnalyze.h b/PHOS/AliPHOSAnalyze.h index baa0827b81d..e08073d6f78 100644 --- a/PHOS/AliPHOSAnalyze.h +++ b/PHOS/AliPHOSAnalyze.h @@ -24,7 +24,8 @@ class TH2F ; class AliPHOSv1 ; class AliPHOSGeometry ; -class AliPHOSGetter ; +class AliPHOSLoader ; +class AliRunLoader ; class AliPHOSAnalyze : public TObject { @@ -36,8 +37,8 @@ public: virtual ~AliPHOSAnalyze() ; // dtor void DrawRecon(Int_t Nevent= 0,Int_t Nmod = 1, - const char* branchName = "PHOSRP", - const char* branchTitle = "Default") ; + const char* branchName = "PHOSRP", + const char* branchTitle = "Default") ; // draws positions of entering of primaries and reconstructed objects in PHOS void InvariantMass(const char* RecPartTitle = "Default") ; // Photons invariant mass distributions @@ -73,6 +74,7 @@ private: Int_t fEvt ; //! the evt number being processed TString ffileName ; //! the root file that contains the data + AliRunLoader* fRunLoader; //! run loader of the specified filename ClassDef(AliPHOSAnalyze,1) // PHOSv1 event analyzis algorithm diff --git a/PHOS/AliPHOSCPVDigit.h b/PHOS/AliPHOSCPVDigit.h index e05ea364d41..2986d540dc1 100644 --- a/PHOS/AliPHOSCPVDigit.h +++ b/PHOS/AliPHOSCPVDigit.h @@ -24,9 +24,9 @@ public: AliPHOSCPVDigit(Int_t x, Int_t y, Float_t q); void SetQpad(Float_t q) { fQpad = q; } - Int_t GetXpad() const { return fXpad; } - Int_t GetYpad() const { return fYpad; } - Float_t GetQpad() const { return fQpad; } + Int_t GetXpad() { return fXpad; } + Int_t GetYpad() { return fYpad; } + Float_t GetQpad() { return fQpad; } private: Int_t fXpad; // Digit's pad number in Phi diff --git a/PHOS/AliPHOSCPVGeometry.cxx b/PHOS/AliPHOSCPVGeometry.cxx index d966004924a..aa4e22a1ddd 100644 --- a/PHOS/AliPHOSCPVGeometry.cxx +++ b/PHOS/AliPHOSCPVGeometry.cxx @@ -15,6 +15,12 @@ /* $Log$ + Revision 1.3.6.1 2002/11/22 14:19:47 hristov + Merging NewIO-01 with v3-09-04 (part one) (P.Skowronski) + + Revision 1.4 2002/10/29 17:00:45 schutz + removed iostream + Revision 1.3 2001/09/26 12:09:36 schutz A new (final?) geometry developed diff --git a/PHOS/AliPHOSCalibrator.cxx b/PHOS/AliPHOSCalibrator.cxx index 1d2404c1ad1..7a49f010703 100644 --- a/PHOS/AliPHOSCalibrator.cxx +++ b/PHOS/AliPHOSCalibrator.cxx @@ -75,18 +75,17 @@ ClassImp(AliPHOSCalibrator) fConTableDBFile = "ConTableDB.root" ; } //____________________________________________________________________________ -AliPHOSCalibrator::AliPHOSCalibrator(const char* file, const char* title,Bool_t toSplit): +AliPHOSCalibrator::AliPHOSCalibrator(const char* file, const char* title): TTask("AliPHOSCalibrator",title) { //Constructor which should normally be used. //file: path/galice.root - header file //title: branch name of PHOS reconstruction (e.g. "Default") - //toSplit: wether we work in Split mode? + fRunList = new TList() ; fRunList->SetOwner() ; fRunList->Add(new TObjString(file)) ; - fToSplit = toSplit ; fNch = 0 ; fPedPat = 257 ; //Patterns for different kind of events fPulPat = 33 ; @@ -281,7 +280,7 @@ void AliPHOSCalibrator::ScanPedestals(Option_t * option ) while((file = static_cast(next()))){ if(strstr(option,"deb")) printf("Processing file %s \n ",file->String().Data()) ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(file->String().Data(),GetTitle(),fToSplit) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(file->String().Data(),GetTitle()) ; Int_t ievent ; for(ievent = 0; ieventMaxEvent() ; ievent++){ gime->Event(ievent,"D") ; @@ -396,7 +395,7 @@ void AliPHOSCalibrator::ScanGains(Option_t * option) TObjString * file ; while((file = static_cast(next()))){ - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(file->String().Data(),GetTitle(),fToSplit) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(file->String().Data(),GetTitle()) ; Int_t handled = 0; Int_t ievent ; for(ievent = 0; ieventMaxEvent() ; ievent++){ diff --git a/PHOS/AliPHOSCalibrator.h b/PHOS/AliPHOSCalibrator.h index 33bce39a7f0..a3c1218be9d 100644 --- a/PHOS/AliPHOSCalibrator.h +++ b/PHOS/AliPHOSCalibrator.h @@ -25,7 +25,7 @@ class AliPHOSCalibrator: public TTask{ public: AliPHOSCalibrator() ; // ctor - AliPHOSCalibrator(const char* run, const char * title = "Default",Bool_t toSplit = kTRUE) ; + AliPHOSCalibrator(const char* run, const char * title = "Default") ; AliPHOSCalibrator(const AliPHOSCalibrator & ctor) { // cpy ctor: no implementation yet // requested by the Coding Convention @@ -134,7 +134,6 @@ private: UShort_t fLEDPat ; //trigger pattern for LED events UShort_t fWBPat ; //trigger pattern for WIDE BEAM events UShort_t fNBPat ; //trigger pattern for NARROW BEAM events - Bool_t fToSplit ; //To split digits from header ClassDef(AliPHOSCalibrator,1) // description diff --git a/PHOS/AliPHOSClusterizer.cxx b/PHOS/AliPHOSClusterizer.cxx index 4aadfa7a031..ca6c5ace448 100644 --- a/PHOS/AliPHOSClusterizer.cxx +++ b/PHOS/AliPHOSClusterizer.cxx @@ -44,19 +44,16 @@ ClassImp(AliPHOSClusterizer) AliPHOSClusterizer::AliPHOSClusterizer():TTask("","") { // ctor - fSplitFile= 0 ; - fToSplit = kFALSE ; + fEventFolderName = "" ; } //____________________________________________________________________________ -AliPHOSClusterizer::AliPHOSClusterizer(const char* headerFile, const char* name, const Bool_t toSplit): -TTask(name, headerFile) +AliPHOSClusterizer::AliPHOSClusterizer(const TString alirunFileName, const TString eventFolderName): + TTask("PHOS"+AliConfig::fgkReconstructionerTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - fToSplit = toSplit ; - fSplitFile= 0 ; - + } //____________________________________________________________________________ @@ -64,7 +61,6 @@ AliPHOSClusterizer::~AliPHOSClusterizer() { // dtor - fSplitFile = 0 ; } diff --git a/PHOS/AliPHOSClusterizer.h b/PHOS/AliPHOSClusterizer.h index b3e85418a37..2f8ff1b8779 100644 --- a/PHOS/AliPHOSClusterizer.h +++ b/PHOS/AliPHOSClusterizer.h @@ -11,6 +11,8 @@ // --- ROOT system --- #include "TTask.h" +#include "AliConfig.h" + class TFile ; // --- Standard library --- @@ -22,13 +24,9 @@ class AliPHOSClusterizer : public TTask { public: AliPHOSClusterizer() ; // default ctor - AliPHOSClusterizer(const char * headerFile, const char * name, const Bool_t toSplit) ; - AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer) { - // copy ctor: no implementation yet - Fatal("cpy ctor", "not implemented") ; - } + AliPHOSClusterizer(const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer) { ; } virtual ~AliPHOSClusterizer() ; // dtor - virtual Float_t GetEmcClusteringThreshold()const {Warning("GetEmcClusteringThreshold", "Not Defined" ) ; return 0. ; } virtual Float_t GetEmcLocalMaxCut()const {Warning("GetEmcLocalMaxCut", "Not Defined" ) ; return 0. ; } virtual Float_t GetEmcLogWeight()const {Warning("GetEmcLogWeight", "Not Defined" ) ; return 0. ; } @@ -41,7 +39,7 @@ public: virtual const char * GetDigitsBranch() const{Warning("GetDigitsBranch", "Not Defined" ) ; return 0 ; } ; virtual void MakeClusters() {Warning("MakeClusters", "Not Defined" ) ; } - virtual void Print(Option_t * option)const {Warning("Print", "Not Defined" ) ; } + virtual void Print()const {Warning("Print", "Not Defined" ) ; } virtual void SetEmcClusteringThreshold(Float_t cluth) {Warning("SetEmcClusteringThreshold", "Not Defined" ) ; } virtual void SetEmcLocalMaxCut(Float_t cut) {Warning("SetEmcLocalMaxCut", "Not Defined" ) ; } @@ -53,19 +51,18 @@ public: virtual void SetCpvLogWeight(Float_t w) {Warning("SetCpvLogWeight", "Not Defined" ) ; } virtual void SetDigitsBranch(const char * title) {Warning("SetDigitsBranch", "Not Defined" ) ; } virtual void SetRecPointsBranch(const char *title) {Warning("SetRecPointsBranch", "Not Defined" ) ; } - virtual void SetUnfolding(Bool_t toUnfold ){Warning("SetUnfolding", "Not Defined" ) ;} - AliPHOSClusterizer & operator = (const AliPHOSClusterizer & rvalue) { - // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *this ; - } + virtual void SetUnfolding(Bool_t toUnfold ){Warning("SetUnfolding", "Not Defined" ) ;} + void SetEventFolderName(TString name) { fEventFolderName = name ; } + + AliPHOSClusterizer & operator = (const AliPHOSClusterizer & rvalue) {return *this ;} + virtual const char * Version() const {Warning("Version", "Not Defined" ) ; return 0 ; } protected: + TString fEventFolderName ; // event folder name - TFile * fSplitFile ; //! file in which RecPoints will eventually be stored - Bool_t fToSplit ; //! Should we write to splitted file - ClassDef(AliPHOSClusterizer,2) // Clusterization algorithm class + ClassDef(AliPHOSClusterizer,3) // Clusterization algorithm class } ; diff --git a/PHOS/AliPHOSClusterizerv1.cxx b/PHOS/AliPHOSClusterizerv1.cxx index 1c5d1078b42..785f6d73d0d 100644 --- a/PHOS/AliPHOSClusterizerv1.cxx +++ b/PHOS/AliPHOSClusterizerv1.cxx @@ -19,7 +19,7 @@ 1 October 2000. Yuri Kharlov: AreNeighbours() PPSD upper layer is considered if number of layers>1 - + 18 October 2000. Yuri Kharlov: AliPHOSClusterizerv1() CPV clusterizing parameters added @@ -67,18 +67,17 @@ #include "TBenchmark.h" // --- Standard library --- +//#include // --- AliRoot header files --- +#include "AliPHOSGetter.h" #include "AliPHOSClusterizerv1.h" +#include "AliPHOSEmcRecPoint.h" #include "AliPHOSCpvRecPoint.h" #include "AliPHOSDigit.h" #include "AliPHOSDigitizer.h" -#include "AliPHOSEmcRecPoint.h" #include "AliPHOS.h" -#include "AliPHOSGetter.h" -#include "AliRun.h" -#include "AliPHOSCalibrManager.h" -#include "AliPHOSCalibrationData.h" +#include "AliPHOSCalibrationDB.h" ClassImp(AliPHOSClusterizerv1) @@ -92,15 +91,14 @@ ClassImp(AliPHOSClusterizerv1) } //____________________________________________________________________________ -AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* name, const Bool_t toSplit) -:AliPHOSClusterizer(headerFile, name, toSplit) +AliPHOSClusterizerv1::AliPHOSClusterizerv1(const TString alirunFileName, const TString eventFolderName) +:AliPHOSClusterizer(alirunFileName, eventFolderName) { // ctor with the indication of the file where header Tree and digits Tree are stored InitParameters() ; Init() ; fDefaultInit = kFALSE ; - } //____________________________________________________________________________ @@ -108,130 +106,79 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* na { // dtor - delete fPedestals ; - delete fGains ; - - fSplitFile = 0 ; - + // delete fPedestals ; +// delete fGains ; } + //____________________________________________________________________________ const TString AliPHOSClusterizerv1::BranchName() const { - // Returns branch name of the AliPHOSClusterizer - - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + return GetName(); } //____________________________________________________________________________ Float_t AliPHOSClusterizerv1::Calibrate(Int_t amp, Int_t absId) const -{ - // Returns energy value in the cell absId with the digit amplitude amp - - if(fPedestals || fGains ){ //use calibration data - if(!fPedestals || !fGains ){ - Error("Calibrate","Either Pedestals of Gains not set!") ; - return 0 ; - } - Float_t en=(amp - fPedestals->Data(absId))*fGains->Data(absId) ; - if(en>0) - return en ; - else - return 0. ; - } - else{ //simulation - if(absId <= fEmcCrystals) //calibrate as EMC - return fADCpedestalEmc + amp*fADCchanelEmc ; - else //calibrate as CPV - return fADCpedestalCpv+ amp*fADCchanelCpv ; - } +{ + //To be replaced later by the method, reading individual parameters from the database + // if(fCalibrationDB) + // return fCalibrationDB->Calibrate(amp,absId) ; + // else{ //simulation + if(absId <= fEmcCrystals) //calibrate as EMC + return fADCpedestalEmc + amp*fADCchanelEmc ; + else //calibrate as CPV + return fADCpedestalCpv+ amp*fADCchanelCpv ; + // } } //____________________________________________________________________________ void AliPHOSClusterizerv1::Exec(Option_t * option) { // Steering method - if( strcmp(GetName(), "")== 0 ) - Init() ; if(strstr(option,"tim")) gBenchmark->Start("PHOSClusterizer"); if(strstr(option,"print")) - Print("") ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - if(gime->BranchExists("RecPoints")) - return ; - - //test, if this is real data: - TBranch * eh = gAlice->TreeE()->GetBranch("AliPHOSBeamTestEvent") ; - if(eh){ //Read CalibrationData - AliPHOSCalibrManager * cmngr=AliPHOSCalibrManager::GetInstance() ; - if(!cmngr){ //not defined yet - cmngr=AliPHOSCalibrManager::GetInstance("PHOSBTCalibration.root") ; - } - if(fPedestals) - delete fPedestals ; - fPedestals = new AliPHOSCalibrationData("Pedestals",fCalibrVersion) ; - cmngr->ReadFromRoot(*fPedestals,fCalibrRun) ; - if(fGains) - delete fGains ; - fGains = new AliPHOSCalibrationData("Gains",fCalibrVersion) ; - cmngr->ReadFromRoot(*fGains,fCalibrRun) ; - } + Print() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; - for(ievent = 0; ievent < nevents; ievent++){ - gime->Event(ievent,"D") ; - Int_t pattern = gime->EventPattern() ; - if(pattern){ - printf("pattern %d \n",pattern) ; - if(!fPatterns){ - Error("Exec","Patterns for reconstruction of events are not set, use SetPatterns() ") ; - return ; - } - Bool_t skip = kTRUE ; - Int_t npat = fPatterns->GetSize() ; - for(Int_t i = 0; iAt(i)){ - skip = kFALSE ; - break ; - } - if(skip) - continue ; - } + for(ievent = 0; ievent < nevents; ievent++) + { + gime->Event(ievent, "D"); + + GetCalibrationParameters() ; - if(ievent == 0) - GetCalibrationParameters() ; - fNumberOfEmcClusters = fNumberOfCpvClusters = 0 ; - - MakeClusters() ; + MakeClusters() ; + if(fToUnfold) MakeUnfolding() ; - WriteRecPoints(ievent) ; + WriteRecPoints(); if(strstr(option,"deb")) PrintRecPoints(option) ; - //increment the total number of digits per run + //increment the total number of recpoints per run fRecPointsInRun += gime->EmcRecPoints()->GetEntriesFast() ; fRecPointsInRun += gime->CpvRecPoints()->GetEntriesFast() ; - } + } + + Unload(); if(strstr(option,"tim")){ gBenchmark->Stop("PHOSClusterizer"); Info("Exec", " took %f seconds for Clusterizing %f seconds per event \n", gBenchmark->GetCpuTime("PHOSClusterizer"), gBenchmark->GetCpuTime("PHOSClusterizer")/nevents ) ; - } + } } //____________________________________________________________________________ @@ -242,8 +189,9 @@ Bool_t AliPHOSClusterizerv1::FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** // The initial values for fitting procedure are set equal to the positions of local maxima. // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - TClonesArray * digits = gime->Digits() ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance(); + TClonesArray * digits = gime->Digits(); gMinuit->mncler(); // Reset Minuit's list of paramters @@ -330,24 +278,20 @@ Bool_t AliPHOSClusterizerv1::FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** //____________________________________________________________________________ void AliPHOSClusterizerv1::GetCalibrationParameters() { - // Get calibration parameters from AliPHOSDigitizer - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - const TTask * task = gime->Digitizer(BranchName()) ; - if(strcmp(task->IsA()->GetName(),"AliPHOSDigitizer")==0){ - const AliPHOSDigitizer * dig = static_cast(task) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(); - fADCchanelEmc = dig->GetEMCchannel() ; - fADCpedestalEmc = dig->GetEMCpedestal(); - - fADCchanelCpv = dig->GetCPVchannel() ; - fADCpedestalCpv = dig->GetCPVpedestal() ; - } - else{ - ; -// fCalibrationDB = gime->CalibrationDB(); - } + if ( !gime->Digitizer() ) + gime->LoadDigitizer(); + AliPHOSDigitizer * dig = gime->Digitizer(); + + fADCchanelEmc = dig->GetEMCchannel() ; + fADCpedestalEmc = dig->GetEMCpedestal(); + + fADCchanelCpv = dig->GetCPVchannel() ; + fADCpedestalCpv = dig->GetCPVpedestal() ; + + // fCalibrationDB = gime->CalibrationDB(); } //____________________________________________________________________________ @@ -355,59 +299,23 @@ void AliPHOSClusterizerv1::Init() { // Make all memory allocations which can not be done in default constructor. // Attach the Clusterizer task to the list of PHOS tasks - - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname = GetName() ; - branchname.Remove(branchname.Index(Version())-1) ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(), fToSplit ) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !") ; - return ; - } + + AliPHOSGetter* gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()); - fSplitFile = 0 ; - if(fToSplit){ - // construct the name of the file as /path/EMCAL.SDigits.root - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } - - - - const AliPHOSGeometry * geom = gime->PHOSGeometry() ; + AliPHOSGeometry * geom = gime->PHOSGeometry(); + fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ; if(!gMinuit) - gMinuit = new TMinuit(100) ; + gMinuit = new TMinuit(100); - gime->PostClusterizer(this) ; - gime->PostRecPoints(branchname) ; - + if ( !gime->Clusterizer() ) + gime->PostClusterizer(this); } //____________________________________________________________________________ void AliPHOSClusterizerv1::InitParameters() { - // Set initial parameters for clusterization fNumberOfCpvClusters = 0 ; fNumberOfEmcClusters = 0 ; @@ -424,24 +332,9 @@ void AliPHOSClusterizerv1::InitParameters() fEmcTimeGate = 1.e-8 ; fToUnfold = kTRUE ; - - fPurifyThreshold = 0.012 ; - - fPedestals = 0 ; - fGains = 0 ; - fCalibrVersion= "v1" ; - fCalibrRun = 1 ; - fPatterns = 0 ; - - TString clusterizerName( GetName()) ; - if (clusterizerName.IsNull() ) - clusterizerName = "Default" ; - clusterizerName.Append(":") ; - clusterizerName.Append(Version()) ; - SetName(clusterizerName) ; + fRecPointsInRun = 0 ; - } //____________________________________________________________________________ @@ -454,7 +347,7 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)c // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster // which is compared to a digit (d2) not yet in a cluster - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; Int_t rv = 0 ; @@ -474,7 +367,7 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)c } else { if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) - rv = 2; // Difference in row numbers is too large to look further + rv = 2; // Difference in row numbers is too large to look further } } @@ -495,7 +388,7 @@ Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const // Tells if (true) or not (false) the digit is in a PHOS-EMC module Bool_t rv = kFALSE ; - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ(); @@ -510,7 +403,8 @@ Bool_t AliPHOSClusterizerv1::IsInCpv(AliPHOSDigit * digit) const // Tells if (true) or not (false) the digit is in a PHOS-CPV module Bool_t rv = kFALSE ; - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + + AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ(); @@ -520,65 +414,47 @@ Bool_t AliPHOSClusterizerv1::IsInCpv(AliPHOSDigit * digit) const } //____________________________________________________________________________ -void AliPHOSClusterizerv1::WriteRecPoints(Int_t event) +void AliPHOSClusterizerv1::Unload() +{ + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + gime->PhosLoader()->UnloadDigits() ; + gime->PhosLoader()->UnloadRecPoints() ; +} + +//____________________________________________________________________________ +void AliPHOSClusterizerv1::WriteRecPoints() { // Creates new branches with given title // fills and writes into TreeR. - - - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance(); + TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; TClonesArray * digits = gime->Digits() ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - TString name("TreeR") ; - name += event ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - if(!treeR){ - if(fSplitFile) - gAlice->MakeTree("R", fSplitFile); - else - gAlice->MakeTree("R", gROOT->GetFile(GetTitle())); - treeR = gAlice->TreeR() ; - } + TTree * treeR = gime->TreeR(); Int_t index ; //Evaluate position, dispersion and other RecPoint properties... - for(index = 0; index < emcRecPoints->GetEntries(); index++){ - AliPHOSEmcRecPoint * emcrp = static_cast(emcRecPoints->At(index)) ; - emcrp->Purify(fPurifyThreshold) ; - if(emcrp->GetMultiplicity()) - emcrp->EvalAll(fW0,digits) ; - else - emcRecPoints->Remove(emcrp) ; - } - - emcRecPoints->Compress() ; + for(index = 0; index < emcRecPoints->GetEntries(); index++) + dynamic_cast( emcRecPoints->At(index) )->EvalAll(fW0,digits) ; + emcRecPoints->Sort() ; for(index = 0; index < emcRecPoints->GetEntries(); index++) - ((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->SetIndexInList(index) ; + dynamic_cast( emcRecPoints->At(index) )->SetIndexInList(index) ; emcRecPoints->Expand(emcRecPoints->GetEntriesFast()) ; //Now the same for CPV for(index = 0; index < cpvRecPoints->GetEntries(); index++) - ((AliPHOSRecPoint *)cpvRecPoints->At(index))->EvalAll(fW0CPV,digits) ; + dynamic_cast( cpvRecPoints->At(index) )->EvalAll(fW0CPV,digits) ; cpvRecPoints->Sort() ; for(index = 0; index < cpvRecPoints->GetEntries(); index++) - ((AliPHOSRecPoint *)cpvRecPoints->At(index))->SetIndexInList(index) ; + dynamic_cast( cpvRecPoints->At(index) )->SetIndexInList(index) ; cpvRecPoints->Expand(cpvRecPoints->GetEntriesFast()) ; @@ -593,19 +469,11 @@ void AliPHOSClusterizerv1::WriteRecPoints(Int_t event) TBranch * cpvBranch = treeR->Branch("PHOSCpvRP","TObjArray",&cpvRecPoints,bufferSize,splitlevel); cpvBranch->SetTitle(BranchName()); - //And Finally clusterizer branch - AliPHOSClusterizerv1 * cl = this ; - TBranch * clusterizerBranch = treeR->Branch("AliPHOSClusterizer","AliPHOSClusterizerv1", - &cl,bufferSize,splitlevel); - clusterizerBranch->SetTitle(BranchName()); - emcBranch ->Fill() ; cpvBranch ->Fill() ; - clusterizerBranch->Fill() ; - - treeR->AutoSave() ; - if(gAlice->TreeR()!=treeR) - treeR->Delete(); + + gime->WriteRecPoints("OVERWRITE"); + gime->WriteClusterizer("OVERWRITE"); } //____________________________________________________________________________ @@ -614,18 +482,18 @@ void AliPHOSClusterizerv1::MakeClusters() // Steering method to construct the clusters stored in a list of Reconstructed Points // A cluster is defined as a list of neighbour digits - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance(); + + TObjArray * emcRecPoints = gime->EmcRecPoints() ; + TObjArray * cpvRecPoints = gime->CpvRecPoints() ; - TObjArray * emcRecPoints = gime->EmcRecPoints(BranchName()) ; - TObjArray * cpvRecPoints = gime->CpvRecPoints(BranchName()) ; emcRecPoints->Delete() ; cpvRecPoints->Delete() ; TClonesArray * digits = gime->Digits() ; - if ( !digits ) { - Fatal("MakeClusters", "Digits with name %s not found !", BranchName().Data() ) ; - } - TClonesArray * digitsC = (TClonesArray*)digits->Clone() ; + + TClonesArray * digitsC = static_cast( digits->Clone() ) ; // Clusterization starts @@ -634,58 +502,59 @@ void AliPHOSClusterizerv1::MakeClusters() AliPHOSDigit * digit ; Bool_t notremoved = kTRUE ; - while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digitsC + while ( (digit = dynamic_cast( nextdigit()) ) ) { // scan over the list of digitsC + + AliPHOSRecPoint * clu = 0 ; TArrayI clusterdigitslist(1500) ; Int_t index ; - // cout << "digit " << digit << " " << Calibrate(digit->GetAmp(),digit->GetId()) << endl ; if (( IsInEmc (digit) && Calibrate(digit->GetAmp(),digit->GetId()) > fEmcClusteringThreshold ) || ( IsInCpv (digit) && Calibrate(digit->GetAmp(),digit->GetId()) > fCpvClusteringThreshold ) ) { Int_t iDigitInCluster = 0 ; if ( IsInEmc(digit) ) { - // start a new EMC RecPoint - if(fNumberOfEmcClusters >= emcRecPoints->GetSize()) - emcRecPoints->Expand(2*fNumberOfEmcClusters+1) ; - - emcRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ; - clu = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters) ; - fNumberOfEmcClusters++ ; - clu->AddDigit(*digit, Calibrate(digit->GetAmp(),digit->GetId())) ; - clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; - iDigitInCluster++ ; - digitsC->Remove(digit) ; + // start a new EMC RecPoint + if(fNumberOfEmcClusters >= emcRecPoints->GetSize()) + emcRecPoints->Expand(2*fNumberOfEmcClusters+1) ; + + emcRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ; + clu = dynamic_cast( emcRecPoints->At(fNumberOfEmcClusters) ) ; + fNumberOfEmcClusters++ ; + clu->AddDigit(*digit, Calibrate(digit->GetAmp(),digit->GetId())) ; + clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; + iDigitInCluster++ ; + digitsC->Remove(digit) ; } else { - - // start a new CPV cluster - if(fNumberOfCpvClusters >= cpvRecPoints->GetSize()) - cpvRecPoints->Expand(2*fNumberOfCpvClusters+1); - - cpvRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ; - - clu = (AliPHOSCpvRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters) ; - fNumberOfCpvClusters++ ; - clu->AddDigit(*digit, Calibrate(digit->GetAmp(),digit->GetId()) ) ; - clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; - iDigitInCluster++ ; - digitsC->Remove(digit) ; + + // start a new CPV cluster + if(fNumberOfCpvClusters >= cpvRecPoints->GetSize()) + cpvRecPoints->Expand(2*fNumberOfCpvClusters+1); + + cpvRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ; + + clu = dynamic_cast( cpvRecPoints->At(fNumberOfCpvClusters) ) ; + fNumberOfCpvClusters++ ; + clu->AddDigit(*digit, Calibrate(digit->GetAmp(),digit->GetId()) ) ; + clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; + iDigitInCluster++ ; + digitsC->Remove(digit) ; nextdigit.Reset() ; - - // Here we remove remaining EMC digits, which cannot make a cluster - + + // Here we remove remaining EMC digits, which cannot make a cluster + if( notremoved ) { - while( ( digit = (AliPHOSDigit *)nextdigit() ) ) { + while( ( digit = dynamic_cast( nextdigit() ) ) ) { if( IsInEmc(digit) ) - digitsC->Remove(digit) ; + digitsC->Remove(digit) ; else - break ; - } - notremoved = kFALSE ; - } - + break ; + } + notremoved = kFALSE ; + } + } // else nextdigit.Reset() ; @@ -693,28 +562,28 @@ void AliPHOSClusterizerv1::MakeClusters() AliPHOSDigit * digitN ; index = 0 ; while (index < iDigitInCluster){ // scan over digits already in cluster - digit = (AliPHOSDigit*)digits->At(clusterdigitslist[index]) ; - index++ ; - while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits - Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! + digit = dynamic_cast( digits->At(clusterdigitslist[index]) ) ; + index++ ; + while ( (digitN = dynamic_cast( nextdigit() ) ) ) { // scan over the reduced list of digits + Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! switch (ineb ) { case 0 : // not a neighbour - break ; - case 1 : // are neighbours - clu->AddDigit(*digitN, Calibrate( digitN->GetAmp(), digitN->GetId() ) ) ; - clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ; - iDigitInCluster++ ; - digitsC->Remove(digitN) ; - break ; + break ; + case 1 : // are neighbours + clu->AddDigit(*digitN, Calibrate( digitN->GetAmp(), digitN->GetId() ) ) ; + clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ; + iDigitInCluster++ ; + digitsC->Remove(digitN) ; + break ; case 2 : // too far from each other - goto endofloop; - } // switch - - } // while digitN - + goto endofloop; + } // switch + + } // while digitN + endofloop: ; - nextdigit.Reset() ; - + nextdigit.Reset() ; + } // loop over cluster } // energy theshold @@ -732,12 +601,12 @@ void AliPHOSClusterizerv1::MakeUnfolding() // Unfolds clusters using the shape of an ElectroMagnetic shower // Performs unfolding of all EMC/CPV clusters - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - + AliPHOSGetter * gime = AliPHOSGetter::Instance(); const AliPHOSGeometry * geom = gime->PHOSGeometry() ; - TObjArray * emcRecPoints = gime->EmcRecPoints(BranchName()) ; - TObjArray * cpvRecPoints = gime->CpvRecPoints(BranchName()) ; + + TObjArray * emcRecPoints = gime->EmcRecPoints() ; + TObjArray * cpvRecPoints = gime->CpvRecPoints() ; TClonesArray * digits = gime->Digits() ; // Unfold first EMC clusters @@ -749,9 +618,9 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t index ; for(index = 0 ; index < numberofNotUnfolded ; index++){ - AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint *) emcRecPoints->At(index) ; + AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast( emcRecPoints->At(index) ) ; if(emcRecPoint->GetPHOSMod()> nModulesToUnfold) - break ; + break ; Int_t nMultipl = emcRecPoint->GetMultiplicity() ; AliPHOSDigit ** maxAt = new AliPHOSDigit*[nMultipl] ; @@ -759,17 +628,13 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,digits) ; if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0 - UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ; - if(emcRecPoint->GetNExMax()!=-1){ //Do not remove clusters which failed to unfold - emcRecPoints->Remove(emcRecPoint); - emcRecPoints->Compress() ; - index-- ; - fNumberOfEmcClusters -- ; - numberofNotUnfolded-- ; - } + UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ; + emcRecPoints->Remove(emcRecPoint); + emcRecPoints->Compress() ; + index-- ; + fNumberOfEmcClusters -- ; + numberofNotUnfolded-- ; } - else - emcRecPoint->SetNExMax(1) ; //Only one local maximum delete[] maxAt ; delete[] maxAtEnergy ; @@ -787,12 +652,12 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t index ; for(index = 0 ; index < numberofCpvNotUnfolded ; index++){ - AliPHOSRecPoint * recPoint = (AliPHOSRecPoint *) cpvRecPoints->At(index) ; + AliPHOSRecPoint * recPoint = dynamic_cast( cpvRecPoints->At(index) ) ; if(recPoint->GetPHOSMod()> nModulesToUnfold) - break ; + break ; - AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint*) recPoint ; + AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast(recPoint) ; Int_t nMultipl = emcRecPoint->GetMultiplicity() ; AliPHOSDigit ** maxAt = new AliPHOSDigit*[nMultipl] ; @@ -800,12 +665,12 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,digits) ; if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0 - UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ; - cpvRecPoints->Remove(emcRecPoint); - cpvRecPoints->Compress() ; - index-- ; - numberofCpvNotUnfolded-- ; - fNumberOfCpvClusters-- ; + UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ; + cpvRecPoints->Remove(emcRecPoint); + cpvRecPoints->Compress() ; + index-- ; + numberofCpvNotUnfolded-- ; + fNumberOfCpvClusters-- ; } delete[] maxAt ; @@ -830,15 +695,16 @@ Double_t AliPHOSClusterizerv1::ShowerShape(Double_t r) //____________________________________________________________________________ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, - Int_t nMax, - AliPHOSDigit ** maxAt, - Float_t * maxAtEnergy) + Int_t nMax, + AliPHOSDigit ** maxAt, + Float_t * maxAtEnergy) { // Performs the unfolding of a cluster with nMax overlapping showers - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(); const AliPHOSGeometry * geom = gime->PHOSGeometry() ; + const TClonesArray * digits = gime->Digits() ; TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; @@ -848,8 +714,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ; if( !rv ) { - // Fit failed, return - iniEmc->SetNExMax(-1) ; + // Fit failed, return and remove cluster delete[] fitparameters ; return ; } @@ -869,7 +734,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, Int_t iparam ; Int_t iDigit ; for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){ - digit = (AliPHOSDigit*) digits->At(emcDigits[iDigit] ) ; + digit = dynamic_cast( digits->At(emcDigits[iDigit] ) ) ; geom->AbsToRelNumbering(digit->GetId(), relid) ; geom->RelPosInModule(relid, xDigit, zDigit) ; efit[iDigit] = 0; @@ -906,25 +771,24 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, if(iniEmc->IsEmc()){ //create new entries in fEmcRecPoints... if(fNumberOfEmcClusters >= emcRecPoints->GetSize()) - emcRecPoints->Expand(2*fNumberOfEmcClusters) ; + emcRecPoints->Expand(2*fNumberOfEmcClusters) ; (*emcRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint("") ; - emcRP = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters); + emcRP = dynamic_cast( emcRecPoints->At(fNumberOfEmcClusters) ) ; fNumberOfEmcClusters++ ; - emcRP->SetNExMax((Int_t)nPar/3) ; } else{//create new entries in fCpvRecPoints if(fNumberOfCpvClusters >= cpvRecPoints->GetSize()) - cpvRecPoints->Expand(2*fNumberOfCpvClusters) ; + cpvRecPoints->Expand(2*fNumberOfCpvClusters) ; (*cpvRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint("") ; - emcRP = (AliPHOSEmcRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters); + emcRP = dynamic_cast( cpvRecPoints->At(fNumberOfCpvClusters) ) ; fNumberOfCpvClusters++ ; } Float_t eDigit ; for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){ - digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ; + digit = dynamic_cast( digits->At( emcDigits[iDigit] ) ) ; geom->AbsToRelNumbering(digit->GetId(), relid) ; geom->RelPosInModule(relid, xDigit, zDigit) ; distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ; @@ -932,7 +796,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, ratio = epar * ShowerShape(distance) / efit[iDigit] ; eDigit = emcEnergies[iDigit] * ratio ; emcRP->AddDigit( *digit, eDigit ) ; - } + } } delete[] fitparameters ; @@ -946,22 +810,22 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou // Calculates the Chi square for the cluster unfolding minimization // Number of parameters, Gradient, Chi squared, parameters, what to do - TList * toMinuit = (TList*) gMinuit->GetObjectFit() ; + TList * toMinuit = dynamic_cast( gMinuit->GetObjectFit() ) ; - AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint*) toMinuit->At(0) ; - TClonesArray * digits = (TClonesArray*)toMinuit->At(1) ; + AliPHOSEmcRecPoint * emcRP = dynamic_cast( toMinuit->At(0) ) ; + TClonesArray * digits = dynamic_cast( toMinuit->At(1) ) ; - // AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint *) gMinuit->GetObjectFit() ; // EmcRecPoint to fit + // AliPHOSEmcRecPoint * emcRP = dynamic_cast( gMinuit->GetObjectFit() ) ; // EmcRecPoint to fit Int_t * emcDigits = emcRP->GetDigitsList() ; Int_t nOdigits = emcRP->GetDigitsMultiplicity() ; Float_t * emcEnergies = emcRP->GetEnergiesList() ; - - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + + const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; fret = 0. ; Int_t iparam ; @@ -976,7 +840,7 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou for( iDigit = 0 ; iDigit < nOdigits ; iDigit++) { - digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ; + digit = dynamic_cast( digits->At( emcDigits[iDigit] ) ); Int_t relid[4] ; Float_t xDigit ; @@ -990,36 +854,33 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou Int_t iParam = 0 ; efit = 0 ; while(iParam < nPar ){ - Double_t distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ; - iParam++ ; - distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ; - distance = TMath::Sqrt( distance ) ; - iParam++ ; - efit += x[iParam] * ShowerShape(distance) ; - iParam++ ; + Double_t distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ; + iParam++ ; + distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ; + distance = TMath::Sqrt( distance ) ; + iParam++ ; + efit += x[iParam] * ShowerShape(distance) ; + iParam++ ; } - Double_t sum=0 ; - if(emcEnergies[iDigit] > 0) - sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; - // Here we assume, that sigma = sqrt(E) + Double_t sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E) iParam = 0 ; while(iParam < nPar ){ - Double_t xpar = x[iParam] ; - Double_t zpar = x[iParam+1] ; - Double_t epar = x[iParam+2] ; - Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ); - Double_t shape = sum * ShowerShape(dr) ; - Double_t r4 = dr*dr*dr*dr ; - Double_t r295 = TMath::Power(dr,2.95) ; - Double_t deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) + - 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ; - - Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x - iParam++ ; - Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z - iParam++ ; - Grad[iParam] += shape ; // Derivative over energy - iParam++ ; + Double_t xpar = x[iParam] ; + Double_t zpar = x[iParam+1] ; + Double_t epar = x[iParam+2] ; + Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ); + Double_t shape = sum * ShowerShape(dr) ; + Double_t r4 = dr*dr*dr*dr ; + Double_t r295 = TMath::Power(dr,2.95) ; + Double_t deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) + + 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ; + + Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x + iParam++ ; + Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z + iParam++ ; + Grad[iParam] += shape ; // Derivative over energy + iParam++ ; } } efit = 0; @@ -1035,16 +896,14 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou efit += epar * ShowerShape(distance) ; } - if(emcEnergies[iDigit] > 0) //for the case if rounding error - fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/ - emcEnergies[iDigit] ; + fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E) } } //____________________________________________________________________________ -void AliPHOSClusterizerv1::Print(Option_t * option)const +void AliPHOSClusterizerv1::Print()const { // Print clusterizer parameters @@ -1092,20 +951,29 @@ void AliPHOSClusterizerv1::PrintRecPoints(Option_t * option) { // Prints list of RecPoints produced at the current pass of AliPHOSClusterizer - TObjArray * emcRecPoints = AliPHOSGetter::GetInstance()->EmcRecPoints(BranchName()) ; - TObjArray * cpvRecPoints = AliPHOSGetter::GetInstance()->CpvRecPoints(BranchName()) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(); + + TObjArray * emcRecPoints = gime->EmcRecPoints() ; + TObjArray * cpvRecPoints = gime->CpvRecPoints() ; - if(strstr(option,"deb")){ - printf("event %d, found %d EmcRecPoints and %d CPV RecPoints \n", - gAlice->GetEvNumber(), - emcRecPoints->GetEntriesFast(), - cpvRecPoints->GetEntriesFast()) ; - } - + + TString message ; + message = "\nevent " ; + message += gAlice->GetEvNumber() ; + message += "\n Found " ; + message += emcRecPoints->GetEntriesFast() ; + message += " EMC RecPoints and " ; + message += cpvRecPoints->GetEntriesFast() ; + message += " CPV RecPoints \n" ; + + fRecPointsInRun += emcRecPoints->GetEntriesFast() ; + fRecPointsInRun += cpvRecPoints->GetEntriesFast() ; + + char * tempo = new char[8192]; if(strstr(option,"all")) { - printf("\nEMC clusters\n" ); - printf("Index Ene(MeV) Multi Module X Y Z Lambda 1 Lambda 2 # of prim Primaries list\n" ); + message += "\nEMC clusters\n" ; + message += "Index Ene(MeV) Multi Module X Y Z Lambda 1 Lambda 2 # of prim Primaries list\n" ; Int_t index ; for (index = 0 ; index < emcRecPoints->GetEntries() ; index++) { AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )emcRecPoints->At(index) ; @@ -1116,19 +984,20 @@ void AliPHOSClusterizerv1::PrintRecPoints(Option_t * option) Int_t * primaries; Int_t nprimaries; primaries = rp->GetPrimaries(nprimaries); - printf("\n%6d %8.2f %3d %2d %4.1f %4.1f %4.1f %4f %4f %2d : ", + sprintf(tempo, "\n%6d %8.2f %3d %2d %4.1f %4.1f %4.1f %4f %4f %2d : ", rp->GetIndexInList(), rp->GetEnergy(), rp->GetMultiplicity(), rp->GetPHOSMod(), locpos.X(), locpos.Y(), locpos.Z(), lambda[0], lambda[1], nprimaries) ; + message += tempo ; for (Int_t iprimary=0; iprimaryGetEntries() ; index++) { - AliPHOSRecPoint * rp = (AliPHOSRecPoint * )cpvRecPoints->At(index) ; + + //Now plot CPV recPoints + message += "Index Ene(MeV) Module X Y Z # of prim Primaries list\n" ; + for (index = 0 ; index < cpvRecPoints->GetEntries() ; index++) { + AliPHOSRecPoint * rp = (AliPHOSRecPoint * )cpvRecPoints->At(index) ; TVector3 locpos; rp->GetLocalPosition(locpos); @@ -1136,14 +1005,19 @@ void AliPHOSClusterizerv1::PrintRecPoints(Option_t * option) Int_t * primaries; Int_t nprimaries ; primaries = rp->GetPrimaries(nprimaries); - printf("\n%6d %8.2f %2d %4.1f %4.1f %4.1f %2d : ", + sprintf(tempo, "\n%6d %8.2f %2d %4.1f %4.1f %4.1f %2d : ", rp->GetIndexInList(), rp->GetEnergy(), rp->GetPHOSMod(), locpos.X(), locpos.Y(), locpos.Z(), nprimaries) ; + message += tempo ; primaries = rp->GetPrimaries(nprimaries); for (Int_t iprimary=0; iprimaryEmcRecPoints()->GetEntries(); numb[1] = gime->CpvRecPoints()->GetEntries(); } +//____________________________________________________________________________ void AliPHOSClusterizerv2::Exec(Option_t* option) { // Steering method @@ -62,29 +71,23 @@ void AliPHOSClusterizerv2::Exec(Option_t* option) gBenchmark->Start("PHOSClusterizer"); if(strstr(option,"print")) - Print("") ; + Print() ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; - TFolder* storage = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS")); - TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS"); + TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder(); TObjArray* wPool = new TObjArray(400); wPool->SetName("SmartPoints"); wPoolF->Add(wPool); wPoolF->Add(this); - Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; for(ievent = 0; ieventGetEvent(ievent) ; - gAlice->SetEvent(ievent) ; - gime->Event(ievent,"D") ; -// if(!ReadDigits(ievent)) //reads digits for event fEvent -// continue; Info("Exec", "MakeClusters invoked..") ; MakeClusters() ; @@ -103,7 +106,7 @@ void AliPHOSClusterizerv2::Exec(Option_t* option) Int_t iPoint; //loop variable for(iPoint=0; iPointCpvRecPoints()->GetEntriesFast(); iPoint++) { - rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::kCpv); + rp = new AliPHOSEvalRecPoint(iPoint, kTRUE); rp->MakeJob(); } @@ -136,7 +139,7 @@ void AliPHOSClusterizerv2::Exec(Option_t* option) wPoolF->Add(recEmc); for(iPoint=0; iPointEmcRecPoints()->GetEntriesFast(); iPoint++) { - rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::kEmc); + rp = new AliPHOSEvalRecPoint(iPoint, kFALSE); rp->MakeJob(); } @@ -171,7 +174,7 @@ void AliPHOSClusterizerv2::Exec(Option_t* option) nOldEmc, gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ) ; - WriteRecPoints(ievent); + WriteRecPoints(); } // loop over events @@ -181,7 +184,8 @@ void AliPHOSClusterizerv2::Exec(Option_t* option) Info("Exec","took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") ) ; } } -//--------------------------------------------------------------------------------- + +//____________________________________________________________________________ Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const { // Points are neighbours if they have common edge. @@ -195,7 +199,7 @@ Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) co // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster // which is compared to a digit (d2) not yet in a cluster - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry(); + const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry(); Int_t rv = 0 ; diff --git a/PHOS/AliPHOSClusterizerv2.h b/PHOS/AliPHOSClusterizerv2.h index 95f43f3a0bc..1a00da35e3e 100644 --- a/PHOS/AliPHOSClusterizerv2.h +++ b/PHOS/AliPHOSClusterizerv2.h @@ -9,13 +9,19 @@ class AliPHOSClusterizerv2 : public AliPHOSClusterizerv1 { public: AliPHOSClusterizerv2(); - AliPHOSClusterizerv2(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE) ; + AliPHOSClusterizerv2(const char * headerFile, const char * name = "Default") ; + AliPHOSClusterizerv2(const AliPHOSClusterizerv2 & clu) ; ~AliPHOSClusterizerv2() {} Int_t AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const ; void GetNumberOfClustersFound(int* numb ) const; void Exec(Option_t* option); + AliPHOSClusterizerv2 & operator = (const AliPHOSClusterizerv2 & rvalue) { + // assignement operator requested by coding convention but not needed + Fatal("operator =", "not implemented") ; + return *this ; + } ClassDef(AliPHOSClusterizerv2,1) }; diff --git a/PHOS/AliPHOSCpvRecPoint.cxx b/PHOS/AliPHOSCpvRecPoint.cxx index 0aa12cb5cb7..3d37dafc3ba 100644 --- a/PHOS/AliPHOSCpvRecPoint.cxx +++ b/PHOS/AliPHOSCpvRecPoint.cxx @@ -34,7 +34,7 @@ // --- AliRoot header files --- #include "AliPHOSCpvRecPoint.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" ClassImp(AliPHOSCpvRecPoint) //____________________________________________________________________________ @@ -68,8 +68,7 @@ Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * d Bool_t aren = kFALSE ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t relid1[4] ; phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; @@ -142,7 +141,7 @@ void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const // // static Int_t pxold, pyold; -// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; +// AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ; // static TGraph * digitgraph = 0 ; @@ -259,9 +258,8 @@ void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digi AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); - + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); + Int_t iDigit; for(iDigit=0; iDigitPHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); const Int_t kMaxLeng=20; Int_t idX[kMaxLeng], idZ[kMaxLeng]; diff --git a/PHOS/AliPHOSCpvRecPoint.h b/PHOS/AliPHOSCpvRecPoint.h index 1472df21033..2b14c918283 100644 --- a/PHOS/AliPHOSCpvRecPoint.h +++ b/PHOS/AliPHOSCpvRecPoint.h @@ -31,8 +31,9 @@ public: AliPHOSCpvRecPoint() ; AliPHOSCpvRecPoint(const char * opt) ; AliPHOSCpvRecPoint(const AliPHOSCpvRecPoint & rp) { - // cpy ctor requested by Coding Convention but not yet needed - Fatal("cpy ctor", "not implemented") ; + // cpy ctor requested by Coding Convention + // but not yet needed + assert(0==1) ; } virtual ~AliPHOSCpvRecPoint() ; @@ -52,7 +53,8 @@ public: AliPHOSCpvRecPoint & operator = (const AliPHOSCpvRecPoint & rvalue) { // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *this ; + assert(0==1) ; + return *this ; } protected: diff --git a/PHOS/AliPHOSDebug.cxx b/PHOS/AliPHOSDebug.cxx index 1d11b46ec4a..e458cec01a0 100644 --- a/PHOS/AliPHOSDebug.cxx +++ b/PHOS/AliPHOSDebug.cxx @@ -53,6 +53,7 @@ #include "AliPHOSReconstructioner.h" #include "AliRun.h" #include "AliConst.h" +#include "AliMC.h" ClassImp(AliPHOSv1) @@ -227,8 +228,13 @@ void AliPHOSv1::Hits2SDigits() for (itrack=0; itrackGetNtrack(); itrack++){ //=========== Get the Hits Tree for the Primary track itrack - gAlice->ResetHits(); - gAlice->TreeH()->GetEvent(itrack); + gAlice->ResetHits(); + if (TreeH() == 0x0) + { + Error("Hits2SDigits","Can not find TreeH in the folder"); + return; + } + TreeH()->GetEvent(itrack); for ( i = 0 ; i < fHits->GetEntries() ; i++ ) { diff --git a/PHOS/AliPHOSDebug.h b/PHOS/AliPHOSDebug.h index 6e47f971e19..f5708ccb9a2 100644 --- a/PHOS/AliPHOSDebug.h +++ b/PHOS/AliPHOSDebug.h @@ -33,7 +33,7 @@ public: AliPHOSv1(const AliPHOSv1 & phos) { // cpy ctor: no implementation yet // requested by the Coding Convention - Fatal("cpy ctor", "not implemented") ; + assert(0==1) ; } virtual ~AliPHOSv1(void) ; @@ -67,7 +67,7 @@ public: AliPHOSv1 & operator = (const AliPHOSv1 & rvalue) { // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *this ; + assert(0==1) ; return *this ; } diff --git a/PHOS/AliPHOSDigit.cxx b/PHOS/AliPHOSDigit.cxx index 77e35c29bbe..5c420613a21 100644 --- a/PHOS/AliPHOSDigit.cxx +++ b/PHOS/AliPHOSDigit.cxx @@ -26,6 +26,8 @@ // --- ROOT system --- +#include "TMath.h" + // --- Standard library --- // --- AliRoot header files --- @@ -33,6 +35,8 @@ #include "AliPHOSDigit.h" + + ClassImp(AliPHOSDigit) //____________________________________________________________________________ @@ -42,7 +46,8 @@ ClassImp(AliPHOSDigit) fIndexInList = -1 ; fNprimary = 0 ; - fNMaxPrimary = 5 ; + fNMaxPrimary = 5 ; + fPrimary = 0; } //____________________________________________________________________________ @@ -55,6 +60,7 @@ AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t digEnergy, Float_t tim fTime = time ; fId = id ; fIndexInList = index ; + fPrimary = new Int_t[fNMaxPrimary] ; if( primary != -1){ fNprimary = 1 ; fPrimary[0] = primary ; @@ -75,6 +81,7 @@ AliPHOSDigit::AliPHOSDigit(const AliPHOSDigit & digit) fNMaxPrimary = digit.fNMaxPrimary ; + fPrimary = new Int_t[fNMaxPrimary] ; Int_t i ; for ( i = 0; i < fNMaxPrimary ; i++) fPrimary[i] = digit.fPrimary[i] ; @@ -89,7 +96,7 @@ AliPHOSDigit::AliPHOSDigit(const AliPHOSDigit & digit) AliPHOSDigit::~AliPHOSDigit() { // Delete array of primiries if any - + delete [] fPrimary ; } //____________________________________________________________________________ @@ -158,61 +165,41 @@ AliPHOSDigit& AliPHOSDigit::operator+(AliPHOSDigit const & digit) // Adds the amplitude of digits and completes the list of primary particles // if amplitude is larger than - Int_t toAdd = fNprimary ; - if(digit.fNprimary>0){ - if(fAmp < digit.fAmp){//most energetic primary in second digit => first primaries in list from second digit - for (Int_t index = 0 ; index < digit.fNprimary ; index++){ - for (Int_t old = 0 ; old < fNprimary ; old++) { //already have this primary? - if(fPrimary[old] == (digit.fPrimary)[index]){ - fPrimary[old] = -1 ; //removed - toAdd-- ; - break ; - } - } - } - Int_t nNewPrimaries = digit.fNprimary+toAdd ; - if(nNewPrimaries >fNMaxPrimary) //Do not change primary list - Error("Operator +", "Increase NMaxPrimary") ; - else{ - for(Int_t index = fNprimary-1 ; index >=0 ; index--){ //move old primaries - if(fPrimary[index]>-1){ - toAdd-- ; - fPrimary[fNprimary+toAdd]=fPrimary[index] ; - } - } - //copy new primaries - for(Int_t index = 0; index < digit.fNprimary ; index++){ - fPrimary[index] = (digit.fPrimary)[index] ; - } - fNprimary = nNewPrimaries ; - } + fAmp += digit.fAmp ; + if(fTime > digit.fTime) + fTime = digit.fTime ; + + Int_t max1 = fNprimary ; + + Int_t index ; + for (index = 0 ; index < digit.fNprimary ; index++){ + Bool_t deja = kTRUE ; + Int_t old ; + for ( old = 0 ; (old < max1) && deja; old++) { //already have this primary? + if(fPrimary[old] == (digit.fPrimary)[index]) + deja = kFALSE; } - else{ //add new primaries to the end - for(Int_t index = 0 ; index < digit.fNprimary ; index++){ - Bool_t deja = kTRUE ; - for(Int_t old = 0 ; old < fNprimary; old++) { //already have this primary? - if(fPrimary[old] == (digit.fPrimary)[index]){ - deja = kFALSE; - break ; - } - } - if(deja){ - fPrimary[fNprimary] = (digit.fPrimary)[index] ; - fNprimary++ ; - if(fNprimary>fNMaxPrimary) { - Error("Operator +", "Increase NMaxPrimary") ; - break ; - } - } + if(deja){ + fPrimary[fNprimary] = (digit.fPrimary)[index] ; + fNprimary++ ; + if(fNprimary>fNMaxPrimary) { + Error("Operator +", "Increase NMaxPrimary") ; + return *this ; } - } } - fAmp += digit.fAmp ; - if(fTime > digit.fTime) - fTime = digit.fTime ; + return *this ; +} + +//____________________________________________________________________________ +AliPHOSDigit& AliPHOSDigit::operator*(Float_t factor) +{ + // Multiplies the amplitude by a factor + Float_t tempo = static_cast(fAmp) ; + tempo *= factor ; + fAmp = static_cast(TMath::Ceil(tempo)) ; return *this ; } diff --git a/PHOS/AliPHOSDigit.h b/PHOS/AliPHOSDigit.h index 491918abec1..eb4e702e7dd 100644 --- a/PHOS/AliPHOSDigit.h +++ b/PHOS/AliPHOSDigit.h @@ -38,31 +38,26 @@ class AliPHOSDigit : public AliDigitNew { Bool_t operator==(const AliPHOSDigit &rValue) const; AliPHOSDigit& operator+(AliPHOSDigit const &rValue) ; - + AliPHOSDigit& operator*(Float_t factor) ; + Int_t Compare(const TObject * obj) const ; - Int_t GetNprimary() const { - // returns the number of primaries - return fNprimary ; } + Int_t GetNprimary() const { return fNprimary ; } Int_t GetPrimary(Int_t index) const ; Float_t GetTime(void) const {return fTime ;} - Bool_t IsSortable() const { - // says that AliPHOSDigits are sortable (needed for Sort method - return kTRUE ; } + Bool_t IsSortable() const { return kTRUE ; } void Print(Option_t *option) const; - void SetAmp(Int_t Amp) { - // sets the amplitude data member - fAmp=Amp ; } - void SetTime(Float_t Time) {fTime = Time ;} - void ShiftPrimary(Int_t shift); // shift to separate different TreeK in merging + void SetAmp(Int_t Amp) { fAmp=Amp ; } + void SetTime(Float_t Time) {fTime = Time ;} + void ShiftPrimary(Int_t shift); // shift to separate different TreeK in merging private: - Int_t fNprimary ; // Number of primaries - Int_t fNMaxPrimary ; //! Max Number of primaries - Int_t fPrimary[5] ; // Array of primaries - Float_t fTime ; // Calculcated time + Int_t fNprimary ; // Number of primaries + Int_t fNMaxPrimary ; //! Max Number of primaries + Int_t * fPrimary ; //[fNMaxPrimary] Array of primaries + Float_t fTime ; // Calculcated time - ClassDef(AliPHOSDigit,1) // Digit in PHOS + ClassDef(AliPHOSDigit,2) // Digit in PHOS } ; diff --git a/PHOS/AliPHOSDigitizer.cxx b/PHOS/AliPHOSDigitizer.cxx index bd9b8ddab49..1ae4977be96 100644 --- a/PHOS/AliPHOSDigitizer.cxx +++ b/PHOS/AliPHOSDigitizer.cxx @@ -15,6 +15,7 @@ /* $Id$ */ + //_________________________________________________________________________ //*-- Author : Dmitri Peressounko (SUBATECH & Kurchatov Institute) ////////////////////////////////////////////////////////////////////////////// @@ -83,54 +84,76 @@ ClassImp(AliPHOSDigitizer) //____________________________________________________________________________ - AliPHOSDigitizer::AliPHOSDigitizer() + AliPHOSDigitizer::AliPHOSDigitizer():AliDigitizer("",""), + fInput(0), + fInputFileNames(0x0), + fEventNames(0x0) { // ctor InitParameters() ; fDefaultInit = kTRUE ; fManager = 0 ; // We work in the standalong mode - - } + fEventFolderName = "" ; +} //____________________________________________________________________________ -AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile, const char * name, const Bool_t toSplit) +AliPHOSDigitizer::AliPHOSDigitizer(const TString alirunFileName, const TString eventFolderName): + AliDigitizer("PHOS"+AliConfig::fgkDigitizerTaskName, alirunFileName), + fInputFileNames(0), fEventNames(0), fEventFolderName(eventFolderName) { // ctor - SetTitle(headerFile) ; - SetName(name) ; - fManager = 0 ; // We work in the standalong mode - fSplitFile= 0 ; InitParameters() ; - fToSplit = toSplit ; Init() ; fDefaultInit = kFALSE ; + fManager = 0 ; // We work in the standalong mode +} + +//____________________________________________________________________________ +AliPHOSDigitizer::AliPHOSDigitizer(const AliPHOSDigitizer & d) +{ + // copyy ctor + + SetName(d.GetName()) ; + SetTitle(d.GetTitle()) ; + fPinNoise = d.fPinNoise ; + fEMCDigitThreshold = d.fEMCDigitThreshold ; + fCPVNoise = d.fCPVNoise ; + fCPVDigitThreshold = d.fCPVDigitThreshold ; + fTimeResolution = d.fTimeResolution ; + fTimeThreshold = d.fTimeThreshold ; + fTimeSignalLength = d.fTimeSignalLength ; + fADCchanelEmc = d.fADCchanelEmc ; + fADCpedestalEmc = d.fADCpedestalEmc ; + fNADCemc = d.fNADCemc ; + fADCchanelCpv = d.fADCchanelCpv ; + fADCpedestalCpv = d.fADCpedestalCpv ; + fNADCcpv = d.fNADCcpv ; + fEventFolderName = d.fEventFolderName; } //____________________________________________________________________________ -AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard):AliDigitizer(ard) +AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd): + AliDigitizer(rd,"PHOS"+AliConfig::fgkDigitizerTaskName), + fEventFolderName(0) { // ctor - SetTitle(ard->GetInputFileName(0,0)) ; + fManager = rd ; + SetName(fManager->GetInputFolderName(0)) ; + // take title as name of stream 0 + SetTitle(dynamic_cast(fManager->GetInputStream(0))->GetFileName(0)); InitParameters() ; + Init() ; fDefaultInit = kFALSE ; - fSplitFile = 0 ; - - if (ard->GetOutputFile()) { - SetName(ard->GetOutputFile().Data()); - fToSplit = kTRUE ; - } else { - SetName("Default") ; - fToSplit = kFALSE ; - } } //____________________________________________________________________________ AliPHOSDigitizer::~AliPHOSDigitizer() { // dtor - - fSplitFile = 0 ; + delete [] fInputFileNames ; + delete [] fEventNames ; + } //____________________________________________________________________________ @@ -144,9 +167,8 @@ void AliPHOSDigitizer::Digitize(const Int_t event) // This design avoids scanning over the list of digits to add // contribution to new SDigits only. - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - TClonesArray * digits = gime->Digits(GetName()) ; - + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; + TClonesArray * digits = gime->Digits() ; digits->Clear() ; const AliPHOSGeometry *geom = gime->PHOSGeometry() ; @@ -155,78 +177,73 @@ void AliPHOSDigitizer::Digitize(const Int_t event) Int_t nCPV ; Int_t absID ; - TString name = geom->GetName() ; - nCPV = nEMC + geom->GetNumberOfCPVPadsZ()*geom->GetNumberOfCPVPadsPhi()* - geom->GetNModules() ; - + nCPV = nEMC + geom->GetNumberOfCPVPadsZ() * geom->GetNumberOfCPVPadsPhi() * geom->GetNModules() ; + digits->Expand(nCPV) ; - // get first the sdigitizer from the tasks list (must have same name as the digitizer) - const AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(GetName()); - if ( !sDigitizer) { - Fatal("Digitize", "SDigitizer with name %s not found", GetName() ) ; - } - - // loop through the sdigits posted to the White Board and add them to the noise - TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ; - TIter next(folderslist) ; - TFolder * folder = 0 ; - TClonesArray * sdigits = 0 ; - Int_t input = 0 ; - TObjArray * sdigArray = new TObjArray(2) ; - while ( (folder = (TFolder*)next()) ) { - if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) { - TString fileName(folder->GetName()) ; - fileName.ReplaceAll("_","/") ; -// Info("Digitize", "Adding SDigits %s from %s", GetName(), fileName() ) ; - sdigArray->AddAt(sdigits, input) ; - input++ ; - } + // get first the sdigitizer from the tasks list + if ( !gime->SDigitizer() ) + gime->LoadSDigitizer(); + AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(); + + if ( !sDigitizer ) + Fatal("Digitize", "SDigitizer with name %s %s not found", fEventFolderName.Data(), GetTitle() ) ; + + //take all the inputs to add together and load the SDigits + TObjArray * sdigArray = new TObjArray(fInput) ; + sdigArray->AddAt(gime->SDigits(), 0) ; + Int_t i ; + for(i = 1 ; i < fInput ; i++){ + TString tempo(fEventNames[i]) ; + tempo += i ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ; + gime->Event(event,"S"); + sdigArray->AddAt(gime->SDigits(), i) ; } //Find the first crystall with signal Int_t nextSig = 200000 ; - Int_t i; - for(i=0; iAt(i) ; + TClonesArray * sdigits ; + for(i = 0 ; i < fInput ; i++){ + sdigits = dynamic_cast(sdigArray->At(i)) ; if ( !sdigits->GetEntriesFast() ) continue ; - Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ; - if(curNext < nextSig) - nextSig = curNext ; + Int_t curNext = dynamic_cast(sdigits->At(0))->GetId() ; + if(curNext < nextSig) + nextSig = curNext ; } - - TArrayI index(input) ; + + TArrayI index(fInput) ; index.Reset() ; //Set all indexes to zero - + AliPHOSDigit * digit ; AliPHOSDigit * curSDigit ; - + TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ; - + //Put Noise contribution - for(absID = 1; absID <= nEMC; absID++){ + for(absID = 1 ; absID <= nEMC ; absID++){ Float_t noise = gRandom->Gaus(0., fPinNoise) ; - new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ; + new((*digits)[absID-1]) AliPHOSDigit( -1, absID, sDigitizer->Digitize(noise), TimeOfNoise() ) ; //look if we have to add signal? - digit = (AliPHOSDigit *) digits->At(absID-1) ; - + digit = dynamic_cast(digits->At(absID-1)) ; + if(absID==nextSig){ //Add SDigits from all inputs ticks->Clear() ; Int_t contrib = 0 ; Float_t a = digit->GetAmp() ; - Float_t b = TMath::Abs( a /fTimeSignalLength) ; - //Mark the beginnign of the signal + Float_t b = TMath::Abs( a / fTimeSignalLength) ; + //Mark the beginning of the signal new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b); //Mark the end of the ignal new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b); - + //loop over inputs - for(i=0; iAt(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + for(i = 0 ; i < fInput ; i++){ + if( dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast(dynamic_cast(sdigArray->At(i))->At(index[i])) ; else curSDigit = 0 ; //May be several digits will contribute from the same input @@ -243,29 +260,28 @@ void AliPHOSDigitizer::Digitize(const Int_t event) b = a /fTimeSignalLength ; new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b); new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); - + *digit = *digit + *curSDigit ; //add energies - + index[i]++ ; - if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + if( dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast(dynamic_cast(sdigArray->At(i))->At(index[i])) ; else curSDigit = 0 ; } } - + //calculate and set time Float_t time = FrontEdgeTime(ticks) ; digit->SetTime(time) ; - + //Find next signal module nextSig = 200000 ; - for(i=0; iAt(i)) ; + for(i = 0 ; i < fInput ; i++){ + sdigits = dynamic_cast(sdigArray->At(i)) ; Int_t curNext = nextSig ; if(sdigits->GetEntriesFast() > index[i] ){ - curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ; - + curNext = dynamic_cast(sdigits->At(index[i]))->GetId() ; } if(curNext < nextSig) nextSig = curNext ; } @@ -274,19 +290,19 @@ void AliPHOSDigitizer::Digitize(const Int_t event) ticks->Delete() ; delete ticks ; - - + + //Now CPV digits (different noise and no timing) for(absID = nEMC+1; absID <= nCPV; absID++){ Float_t noise = gRandom->Gaus(0., fCPVNoise) ; new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ; //look if we have to add signal? if(absID==nextSig){ - digit = (AliPHOSDigit *) digits->At(absID-1) ; + digit = dynamic_cast(digits->At(absID-1)) ; //Add SDigits from all inputs - for(i=0; iAt(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + for(i = 0 ; i < fInput ; i++){ + if( dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast( dynamic_cast(sdigArray->At(i))->At(index[i])) ; else curSDigit = 0 ; @@ -303,8 +319,8 @@ void AliPHOSDigitizer::Digitize(const Int_t event) //add energies *digit = *digit + *curSDigit ; index[i]++ ; - if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] ) - curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ; + if( dynamic_cast(sdigArray->At(i))->GetEntriesFast() > index[i] ) + curSDigit = dynamic_cast( dynamic_cast(sdigArray->At(i))->At(index[i]) ) ; else curSDigit = 0 ; } @@ -312,22 +328,21 @@ void AliPHOSDigitizer::Digitize(const Int_t event) //Find next signal module nextSig = 200000 ; - for(i=0; iAt(i) ; + for(i = 0 ; i < fInput ; i++){ + sdigits = dynamic_cast(sdigArray->At(i)) ; Int_t curNext = nextSig ; if(sdigits->GetEntriesFast() > index[i] ) - curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ; + curNext = dynamic_cast( sdigits->At(index[i]) )->GetId() ; if(curNext < nextSig) nextSig = curNext ; } } } - delete sdigArray ; //We should not delete its contents - - + + delete sdigArray ; //We should not delete its contents //remove digits below thresholds - for(i = 0; i < nEMC ; i++){ + for(i = 0 ; i < nEMC ; i++){ digit = dynamic_cast( digits->At(i) ) ; if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold) digits->RemoveAt(i) ; @@ -337,7 +352,7 @@ void AliPHOSDigitizer::Digitize(const Int_t event) for(i = nEMC; i < nCPV ; i++) - if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(i))->GetAmp()) < fCPVDigitThreshold) + if( sDigitizer->Calibrate( dynamic_cast(digits->At(i))->GetAmp() ) < fCPVDigitThreshold ) digits->RemoveAt(i) ; digits->Compress() ; @@ -352,7 +367,6 @@ void AliPHOSDigitizer::Digitize(const Int_t event) Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ; digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ; } - } //____________________________________________________________________________ @@ -375,92 +389,45 @@ Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId) //____________________________________________________________________________ void AliPHOSDigitizer::Exec(Option_t *option) { - // Managing method + // Does the job + + if (!fInit) { // to prevent overwrite existing file + Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ; + return ; + } - if(strcmp(GetName(), "") == 0 ) - Init() ; if (strstr(option,"print")) { - Print(""); + Print(); return ; } if(strstr(option,"tim")) gBenchmark->Start("PHOSDigitizer"); - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - Int_t nevents ; + if (fManager) + fInput = fManager->GetNinputs() ; - TTree * treeD ; - - if(fManager){ - treeD = fManager->GetTreeD() ; - nevents = 1 ; // Will process only one event + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + Int_t nevents = gime->MaxEvent() ; - //Check, if this branch already exits - if (treeD) { - TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ; - TIter next(lob) ; - TBranch * branch = 0 ; - Bool_t phosfound = kFALSE, digitizerfound = kFALSE ; - - while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) { - if ( (strcmp(branch->GetName(), "PHOS")==0) && - (strcmp(branch->GetTitle(), GetName())==0) ) - phosfound = kTRUE ; - - else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && - (strcmp(branch->GetTitle(), GetName())==0) ) - digitizerfound = kTRUE ; - } - - if ( phosfound ) { - Error("Exec", "Digits branch with name %s already exists", GetName() ) ; - return ; - } - if ( digitizerfound ) { - Error("Exec", "Digitizer branch with name %s already exists", GetName() ); - return ; - } - } - } - else { //PHOS standalone - if(gime->BranchExists("Digits") ) - return ; - nevents=gime->MaxEvent() ; - } - Int_t ievent ; - + for(ievent = 0; ievent < nevents; ievent++){ - - if(fManager){ - - Int_t input ; - for(input = 0 ; input < fManager->GetNinputs(); input ++){ - TTree * treeS = fManager->GetInputTreeS(input) ; - if(!treeS){ - Error("Exec", "No Input") ; - return ; - } - gime->ReadTreeS(treeS,input) ; - } + + gime->Event(ievent,"S") ; - } - else - gime->Event(ievent,"S") ; - Digitize(ievent) ; //Add prepared SDigits to digits and add the noise - + WriteDigits(ievent) ; - + if(strstr(option,"deb")) PrintDigits(option); //increment the total number of Digits per run fDigitsInRun += gime->Digits()->GetEntriesFast() ; - } - + } + if(strstr(option,"tim")){ gBenchmark->Stop("PHOSDigitizer"); TString message ; @@ -497,55 +464,46 @@ Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks) const Bool_t AliPHOSDigitizer::Init() { // Makes all memory allocations - - if( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName(), fToSplit) ; + fInit = kTRUE ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !") ; + Fatal("Init" ,"Could not obtain the Getter object for file %s and event %s !", GetTitle(), fEventFolderName.Data()) ; return kFALSE; } const AliPHOSGeometry * geom = gime->PHOSGeometry() ; - fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ; - - // Post Digits to the white board - gime->PostDigits(GetName() ) ; + fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ; + TString opt("Digits") ; + if(gime->VersionExists(opt) ) { + Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ; + fInit = kFALSE ; + } + // Post Digitizer to the white board gime->PostDigitizer(this) ; - - fSplitFile = 0 ; - if(fToSplit){ - // construct the name of the file as /path/PHOS.SDigits.root - //First - extract full path if necessary - TString digitsFileName(GetTitle()) ; - Ssiz_t islash = digitsFileName.Last('/') ; - if(islash(gROOT->GetFile(digitsFileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(digitsFileName.Data(),"update") ; - } - //Mark that we will use current header file - if(!fManager){ - gime->PostSDigits(GetName(),GetTitle()) ; - gime->PostSDigitizer(GetName(),GetTitle()) ; + if (fManager) + fInput = fManager->GetNinputs() ; + else + fInput = 1 ; + + fInputFileNames = new TString[fInput] ; + fEventNames = new TString[fInput] ; + fInputFileNames[0] = GetTitle() ; + fEventNames[0] = fEventFolderName.Data() ; + Int_t index ; + for (index = 1 ; index < fInput ; index++) { + fInputFileNames[index] = dynamic_cast(fManager->GetInputStream(index))->GetFileName(0); + TString tempo = fManager->GetInputFolderName(index) ; + fEventNames[index] = tempo.Remove(tempo.Length()-1) ; // strip of the stream number added bt fManager } - return kTRUE ; + + //to prevent cleaning of this object while GetEvent is called + gime->PhosLoader()->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + + return fInit ; } //____________________________________________________________________________ @@ -573,7 +531,7 @@ void AliPHOSDigitizer::InitParameters() } //__________________________________________________________________ -void AliPHOSDigitizer::MixWith(const char* headerFile,const char* brname) +void AliPHOSDigitizer::MixWith(const TString alirunFileName, const TString eventFolderName) { // Allows to produce digits by superimposing background and signal event. // It is assumed, that headers file with SIGNAL events is opened in @@ -587,128 +545,112 @@ void AliPHOSDigitizer::MixWith(const char* headerFile,const char* brname) // However only Sdigits with the same name (i.e. constructed with the same SDigitizer) // can be mixed. - if( strcmp(GetName(), "") == 0 ) + if( strcmp(fEventFolderName, "") == 0 ) Init() ; if(fManager){ - Warning("MixWith", "Can not use this method under AliRunDigitizer\n" ) ; + Warning("MixWith", "Cannot use this method with AliRunDigitizer\n" ) ; return ; } - - // check if the specified SDigits do not already exist on the White Board: - // //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - TString path = gime->SDigitsFolder()->GetName() ; - - // before it was ???? "Folders/RunMC/Event/Data/PHOS/SDigits" ; - path += headerFile ; - path += "/" ; - if(brname) - path += brname ; - else - path += GetName() ; - if ( gROOT->FindObjectAny(path.Data()) ) { - Warning("MixWith", "Entry already exists, do not add\n" ) ; - return; + // looking for file which contains AliRun + if (gSystem->AccessPathName(alirunFileName)) {// file does not exist + Error("MixWith", "File %s does not exist!", alirunFileName.Data()) ; + return ; } - gime->PostSDigits(GetName(),headerFile) ; - // check if the requested file is already open or exist and if SDigits Branch exist - TFile * file = (TFile*)gROOT->GetFile(headerFile); - if ( !file ) { - file = new TFile(headerFile, "READ") ; - if (!file) { - Error("MixWith", "File %s does not exist\n", headerFile ); - return ; + // looking for the file which contains SDigits + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + TString fileName( gime->GetSDigitsFileName() ) ; + if ( eventFolderName != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + eventFolderName + ".root" ; + if ( (gSystem->AccessPathName(fileName)) ) { + Error("MixWith", "The file %s does not exist!", fileName.Data()) ; + return ; } - } + // need to increase the arrays + TString tempo = fInputFileNames[fInput-1] ; + delete [] fInputFileNames ; + fInputFileNames = new TString[fInput+1] ; + fInputFileNames[fInput-1] = tempo ; + + tempo = fEventNames[fInput-1] ; + delete [] fEventNames ; + fEventNames = new TString[fInput+1] ; + fEventNames[fInput-1] = tempo ; + + fInputFileNames[fInput] = alirunFileName ; + fEventNames[fInput] = eventFolderName ; + fInput++ ; } //__________________________________________________________________ -void AliPHOSDigitizer::Print(Option_t* option)const +void AliPHOSDigitizer::Print()const { // Print Digitizer's parameters - if( strcmp(GetName(), "") != 0 ){ - - TString message("\n-------------------") ; - message += GetName() ; - message += "-------------\n" ; - - const Int_t kNStreams = GetNInputStreams() ; - if (kNStreams) { - Int_t index = 0 ; - for (index = 0 ; index < kNStreams ; index++) { - message += "Adding SDigits " ; - message += GetName() ; - message += "from " ; - message += fManager->GetInputFileName(index, 0) ; - } - message += "\nWriting digits to " ; - message += fManager->GetInputFileName(0, 0) ; - } else { - // AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - // gime->Folder("sdigits") ; - // TCollection * folderslist = gime->Folder("sdigits")->GetListOfFolders() ; - // TIter next(folderslist) ; - // TFolder * folder = 0 ; - - // while ( (folder = (TFolder*)next()) ) { - // if ( folder->FindObject(GetName()) ) - // } - message += "\nWriting digits to " ; - message += GetTitle() ; - } - message += "\nWith following parameters:\n" ; - message += " Electronics noise in EMC (fPinNoise) = %f\n" ; - message += " Threshold in EMC (fEMCDigitThreshold) = %f\n" ; - message += " Noise in CPV (fCPVNoise) = %f\n" ; - message += " Threshold in CPV (fCPVDigitThreshold) = %f\n" ; - message += "---------------------------------------------------\n" ; - Info("Print", message.Data(), - fPinNoise, - fEMCDigitThreshold, - fCPVNoise, - fCPVDigitThreshold ) ; + Info("Print", "\n------------------- %s -------------", GetName() ) ; + if( strcmp(fEventFolderName.Data(), "") != 0 ){ + printf(" Writing Digits to branch with title %s\n", fEventFolderName.Data()) ; + + Int_t nStreams ; + if (fManager) + nStreams = GetNInputStreams() ; + else + nStreams = fInput ; + + Int_t index = 0 ; + for (index = 0 ; index < nStreams ; index++) { + TString tempo(fEventNames[index]) ; + tempo += index ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[index], tempo) ; + TString fileName( gime->GetSDigitsFileName() ) ; + if ( fEventNames[index] != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + fEventNames[index] + ".root" ; + printf ("Adding SDigits from %s %s\n", fInputFileNames[index].Data(), fileName.Data()) ; + } + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; + printf("\nWriting digits to %s", gime->GetDigitsFileName().Data()) ; + + printf("\nWith following parameters:\n") ; + printf(" Electronics noise in EMC (fPinNoise) = %f\n", fPinNoise ) ; + printf(" Threshold in EMC (fEMCDigitThreshold) = %f\n", fEMCDigitThreshold ) ; + printf(" Noise in CPV (fCPVNoise) = %f\n", fCPVNoise ) ; + printf(" Threshold in CPV (fCPVDigitThreshold) = %f\n",fCPVDigitThreshold ) ; + printf(" ---------------------------------------------------\n") ; } else - Info("Print", "AliPHOSDigitizer not initialized\n" ) ; + Info("Print", "AliPHOSDigitizer not initialized" ) ; } - + //__________________________________________________________________ void AliPHOSDigitizer::PrintDigits(Option_t * option) { // Print a table of digits - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; TClonesArray * digits = gime->Digits() ; - TString message ; - message = "\nevent " ; - message += gAlice->GetEvNumber() ; - message += "\n Number of entries in Digits list " ; - message += digits->GetEntriesFast() ; - char * tempo = new char[8192]; + Info("PrintDigits", "%d", digits->GetEntriesFast()) ; + printf("\nevent %d", gAlice->GetEvNumber()) ; + printf("\n Number of entries in Digits list %d", digits->GetEntriesFast() ) ; + if(strstr(option,"all")||strstr(option,"EMC")){ //loop over digits AliPHOSDigit * digit; - message += "\nEMC digits (with primaries):\n" ; - message += "\n Id Amplitude Time Index Nprim: Primaries list \n" ; + printf("\nEMC digits (with primaries):\n") ; + printf("\n Id Amplitude Time Index Nprim: Primaries list \n") ; Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ; Int_t index ; for (index = 0 ; (index < digits->GetEntriesFast()) && - (((AliPHOSDigit * ) digits->At(index))->GetId() <= maxEmc) ; index++) { + (dynamic_cast(digits->At(index))->GetId() <= maxEmc) ; index++) { digit = (AliPHOSDigit * ) digits->At(index) ; if(digit->GetNprimary() == 0) continue; - sprintf(tempo, "\n%6d %8d %6.5e %4d %2d :", + printf("\n%6d %8d %6.5e %4d %2d :", digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ; - message += tempo ; Int_t iprimary; for (iprimary=0; iprimaryGetNprimary(); iprimary++) { - sprintf(tempo, "%d ",digit->GetPrimary(iprimary+1) ) ; - message += tempo ; + printf("%d ",digit->GetPrimary(iprimary+1) ) ; } } } @@ -717,27 +659,23 @@ void AliPHOSDigitizer::Print(Option_t* option)const //loop over CPV digits AliPHOSDigit * digit; - message += "\nCPV digits:\n" ; - message += "\n Id Amplitude Index Nprim: Primaries list \n" ; - + printf("\nCPV digits (with primaries):\n") ; + printf("\n Id Amplitude Time Index Nprim: Primaries list \n") ; Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ; Int_t index ; for (index = 0 ; index < digits->GetEntriesFast(); index++) { digit = (AliPHOSDigit * ) digits->At(index) ; if(digit->GetId() > maxEmc){ - sprintf(tempo, "\n%6d %8d %4d %2d :", + printf("\n%6d %8d %4d %2d :", digit->GetId(), digit->GetAmp(), digit->GetIndexInList(), digit->GetNprimary()) ; - message += tempo ; Int_t iprimary; for (iprimary=0; iprimaryGetNprimary(); iprimary++) { - sprintf(tempo, "%d ",digit->GetPrimary(iprimary+1) ) ; - message += tempo ; + printf("%d ",digit->GetPrimary(iprimary+1) ) ; } } } } - delete tempo ; - Info("Print", message.Data() ) ; + } //__________________________________________________________________ @@ -748,6 +686,22 @@ Float_t AliPHOSDigitizer::TimeOfNoise(void) const } +//__________________________________________________________________ +void AliPHOSDigitizer::Unload() +{ + + Int_t i ; + for(i = 1 ; i < fInput ; i++){ + TString tempo(fEventNames[i]) ; + tempo += i ; + AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ; + gime->PhosLoader()->UnloadSDigits() ; + } + + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; + gime->PhosLoader()->UnloadDigits() ; +} + //____________________________________________________________________________ void AliPHOSDigitizer::WriteDigits(Int_t event) { @@ -760,32 +714,19 @@ void AliPHOSDigitizer::WriteDigits(Int_t event) // and branch "AliPHOSDigitizer", with the same title to keep all the parameters // and names of files, from which digits are made. - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - const TClonesArray * digits = gime->Digits(GetName()) ; - TTree * treeD ; - - if(fManager) - treeD = fManager->GetTreeD() ; - else { - if((gAlice->TreeD() == 0) || (fSplitFile)) // we should not create TreeD if it is already here - gAlice->MakeTree("D", fSplitFile); // We overwrite TreeD in split file in the case of second reconstruction - if(fSplitFile) - fSplitFile->cd() ; - treeD = gAlice->TreeD(); - } - + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; + const TClonesArray * digits = gime->Digits() ; + TTree * treeD = gime->TreeD(); + // -- create Digits branch Int_t bufferSize = 32000 ; TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize); - digitsBranch->SetTitle(GetName()); + digitsBranch->SetTitle(fEventFolderName); + digitsBranch->Fill() ; - // -- Create Digitizer branch - Int_t splitlevel = 0 ; - const AliPHOSDigitizer * d = dynamic_cast(gime->Digitizer()) ; - TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel); - digitizerBranch->SetTitle(GetName()); + gime->WriteDigits("OVERWRITE"); + gime->WriteDigitizer("OVERWRITE"); + + Unload() ; - digitsBranch->Fill() ; - digitizerBranch->Fill() ; - treeD->AutoSave() ; } diff --git a/PHOS/AliPHOSDigitizer.h b/PHOS/AliPHOSDigitizer.h index a4810829431..30c61f70209 100644 --- a/PHOS/AliPHOSDigitizer.h +++ b/PHOS/AliPHOSDigitizer.h @@ -18,7 +18,6 @@ #include "TObjString.h" class TArrayI ; class TClonesArray ; -class TFile ; // --- Standard library --- @@ -31,10 +30,9 @@ class AliPHOSDigitizer: public AliDigitizer { public: AliPHOSDigitizer() ; // ctor - AliPHOSDigitizer(const char *headerFile, const char * name = "Default", const Bool_t toSplit = kFALSE ) ; - AliPHOSDigitizer(AliRunDigitizer * ard) ; - AliPHOSDigitizer(const AliPHOSDigitizer & dtizer) - {( (AliPHOSDigitizer &)dtizer ).Copy(*this) ;} + AliPHOSDigitizer(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliPHOSDigitizer(const AliPHOSDigitizer & dtizer) ; + AliPHOSDigitizer(AliRunDigitizer * manager) ; virtual ~AliPHOSDigitizer() ; void Digitize(const Int_t event) ; // Make Digits from SDigits @@ -65,12 +63,14 @@ public: void SetNEMCchannels(Int_t n) { fNADCemc = n; } void SetEMCchannel(Float_t width) { fADCchanelEmc = width; } void SetEMCpedestal(Float_t ped) { fADCpedestalEmc = ped ; } + void SetEventFolderName(TString name) { fEventFolderName = name ; } void SetTimeResolution(Float_t res){ fTimeResolution = res ; } //General const Int_t GetDigitsInRun() const { return fDigitsInRun ;} - void MixWith(const char* HeaderFile,const char* brname = 0) ; // Add another one file to mix - void Print(Option_t* option)const ; + void MixWith(const TString alirunFileName, + const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; // Add another one file to mix + void Print()const ; AliPHOSDigitizer & operator = (const AliPHOSDigitizer & rvalue) { // assignement operator requested by coding convention but not needed @@ -80,11 +80,13 @@ public: private: - Bool_t Init() ; + virtual Bool_t Init() ; void InitParameters() ; void PrintDigits(Option_t * option) ; + void Unload() ; void WriteDigits(Int_t evt) ; // Writes Digits for particular event Float_t TimeOfNoise(void) const; // Calculate time signal generated by noise + //Calculate the time of crossing of the threshold by front edge Float_t FrontEdgeTime(TClonesArray * ticks) const ; //Calculate digitized signal with gived ADC parameters @@ -93,7 +95,12 @@ private: private: Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) - Int_t fDigitsInRun ; //! Total number of digits in one run + Int_t fDigitsInRun ; //! Total number of digits in one run + Bool_t fInit ; //! To avoid overwriting existing files + + Int_t fInput ; // Number of files to merge + TString * fInputFileNames ; //[fInput] List of file names to merge + TString * fEventNames ; //[fInput] List of event names to merge Int_t fEmcCrystals ; // Number of EMC crystalls in the given geometry @@ -116,11 +123,9 @@ private: Float_t fADCpedestalCpv ; // value of the CPV ADC pedestal in CPV units Int_t fNADCcpv ; // number of channels in CPV ADC - Bool_t fToSplit ; //! Do we work in the split mode - TFile * fSplitFile ; //! file in which Digits will eventually be stored - - - ClassDef(AliPHOSDigitizer,1) // description + TString fEventFolderName; // skowron: name of EFN to read data from in stand alone mode + + ClassDef(AliPHOSDigitizer,2) // description }; diff --git a/PHOS/AliPHOSEMCAGeometry.h b/PHOS/AliPHOSEMCAGeometry.h index 9f8b336e4f6..d107d767283 100644 --- a/PHOS/AliPHOSEMCAGeometry.h +++ b/PHOS/AliPHOSEMCAGeometry.h @@ -13,6 +13,8 @@ // Modified: Yuri Kharlov (IHEP, Protvino) // 15 September 2000 +#include + // --- ROOT system --- #include "TObject.h" class TObjArray ; @@ -22,29 +24,29 @@ class TObjArray ; class AliPHOSEMCAGeometry : public TObject { public: - - AliPHOSEMCAGeometry(); - AliPHOSEMCAGeometry(const AliPHOSEMCAGeometry & cpv) { - // cpy ctor requested by Coding Convention but not yet needed - Fatal("cpy ctor", "not implemented") ; - } + + AliPHOSEMCAGeometry(); + AliPHOSEMCAGeometry(const AliPHOSEMCAGeometry & cpv) { + // cpy ctor requested by Coding Convention but not yet needed + assert(0==1) ; + } virtual ~AliPHOSEMCAGeometry(void) {} AliPHOSEMCAGeometry & operator = (const AliPHOSEMCAGeometry & rvalue) { // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; + assert(0==1) ; return *this ; } Float_t * GetStripHalfSize() {return fStripHalfSize ;} - Float_t GetStripWallWidthOut() const {return fStripWallWidthOut ;} + Float_t GetStripWallWidthOut() {return fStripWallWidthOut ;} Float_t * GetAirCellHalfSize() {return fAirCellHalfSize ;} Float_t * GetWrappedHalfSize() {return fWrappedHalfSize ;} Float_t GetAirGapLed() const {return fAirGapLed ;} Float_t * GetCrystalHalfSize() {return fCrystalHalfSize ;} - Float_t * GetSupportPlateHalfSize() {return fSupportPlateHalfSize ;} + Float_t * GetSupportPlateHalfSize() { return fSupportPlateHalfSize ;} Float_t * GetSupportPlateInHalfSize() {return fSupportPlateInHalfSize ;} - Float_t GetSupportPlateThickness(void) const { return fSupportPlateThickness ; } + Float_t GetSupportPlateThickness(void) const { return fSupportPlateThickness ; } Float_t * GetPreampHalfSize() {return fPreampHalfSize ;} Float_t * GetAPDHalfSize(void) {return fPinDiodeHalfSize ; } @@ -60,7 +62,7 @@ public: Float_t * GetTSupport2HalfSize() {return fTSupport2HalfSize ;} Float_t * GetTCables1HalfSize() {return fTCables1HalfSize ; } Float_t * GetTCables2HalfSize() {return fTCables2HalfSize ; } - Float_t GetTSupportDist() const {return fTSupportDist ; } + Float_t GetTSupportDist() {return fTSupportDist ; } Float_t * GetFrameXHalfSize() {return fFrameXHalfSize ;} Float_t * GetFrameZHalfSize() {return fFrameZHalfSize ;} Float_t * GetFrameXPosition() {return fFrameXPosition ;} @@ -94,96 +96,96 @@ public: private: - Float_t fStripHalfSize[3] ; // Strip unit size/2 - Float_t fAirCellHalfSize[3] ; // geometry parameter - Float_t fWrappedHalfSize[3] ; // geometry parameter - Float_t fSupportPlateHalfSize[3] ; // geometry parameter - Float_t fSupportPlateInHalfSize[3] ; // geometry parameter - Float_t fCrystalHalfSize[3] ; // crystal size/2 - Float_t fAirGapLed ; // geometry parameter - Float_t fStripWallWidthOut ; // Side to another strip - Float_t fStripWallWidthIn ; // geometry parameter - Float_t fTyvecThickness ; // geometry parameter - Float_t fTSupport1HalfSize[3] ; // geometry parameter - Float_t fTSupport2HalfSize[3] ; // geometry parameter - Float_t fPreampHalfSize[3] ; // geometry parameter - Float_t fPinDiodeHalfSize[3] ; // Size of the PIN Diode - - Float_t fOuterThermoParams[4] ; // geometry parameter - Float_t fCoolerHalfSize[3] ; // geometry parameter - Float_t fAirGapHalfSize[3] ; // geometry parameter - Float_t fInnerThermoHalfSize[3] ; // geometry parameter - Float_t fAlCoverParams[4] ; // geometry parameter - Float_t fFiberGlassHalfSize[3] ; // geometry parameter - - - Float_t fInnerThermoWidthX ; // geometry parameter - Float_t fInnerThermoWidthY ; // geometry parameter - Float_t fInnerThermoWidthZ ; // geometry parameter - Float_t fAirGapWidthX ; // geometry parameter - Float_t fAirGapWidthY ; // geometry parameter - Float_t fAirGapWidthZ ; // geometry parameter - Float_t fCoolerWidthX ; // geometry parameter - Float_t fCoolerWidthY ; // geometry parameter - Float_t fCoolerWidthZ ; // geometry parameter - Float_t fAlCoverThickness ; // geometry parameter - Float_t fOuterThermoWidthXUp ; // geometry parameter - Float_t fOuterThermoWidthXLow; // geometry parameter - Float_t fOuterThermoWidthY ; // geometry parameter - Float_t fOuterThermoWidthZ ; // geometry parameter - Float_t fAlFrontCoverX ; // geometry parameter - Float_t fAlFrontCoverZ ; // geometry parameter - Float_t fFiberGlassSup2X ; // geometry parameter - Float_t fFiberGlassSup1X ; // geometry parameter - Float_t fFrameHeight ; // geometry parameter - Float_t fFrameThickness ; // geometry parameter - Float_t fAirSpaceFeeX ; // geometry parameter - Float_t fAirSpaceFeeZ ; // geometry parameter - Float_t fAirSpaceFeeY ; // geometry parameter - Float_t fTCables2HalfSize[3] ; // geometry parameter - Float_t fTCables1HalfSize[3] ; // geometry parameter - Float_t fWarmUpperThickness ; // geometry parameter - Float_t fWarmBottomThickness ; // geometry parameter - Float_t fWarmAlCoverWidthX ; // geometry parameter - Float_t fWarmAlCoverWidthY ; // geometry parameter - Float_t fWarmAlCoverWidthZ ; // geometry parameter - Float_t fWarmAlCoverHalfSize[3] ; // geometry parameter - Float_t fWarmThermoHalfSize[3] ; // geometry parameter - Float_t fFiberGlassSup1Y ; // geometry parameter - Float_t fFiberGlassSup2Y ; // geometry parameter - Float_t fTSupportDist ; // geometry parameter - Float_t fTSupport1Thickness ; // geometry parameter - Float_t fTSupport2Thickness ; // geometry parameter - Float_t fTSupport1Width ; // geometry parameter - Float_t fTSupport2Width ; // geometry parameter - Float_t fFrameXHalfSize[3] ; // geometry parameter - Float_t fFrameZHalfSize[3] ; // geometry parameter - Float_t fFrameXPosition[3] ; // geometry parameter - Float_t fFrameZPosition[3] ; // geometry parameter - Float_t fFGupXHalfSize[3] ; // geometry parameter - Float_t fFGupXPosition[3] ; // geometry parameter - Float_t fFGupZHalfSize[3] ; // geometry parameter - Float_t fFGupZPosition[3] ; // geometry parameter - Float_t fFGlowXHalfSize[3] ; // geometry parameter - Float_t fFGlowXPosition[3] ; // geometry parameter - Float_t fFGlowZHalfSize[3] ; // geometry parameter - Float_t fFGlowZPosition[3] ; // geometry parameter - Float_t fFEEAirHalfSize[3] ; // geometry parameter - Float_t fFEEAirPosition[3] ; // geometry parameter - Float_t fEMCParams[4] ; // geometry parameter - Float_t fIPtoOuterCoverDistance ; // Distances from interaction point to outer cover - Float_t fIPtoCrystalSurface ; // Distances from interaction point to Xtal surface - - Float_t fSupportPlateThickness ; // Thickness of the Aluminium support plate for Strip - - Int_t fNCellsInStrip ; // Number of cells in a strip unit - Int_t fNStripX ; // Number of strip units in X - Int_t fNStripZ ; // Number of strip units in Z - Int_t fNTSupports ; // geometry parameter - Int_t fNPhi ; // Number of crystal units in X (phi) direction - Int_t fNZ ; // Number of crystal units in Z direction - - ClassDef(AliPHOSEMCAGeometry,1) // EMCA geometry class + Float_t fStripHalfSize[3] ; + Float_t fAirCellHalfSize[3] ; + Float_t fWrappedHalfSize[3] ; + Float_t fSupportPlateHalfSize[3] ; + Float_t fSupportPlateInHalfSize[3] ; + Float_t fCrystalHalfSize[3] ; + Float_t fAirGapLed ; + Float_t fStripWallWidthOut ; // Side to another strip + Float_t fStripWallWidthIn ; + Float_t fTyvecThickness ; + Float_t fTSupport1HalfSize[3] ; + Float_t fTSupport2HalfSize[3] ; + Float_t fPreampHalfSize[3] ; + Float_t fPinDiodeHalfSize[3] ; // Size of the PIN Diode + + Float_t fOuterThermoParams[4] ; + Float_t fCoolerHalfSize[3] ; + Float_t fAirGapHalfSize[3] ; + Float_t fInnerThermoHalfSize[3] ; + Float_t fAlCoverParams[4] ; + Float_t fFiberGlassHalfSize[3] ; + + + Float_t fInnerThermoWidthX ; + Float_t fInnerThermoWidthY ; + Float_t fInnerThermoWidthZ ; + Float_t fAirGapWidthX ; + Float_t fAirGapWidthY ; + Float_t fAirGapWidthZ ; + Float_t fCoolerWidthX ; + Float_t fCoolerWidthY ; + Float_t fCoolerWidthZ ; + Float_t fAlCoverThickness ; + Float_t fOuterThermoWidthXUp ; + Float_t fOuterThermoWidthXLow; + Float_t fOuterThermoWidthY ; + Float_t fOuterThermoWidthZ ; + Float_t fAlFrontCoverX ; + Float_t fAlFrontCoverZ ; + Float_t fFiberGlassSup2X ; + Float_t fFiberGlassSup1X ; + Float_t fFrameHeight ; + Float_t fFrameThickness ; + Float_t fAirSpaceFeeX ; + Float_t fAirSpaceFeeZ ; + Float_t fAirSpaceFeeY ; + Float_t fTCables2HalfSize[3] ; + Float_t fTCables1HalfSize[3] ; + Float_t fWarmUpperThickness ; + Float_t fWarmBottomThickness ; + Float_t fWarmAlCoverWidthX ; + Float_t fWarmAlCoverWidthY ; + Float_t fWarmAlCoverWidthZ ; + Float_t fWarmAlCoverHalfSize[3] ; + Float_t fWarmThermoHalfSize[3] ; + Float_t fFiberGlassSup1Y ; + Float_t fFiberGlassSup2Y ; + Float_t fTSupportDist ; + Float_t fTSupport1Thickness ; + Float_t fTSupport2Thickness ; + Float_t fTSupport1Width ; + Float_t fTSupport2Width ; + Float_t fFrameXHalfSize[3] ; + Float_t fFrameZHalfSize[3] ; + Float_t fFrameXPosition[3] ; + Float_t fFrameZPosition[3] ; + Float_t fFGupXHalfSize[3] ; + Float_t fFGupXPosition[3] ; + Float_t fFGupZHalfSize[3] ; + Float_t fFGupZPosition[3] ; + Float_t fFGlowXHalfSize[3] ; + Float_t fFGlowXPosition[3] ; + Float_t fFGlowZHalfSize[3] ; + Float_t fFGlowZPosition[3] ; + Float_t fFEEAirHalfSize[3] ; + Float_t fFEEAirPosition[3] ; + Float_t fEMCParams[4] ; + Float_t fIPtoOuterCoverDistance ; // Distances from interaction point to outer cover + Float_t fIPtoCrystalSurface ; // Distances from interaction point to Xtal surface + + Float_t fSupportPlateThickness ; // Thickness of the Aluminium support plate for Strip + + Int_t fNCellsInStrip ; + Int_t fNStripX ; + Int_t fNStripZ ; + Int_t fNTSupports ; + Int_t fNPhi ; // Number of crystal units in X (phi) direction + Int_t fNZ ; // Number of crystal units in Z direction + + ClassDef(AliPHOSEMCAGeometry,1) // EMCA geometry class } ; diff --git a/PHOS/AliPHOSEmcRecPoint.cxx b/PHOS/AliPHOSEmcRecPoint.cxx index 92e5d274bf1..de1794a787b 100644 --- a/PHOS/AliPHOSEmcRecPoint.cxx +++ b/PHOS/AliPHOSEmcRecPoint.cxx @@ -33,7 +33,7 @@ // --- AliRoot header files --- - #include "AliGenerator.h" +#include "AliGenerator.h" #include "AliPHOSGeometry.h" #include "AliPHOSEmcRecPoint.h" #include "AliRun.h" @@ -148,8 +148,7 @@ Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * d Bool_t aren = kFALSE ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t relid1[4] ; phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; @@ -218,10 +217,8 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const // If Left button is clicked on AliPHOSRecPoint, the digits are switched on // and switched off when the mouse button is released. - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - if(!gime) return ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); static TGraph * digitgraph = 0 ; @@ -230,6 +227,22 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const TH2F * histo = 0 ; TCanvas * histocanvas ; + + //try to get run loader from default event folder + AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::fgkDefaultEventFolderName); + if (rn == 0x0) + { + Error("ExecuteEvent","Can not find Run Loader in Default Event Folder"); + return; + } + AliPHOSLoader* gime = dynamic_cast(rn->GetLoader("PHOSLoader")); + if (gime == 0x0) + { + Error("ExecuteEvent","Can not find PHOS Loader from Run Loader"); + return; + } + + const TClonesArray * digits = gime->Digits() ; switch (event) { @@ -331,9 +344,7 @@ void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); - + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); // Calculates the center of gravity in the local PHOS-module coordinates @@ -392,9 +403,8 @@ void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); - + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); + Int_t iDigit; // Calculates the center of gravity in the local PHOS-module coordinates @@ -443,8 +453,7 @@ void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits) AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t iDigit; @@ -476,7 +485,7 @@ void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits) // //Apply correction due to non-perpendicular incidence // Double_t CosX ; // Double_t CosZ ; -// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; +// AliPHOSGetter * gime = AliPHOSGetter::Instance() ; // AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ; @@ -516,8 +525,7 @@ void AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits) AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t iDigit; @@ -652,8 +660,7 @@ void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * dig AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t iDigit; diff --git a/PHOS/AliPHOSEvalRecPoint.cxx b/PHOS/AliPHOSEvalRecPoint.cxx index e68a29f32ad..5a2a840da2a 100644 --- a/PHOS/AliPHOSEvalRecPoint.cxx +++ b/PHOS/AliPHOSEvalRecPoint.cxx @@ -1,27 +1,3 @@ -/************************************************************************** - * 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. * - **************************************************************************/ -/* $Id: */ - -/* $Log: - */ -//*-- Author: Boris Polichtchouk, IHEP -////////////////////////////////////////////////////////////////////////////// -// Reconstructed point operations for the Clusterization class for IHEP reconstruction. -// Performs clusterization (collects neighbouring active cells) -// It differs from AliPHOSClusterizerv1 in neighbour definition only - // ---- ROOT system --- #include "TDirectory.h" #include "TBranch.h" @@ -30,9 +6,11 @@ #include "TFolder.h" // --- AliRoot header files --- +#include "AliConfig.h" +#include "AliPHOSClusterizer.h" #include "AliPHOSEvalRecPoint.h" #include "AliRun.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" #include "AliPHOSRecCpvManager.h" #include "AliPHOSRecEmcManager.h" #include "AliPHOSDigitizer.h" @@ -42,18 +20,18 @@ ClassImp(AliPHOSEvalRecPoint) - AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(): AliPHOSCpvRecPoint() + AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(): fEventFolderName(AliConfig::fgkDefaultEventFolderName) { - // default ctor fParent=-333; fChi2Dof=-111; fIsCpv = kTRUE; fIsEmc = kFALSE; } -AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : AliPHOSCpvRecPoint() +AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) + : fEventFolderName(AliConfig::fgkDefaultEventFolderName) { - // ctor + fParent=-333; fChi2Dof=-111; @@ -81,34 +59,34 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent } -AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : AliPHOSCpvRecPoint() +AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : fEventFolderName(AliConfig::fgkDefaultEventFolderName) { - // ctor + fChi2Dof=-111; fParent=-333; AliPHOSEmcRecPoint* rp=0; - AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); if(cpv) { - rp = (AliPHOSCpvRecPoint*)fGetter->CpvRecPoints()->At(i); + rp = (AliPHOSCpvRecPoint*)fLoader->CpvRecPoints()->At(i); fIsEmc = kFALSE; fIsCpv = kTRUE; } else { - rp = (AliPHOSEmcRecPoint*)fGetter->EmcRecPoints()->At(i); + rp = (AliPHOSEmcRecPoint*)fLoader->EmcRecPoints()->At(i); fIsEmc = kTRUE; fIsCpv = kFALSE; } - Int_t* digits = rp->GetDigitsList(); - Float_t* energies = rp->GetEnergiesList(); + Int_t* Digits = rp->GetDigitsList(); + Float_t* Energies = rp->GetEnergiesList(); Int_t nDigits = rp->GetMultiplicity(); for(Int_t iDigit=0; iDigitDigits()->At( digits[iDigit] ); - Float_t eDigit = energies[iDigit]; + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + Float_t eDigit = Energies[iDigit]; this->AddDigit(*digit,eDigit); } @@ -123,7 +101,6 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : AliPHOSCpvRecPoi AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer() { - // returns clusterizer task TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); AliPHOSClusterizer* clu = (AliPHOSClusterizer*)wPoolF->FindObject("PHOS:clu-v1"); @@ -137,13 +114,12 @@ AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer() Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const { - // check if a rec.point pt is too close to this one - TVector3 herPos; - TVector3 myPos; - pt->GetLocalPosition(herPos); - this->GetLocalPosition(myPos); - Float_t dx = herPos.X() - myPos.X(); - Float_t dz = herPos.Z() - myPos.Z(); + TVector3 her_pos; + TVector3 my_pos; + pt->GetLocalPosition(her_pos); + this->GetLocalPosition(my_pos); + Float_t dx = her_pos.X() - my_pos.X(); + Float_t dz = her_pos.Z() - my_pos.Z(); Float_t dr = TMath::Sqrt(dx*dx + dz*dz); if(drMergeGammasMinDistanceCut()) @@ -155,19 +131,17 @@ Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const Bool_t AliPHOSEvalRecPoint::NeedToSplit() const { - // rec.point needs to be split return kFALSE; } void AliPHOSEvalRecPoint::DeleteParent() { - // delete parent fParent=-333; } void AliPHOSEvalRecPoint::UpdateWorkingPool() { - // update pool of rec.points + Int_t i; //loop variable for(i=0; iInWorkingPool(); i++) { @@ -176,7 +150,7 @@ void AliPHOSEvalRecPoint::UpdateWorkingPool() Int_t nChild = parent->HasChild(children); for(Int_t iChild=0; iChildDeleteParent(); + ((AliPHOSEvalRecPoint*)children.At(iChild))->DeleteParent(); } if(nChild) { @@ -203,7 +177,6 @@ void AliPHOSEvalRecPoint::UpdateWorkingPool() Int_t AliPHOSEvalRecPoint::HasChild(TObjArray& children) { - // returns the number of children for(Int_t iChild=0; iChildDigits(); - Float_t logWeight=0; + TClonesArray* digits = AliPHOSLoader::GetPHOSLoader(fEventFolderName)->Digits(); + Float_t LogWeight=0; if(this->IsEmc()) { - logWeight = clusterizer->GetEmcLogWeight(); + LogWeight = clusterizer->GetEmcLogWeight(); } else { - logWeight = clusterizer->GetCpvLogWeight(); + LogWeight = clusterizer->GetCpvLogWeight(); } - EvalLocalPosition(logWeight,digits); // evaluate initial position + EvalLocalPosition(LogWeight,digits); // evaluate initial position } @@ -276,19 +249,19 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2) GetLocalPosition(lpos); Float_t xx = lpos.Z(); Float_t yy = lpos.X(); - Float_t e = GetEnergy(); + Float_t E = GetEnergy(); - Info("InitTwoGam", "(x,z,e)[old] = (%f, %f, %f)", yy, xx, e) ; + Info("InitTwoGam", "(x,z,E)[old] = (%f, %f, %f)", yy, xx, E) ; -// xx = XY(xx/e); -// yy = XY(yy/e); +// xx = XY(xx/E); +// yy = XY(yy/E); Float_t eDigit ; AliPHOSDigit * digit ; Int_t nDigits = GetMultiplicity(); - Int_t * digits = GetDigitsList(); - Float_t * energies = GetEnergiesList(); + Int_t * Digits = GetDigitsList(); + Float_t * Energies = GetEnergiesList(); Float_t ix ; Float_t iy ; @@ -300,15 +273,15 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2) Float_t sqr; Float_t cos2fi = 1.; - AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance(); - const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); + const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); Int_t iDigit; //loop variable for(iDigit = 0 ; iDigit < nDigits ; iDigit ++) { - digit = (AliPHOSDigit*)fGetter->Digits()->At( digits[iDigit] ); - eDigit = energies[iDigit]; + digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + eDigit = Energies[iDigit]; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, iy, ix); @@ -330,8 +303,8 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2) Float_t eu3 = 0; for(iDigit = 0 ; iDigit < nDigits ; iDigit ++) { - digit = (AliPHOSDigit*)fGetter->Digits()->At( digits[iDigit] ); - eDigit = energies[iDigit]; + digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + eDigit = Energies[iDigit]; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, iy, ix); @@ -341,16 +314,16 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2) eu3 += eDigit*du*du*du; } - Float_t c = e*eu3*eu3/(euu*euu*euu)/2.; + Float_t c = E*eu3*eu3/(euu*euu*euu)/2.; Float_t sign = 1.; if(eu3<0) sign = -1.; Float_t r = 1.+ c + sign*TMath::Sqrt(2.*c + c*c); Float_t u = 0; if(TMath::Abs(r-1.)>0.1) u = eu3/euu*(r+1.)/(r-1.); - if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/e/r)*(1.+r); + if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/E/r)*(1.+r); - Float_t e2c = e/(1.+r); - Float_t e1c = e-e2c; + Float_t e2c = E/(1.+r); + Float_t e1c = E-e2c; Float_t u1 = -u/(1.+r); Float_t u2 = u+u1; @@ -388,7 +361,7 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2) Float_t chmin = GetReconstructionManager()->TwoGamChisqMin(); Float_t emin = GetReconstructionManager()->TwoGamEmin(); Float_t stpmin = GetReconstructionManager()->TwoGamStepMin(); - Int_t nIter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations. + Int_t Niter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations. Float_t chisq = 100.; //Initial chisquare. @@ -418,22 +391,22 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2) Float_t y2c = gamma2[1]; Float_t x2c = gamma2[2]; - Float_t e = GetEnergy(); + Float_t E = GetEnergy(); Float_t eDigit ; AliPHOSDigit * digit ; Int_t nDigits = GetMultiplicity(); - Int_t * digits = GetDigitsList(); - Float_t * energies = GetEnergiesList(); + Int_t * Digits = GetDigitsList(); + Float_t * Energies = GetEnergiesList(); Float_t ix ; Float_t iy ; Int_t relid[4] ; - AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance(); - const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); + const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); - for(Int_t iter=0; iterDigits()->At( digits[iDigit] ); - eDigit = energies[iDigit]; + digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + eDigit = Energies[iDigit]; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, iy, ix); @@ -464,25 +437,25 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2) // AG(e2c,dx2,dy2,a2,gx2,gy2); GetReconstructionManager()->AG(e2c,dx2,dy2,a2,gx2,gy2); - Float_t a = a1+a2; -// Float_t D = Const*a*(1. - a/e); + Float_t A = a1+a2; +// Float_t D = Const*A*(1. - A/E); // if(D<0) D=0; // // D = 9.; // ???? -// Float_t da = a - eDigit; +// Float_t da = A - eDigit; // chisqc += da*da/D; // Float_t dd = da/D; -// dd = dd*(2.-dd*Const*(1.-2.*a/e)); +// dd = dd*(2.-dd*Const*(1.-2.*A/E)); Float_t dd; - chisqc += GetReconstructionManager()->TwoGamChi2(a,eDigit,e,dd); + chisqc += GetReconstructionManager()->TwoGamChi2(A,eDigit,E,dd); grx1c += gx1*dd; gry1c += gy1*dd; grx2c += gx2*dd; gry2c += gy2*dd; - grec += (a1/e1c - a2/e2c)*e*dd; + grec += (a1/e1c - a2/e2c)*E*dd; } @@ -520,13 +493,13 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2) Float_t step = st*gr; Info("TwoGam", "Iteration %d dof %d chisq/dof %f chstop/dof %f step %d stpmin %d", - iter, dof, ch/dof, chstop/dof, step, stpmin) ; + Iter, dof, ch/dof, chstop/dof, step, stpmin) ; if(stepPHOSGeometry(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); + const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); for(Int_t iDigit=0; iDigitDigits()->At( digits[iDigit] ); + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); Int_t relid[4] ; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; Float_t x,z; fGeom->RelPosInModule(relid, x, z); Float_t gain = 0.; - for(Int_t iMax=0; iMaxAG(eMax,dz,dx,amp,gx,gy); - gain += amp; + Float_t Amp,gx,gy; + GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy); + gain += Amp; } eFit[iDigit] = gain; } - for( Int_t iMax=0; iMaxDigits()->At( digits[iDigit] ); - Float_t eDigit = energies[iDigit]; + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + Float_t eDigit = Energies[iDigit]; Int_t relid[4] ; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; Float_t ix,iz; @@ -651,10 +624,10 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2 Float_t dx = xMax - ix; Float_t dz = zMax - iz; - Float_t singleShowerGain,gxMax,gyMax; - GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax); - Float_t totalGain = eFit[iDigit]; - Float_t ratio = singleShowerGain/totalGain; + Float_t single_shower_gain,gxMax,gyMax; + GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax); + Float_t total_gain = eFit[iDigit]; + Float_t ratio = single_shower_gain/total_gain; eDigit = eDigit*ratio; newRP->AddDigit(*digit,eDigit); } @@ -679,10 +652,10 @@ void AliPHOSEvalRecPoint::EvaluatePosition() if(nDigits<2) return; - Int_t nIter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations - Float_t st0 = GetReconstructionManager()->OneGamInitialStep(); // initial step -// const Float_t stpMin = 0.005; - Float_t stpMin = GetReconstructionManager()->OneGamStepMin(); + Int_t Niter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations + Float_t St0 = GetReconstructionManager()->OneGamInitialStep(); // initial step +// const Float_t Stpmin = 0.005; + Float_t Stpmin = GetReconstructionManager()->OneGamStepMin(); Float_t chmin = GetReconstructionManager()->OneGamChisqMin(); TVector3 locpos; @@ -692,11 +665,11 @@ void AliPHOSEvalRecPoint::EvaluatePosition() Float_t ix, iy; GetLocalPosition(locpos); - Float_t e = GetEnergy(); + Float_t E = GetEnergy(); Float_t xc = locpos.Z(); Float_t yc = locpos.X(); Float_t dx,dy,gx,gy,grxc,gryc; - Float_t st = st0; + Float_t st = St0; Float_t chisq = 1.e+20; Float_t gr = 1.; Float_t grx = 0.; @@ -708,10 +681,10 @@ void AliPHOSEvalRecPoint::EvaluatePosition() Float_t cosi,x1=0,y1=0; Float_t chisqc; - AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance(); - const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); + const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); - for(Int_t iter=0; iterDigits()->At( digits[iDigit] ); - eDigit = energies[iDigit]; + Float_t* Energies = GetEnergiesList(); + Int_t* Digits = GetDigitsList(); + digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + eDigit = Energies[iDigit]; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, iy, ix); @@ -733,11 +706,11 @@ void AliPHOSEvalRecPoint::EvaluatePosition() if(!dx) dx=dy; if(!dy) dy=dx; - Float_t a; - GetReconstructionManager()->AG(e,dx,dy,a,gx,gy); + Float_t A; + GetReconstructionManager()->AG(E,dx,dy,A,gx,gy); Float_t dd; Info("EvaluatePosition", " (ix iy xc yc dx dy) %f %f %f %f %f %f", ix, iy, xc, yc, dx, dy) ; - Float_t chi2dg = GetReconstructionManager()->OneGamChi2(a,eDigit,e,dd); + Float_t chi2dg = GetReconstructionManager()->OneGamChi2(A,eDigit,E,dd); // Exclude digit with too large chisquare. if(chi2dg > 10) { continue; } @@ -770,11 +743,11 @@ void AliPHOSEvalRecPoint::EvaluatePosition() loop20: ; Float_t step = st*gr; - Info("EvaluatePosition", " Iteration %d dof %d chisq/dof %f chstop/dof %f step %d stpMin %d", - iter, dof, chisq/dof, chisq/dof, chstop/dof, step, stpMin) ; + Info("EvaluatePosition", " Iteration %d dof %d chisq/dof %f chstop/dof %f step %d Stpmin %d", + Iter, dof, chisq/dof, chisq/dof, chstop/dof, step, Stpmin) ; - if(step1.) @@ -792,7 +765,7 @@ void AliPHOSEvalRecPoint::EvaluatePosition() // } Float_t gamma1[3]; - gamma1[0] = e; + gamma1[0] = E; gamma1[1] = y1; gamma1[2] = x1; @@ -800,7 +773,7 @@ void AliPHOSEvalRecPoint::EvaluatePosition() //SetLocalPosition(newpos); fLocPos=newpos; - fAmp=e; + fAmp=E; // TVector3 pos; // RP->GetLocalPosition(pos); @@ -817,9 +790,9 @@ Bool_t AliPHOSEvalRecPoint::KillWeakPoint() // Remove this point from further procession // if it's energy is too small. - Float_t thr0 = GetReconstructionManager()->KillGamMinEnergy(); + Float_t Thr0 = GetReconstructionManager()->KillGamMinEnergy(); - if(GetEnergy()Digitizer(); + + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); +// AliPHOSDigitizer* digitizer = fLoader->Digitizer(); // Float_t fPedestal = digitizer->GetPedestal(); // YVK 30.09.2001 // Float_t fSlope = digitizer->GetSlope(); @@ -875,23 +848,23 @@ void AliPHOSEvalRecPoint::MergeClosePoint() this->GetLocalPosition(lpos1); rp->GetLocalPosition(lpos2); - Int_t* digits = rp->GetDigitsList(); + Int_t* Digits = rp->GetDigitsList(); Float_t dE = rp->GetEnergy()/(rp->GetEnergy()+this->GetEnergy()); - Float_t newX = lpos1.X()*dE + lpos2.X()*(1.-dE); - Float_t newZ = lpos1.Z()*dE + lpos2.Z()*(1.-dE); - Float_t newE = rp->GetEnergy()+this->GetEnergy(); - Float_t* energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList(); + Float_t new_x = lpos1.X()*dE + lpos2.X()*(1.-dE); + Float_t new_z = lpos1.Z()*dE + lpos2.Z()*(1.-dE); + Float_t new_E = rp->GetEnergy()+this->GetEnergy(); + Float_t* Energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList(); for(Int_t iDigit=0; iDigitGetDigitsMultiplicity(); iDigit++) { - AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At(digits[iDigit]); - Float_t eDigit = energies[iDigit]; + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At(Digits[iDigit]); + Float_t eDigit = Energies[iDigit]; this->AddDigit(*digit,eDigit); } - TVector3 newpos(newX,0,newZ); + TVector3 newpos(new_x,0,new_z); fLocPos = newpos; - fAmp = newE; + fAmp = new_E; RemoveFromWorkingPool(rp); delete rp; @@ -916,12 +889,12 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() AliPHOSDigit * maxAt[1000]; Float_t maxAtEnergy[1000]; - Float_t locMaxCut, logWeight; + Float_t LocMaxCut, LogWeight; Int_t relid[4] ; Float_t xMax; Float_t zMax; -// AliPHOSClusterizer* clusterizer = fGetter->Clusterizer("PHOSclu-v1"); +// AliPHOSClusterizer* clusterizer = fLoader->Clusterizer("PHOSclu-v1"); AliPHOSClusterizer* clusterizer = GetClusterizer(); if(!clusterizer) { Error("UnfoldLocalMaxima", "Cannot get clusterizer. Exit.") ; @@ -929,25 +902,25 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() } if(this->IsEmc()) { - locMaxCut = clusterizer->GetEmcLocalMaxCut(); - logWeight = clusterizer->GetEmcLogWeight(); + LocMaxCut = clusterizer->GetEmcLocalMaxCut(); + LogWeight = clusterizer->GetEmcLogWeight(); } else { - locMaxCut = clusterizer->GetCpvLocalMaxCut(); - logWeight = clusterizer->GetCpvLogWeight(); + LocMaxCut = clusterizer->GetCpvLocalMaxCut(); + LogWeight = clusterizer->GetCpvLogWeight(); } - AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance(); - const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry(); - TClonesArray* digits = fGetter->Digits(); + AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); + const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); + TClonesArray* digits = fLoader->Digits(); // if number of local maxima less then 2 - nothing to unfold - Int_t nMax = GetNumberOfLocalMax(maxAt,maxAtEnergy,locMaxCut,digits); - if(nMax<2) return nMax; + Int_t Nmax = GetNumberOfLocalMax(maxAt,maxAtEnergy,LocMaxCut,digits); + if(Nmax<2) return Nmax; - Int_t* digitsList = GetDigitsList(); + Int_t* Digits = GetDigitsList(); Int_t nDigits = GetMultiplicity(); - Float_t* energies = GetEnergiesList(); + Float_t* Energies = GetEnergiesList(); Float_t* eFit = new Float_t[nDigits]; Int_t iDigit; //loop variable @@ -960,12 +933,12 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() for(iDigit=0; iDigitDigits()->At( digitsList[iDigit] ); + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); fGeom->AbsToRelNumbering(digit->GetId(), relid) ; Float_t x,z; fGeom->RelPosInModule(relid, x, z); - for(Int_t iMax=0; iMaxRelPosInModule(relid, xMax, zMax); Float_t dx = xMax - x; Float_t dz = zMax - z; - Float_t amp,gx,gy; - GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy); -// amp = amp + 0.5; - eFit[iDigit] += amp; + Float_t Amp,gx,gy; + GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy); +// Amp = Amp + 0.5; + eFit[iDigit] += Amp; } } - for(Int_t iMax=0; iMaxAbsToRelNumbering(digitMax->GetId(), relid) ; @@ -994,8 +967,8 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() //Neighbous ( matrix 3x3 around the local maximum) for(Int_t iDigit=0; iDigitDigits()->At( digitsList[iDigit] ); - Float_t eDigit = energies[iDigit]; + AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); + Float_t eDigit = Energies[iDigit]; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; Float_t ix,iz; fGeom->RelPosInModule(relid, ix, iz); @@ -1004,17 +977,17 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() { Float_t dx = xMax - ix; Float_t dz = zMax - iz; - Float_t singleShowerGain,gxMax,gyMax; - GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax); - Float_t totalGain = eFit[iDigit]; - Float_t ratio = singleShowerGain/totalGain; + Float_t single_shower_gain,gxMax,gyMax; + GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax); + Float_t total_gain = eFit[iDigit]; + Float_t ratio = single_shower_gain/total_gain; Info("UnfoldLocalMaxima", " ratio -> %f", ratio) ; eDigit = eDigit*ratio; newRP->AddDigit(*digit,eDigit); } } - newRP->EvalLocalPosition(logWeight,digits); + newRP->EvalLocalPosition(LogWeight,digits); Info("UnfoldLocalMaxima", "======= Unfold: daughter rec point %d =================", iMax) ; newRP->Print(""); } @@ -1023,13 +996,12 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() delete[] eFit; - return nMax; + return Nmax; } void AliPHOSEvalRecPoint::PrintPoint(Option_t* opt) { - // print rec.point to stdout AliPHOSCpvRecPoint::Print(opt); TVector3 lpos; @@ -1044,7 +1016,7 @@ void AliPHOSEvalRecPoint::PrintPoint(Option_t* opt) AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const { - // returns reconstruction manager + TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); AliPHOSRecManager* recMng = (AliPHOSRecManager*)wPoolF->FindObject("AliPHOSRecManager"); @@ -1059,7 +1031,6 @@ AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent() { - // returns a parent if(fParent<0) return NULL; else return (AliPHOSRecPoint*)GetFromWorkingPool(fParent); @@ -1068,13 +1039,12 @@ AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent() Float_t AliPHOSEvalRecPoint::Chi2Dof() const { - // returns a chi^2 per degree of freedom return fChi2Dof; } const TObject* AliPHOSEvalRecPoint::GetWorkingPool() { - // returns a pool of rec.points + TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); TObject* wPool = wPoolF->FindObject("SmartPoints"); @@ -1088,32 +1058,46 @@ const TObject* AliPHOSEvalRecPoint::GetWorkingPool() void AliPHOSEvalRecPoint::AddToWorkingPool(TObject* obj) { - // add a rec.point to a pool ((TObjArray*)GetWorkingPool())->Add(obj); } TObject* AliPHOSEvalRecPoint::GetFromWorkingPool(Int_t i) { - // return a rec.point from a pool at an index i // return fWorkingPool->At(i); return ((TObjArray*)GetWorkingPool())->At(i); } Int_t AliPHOSEvalRecPoint::InWorkingPool() { - // return the number of rec.points in a pool return ((TObjArray*)GetWorkingPool())->GetEntries(); } void AliPHOSEvalRecPoint::RemoveFromWorkingPool(TObject* obj) { - // remove a rec.point from a pool ((TObjArray*)GetWorkingPool())->Remove(obj); ((TObjArray*)GetWorkingPool())->Compress(); } void AliPHOSEvalRecPoint::PrintWorkingPool() { - // print pool of rec.points to stdout ((TObjArray*)GetWorkingPool())->Print(""); } + +void AliPHOSEvalRecPoint::SetEventFolderName(const char* evfname) +{//Sets event folder name + fEventFolderName = evfname; +} + + + + + + + + + + + + + + diff --git a/PHOS/AliPHOSEvalRecPoint.h b/PHOS/AliPHOSEvalRecPoint.h index 6282a89bd60..85790e08bd6 100644 --- a/PHOS/AliPHOSEvalRecPoint.h +++ b/PHOS/AliPHOSEvalRecPoint.h @@ -6,9 +6,11 @@ #include "AliPHOSCpvRecPoint.h" -#include "AliPHOSClusterizer.h" -#include "AliPHOSRecPoint.h" -#include "AliPHOSRecManager.h" + +class AliPHOSClusterizer; +class AliPHOSRecPoint; +class AliPHOSRecManager; +class TString; class AliPHOSEvalRecPoint : public AliPHOSCpvRecPoint { @@ -54,8 +56,9 @@ public: Int_t InWorkingPool(); void RemoveFromWorkingPool(TObject* obj); void PrintWorkingPool(); - - enum RecPointType {kEmc,kCpv}; + + enum RecPointType {emc,cpv}; + void SetEventFolderName(const char* evfname); private: @@ -66,11 +69,13 @@ private: private: - Bool_t fIsEmc; // true if EMC - Bool_t fIsCpv; // true if CPV - Int_t fParent; // parent - Float_t fChi2Dof; // chi^2 per degree of freedom - + Bool_t fIsEmc; + Bool_t fIsCpv; + Int_t fParent; + Float_t fChi2Dof; + + TString fEventFolderName; + ClassDef(AliPHOSEvalRecPoint,1) }; diff --git a/PHOS/AliPHOSFastGlobalReconstruction.cxx b/PHOS/AliPHOSFastGlobalReconstruction.cxx index c2f1fd05e27..72ddac2c31b 100644 --- a/PHOS/AliPHOSFastGlobalReconstruction.cxx +++ b/PHOS/AliPHOSFastGlobalReconstruction.cxx @@ -48,7 +48,7 @@ AliPHOSFastGlobalReconstruction::AliPHOSFastGlobalReconstruction(const char* hea // create an instance of the PHOS getter, // create an array or reconstructed particles. - gime = AliPHOSGetter::GetInstance(headerFile); + gime = AliPHOSGetter::Instance(headerFile); fGenerator = gAlice->Generator(); fParticles = new TClonesArray("TParticle",100); fNParticles = 0; @@ -76,7 +76,7 @@ void AliPHOSFastGlobalReconstruction::FastReconstruction(Int_t event) TLorentzVector p,v; Int_t kf,ks,imom1,imom2,idaug1,idaug2; - gime->Event(event,"P") ; + gime->Event(event,"X") ; fParticles ->Clear(); fNParticles = 0; Int_t nPrimaries = gime->NPrimaries(); diff --git a/PHOS/AliPHOSGeometry.cxx b/PHOS/AliPHOSGeometry.cxx index fb46effd177..a68745cb14e 100644 --- a/PHOS/AliPHOSGeometry.cxx +++ b/PHOS/AliPHOSGeometry.cxx @@ -50,19 +50,6 @@ ClassImp(AliPHOSGeometry) ; AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ; Bool_t AliPHOSGeometry::fgInit = kFALSE ; -//____________________________________________________________________________ -AliPHOSGeometry::AliPHOSGeometry(void) -{ - // default ctor - // must be kept public for root persistency purposes, - // but should never be called by the outside world - fPHOSAngle = 0 ; - fGeometryEMCA = 0; - fGeometrySUPP = 0; - fGeometryCPV = 0; - fgGeom = 0; - fRotMatrixArray = 0; -} //____________________________________________________________________________ AliPHOSGeometry::~AliPHOSGeometry(void) { @@ -230,16 +217,17 @@ void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ; Float_t y0 = GetIPtoCrystalSurface() ; - Float_t x0 = GetCellStep()*GetNPhi() ; - Float_t z0 = GetCellStep()*GetNZ(); - Double_t angle = TMath::ATan( x0 / y0 / 2 ) ; + Float_t * strip = fGeometryEMCA->GetStripHalfSize() ; + Float_t x0 = fGeometryEMCA->GetNStripX()*strip[0] ; + Float_t z0 = fGeometryEMCA->GetNStripZ()*strip[2] ; + Double_t angle = TMath::ATan( x0 / y0 ) ; phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 220 and 320 deg.) Double_t max = phi - angle ; Double_t min = phi + angle ; pM = TMath::Max(max, min) * conv ; pm = TMath::Min(max, min) * conv ; - angle = TMath::ATan( z0 / y0 / 2 ) ; + angle = TMath::ATan( z0 / y0 ) ; max = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.) min = TMath::Pi() / 2. - angle ; tM = TMath::Max(max, min) * conv ; @@ -335,43 +323,35 @@ void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_ // calculates the impact coordinates on PHOS of a neutral particle // emitted in the direction theta and phi in the ALICE global coordinate system - //Convert phi to range 0-2pi if nesassary - Double_t phiin2pi = phi ; - while(phiin2pi<0) - phiin2pi+=6.2831853072 ; - // searches for the PHOS EMC module ModuleNumber = 0 ; Double_t tm, tM, pm, pM ; Int_t index = 1 ; while ( ModuleNumber == 0 && index <= GetNModules() ) { EmcModuleCoverage(index, tm, tM, pm, pM) ; - if ( (theta >= tm && theta <= tM) && (phiin2pi >= pm && phiin2pi <= pM ) ) + if ( (theta >= tm && theta <= tM) && (phi >= pm && phi <= pM ) ) ModuleNumber = index ; index++ ; } if ( ModuleNumber != 0 ) { Float_t phi0 = GetPHOSAngle(ModuleNumber) * (TMath::Pi() / 180.) + 1.5 * TMath::Pi() ; Float_t y0 = GetIPtoCrystalSurface() ; - Double_t angle = phiin2pi - phi0; + Double_t angle = phi - phi0; x = y0 * TMath::Tan(angle) ; angle = theta - TMath::Pi() / 2 ; z = y0 * TMath::Tan(angle) ; } } -//____________________________________________________________________________ Bool_t AliPHOSGeometry::Impact(const TParticle * particle) const { - // Check if a particle being propagates from IP along the straight line impacts EMC - - Bool_t in=kFALSE; - Int_t moduleNumber=0; + Bool_t In=kFALSE; + Int_t ModuleNumber=0; Double_t z,x; - ImpactOnEmc(particle->Theta(),particle->Phi(),moduleNumber,z,x); - if(moduleNumber) in=kTRUE; - else in=kFALSE; - return in; + ImpactOnEmc(particle->Theta(),particle->Phi(),ModuleNumber,z,x); + if(ModuleNumber) In=kTRUE; + else In=kFALSE; + return In; } //____________________________________________________________________________ @@ -403,24 +383,7 @@ Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) c } //____________________________________________________________________________ -void AliPHOSGeometry::RelPosToAbsId(const Int_t module , const Double_t x, const Double_t z, Int_t & AbsId)const{ - // Converts local PHOS-module (x, z) coordinates to absId - if(!module){ - AbsId = 0 ; - return ; - } - - Int_t relid[4] ; - relid[0] = module ; - relid[1] = 0 ; - relid[2] = static_cast(TMath::Ceil(GetNPhi()/2.+ x/GetCellStep())); - relid[3] = static_cast(TMath::Ceil(GetNZ()/2. - z/GetCellStep())) ; - - RelToAbsNumbering(relid,AbsId) ; - -} -//____________________________________________________________________________ void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) const { // Converts the absolute numbering into the global ALICE coordinate system diff --git a/PHOS/AliPHOSGeometry.h b/PHOS/AliPHOSGeometry.h index 6ea980602ce..4aeef87ce50 100644 --- a/PHOS/AliPHOSGeometry.h +++ b/PHOS/AliPHOSGeometry.h @@ -16,6 +16,8 @@ // //*-- Author: Yves Schutz (SUBATECH) +#include + // --- ROOT system --- #include "TString.h" @@ -36,11 +38,20 @@ class AliPHOSGeometry : public AliGeometry { public: - AliPHOSGeometry() ; + AliPHOSGeometry() { + // default ctor + // must be kept public for root persistency purposes, but should never be called by the outside world + fPHOSAngle = 0 ; + fGeometryEMCA = 0; + fGeometrySUPP = 0; + fGeometryCPV = 0; + fgGeom = 0; + fRotMatrixArray = 0; } AliPHOSGeometry(const AliPHOSGeometry & geom) { // cpy ctor requested by Coding Convention but not yet needed - Fatal("cpy ctor", "not implemented") ; + + assert(0==1) ; } virtual ~AliPHOSGeometry(void) ; @@ -52,7 +63,8 @@ public: AliPHOSGeometry & operator = (const AliPHOSGeometry & rvalue) const { // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *(GetInstance()) ; + assert(0==1) ; + return *(GetInstance()) ; } // General @@ -82,7 +94,7 @@ public: // gets the position of element (pad or Xtal) relative to Alice Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ; // converts the absolute PHOS numbering to a relative - void RelPosToAbsId(const Int_t module , const Double_t x, const Double_t z, Int_t & AbsId)const; // Converts local PHOS-module (x, z) coordinates to absId + Bool_t IsInitialized(void) const { return fgInit ; } // Return general PHOS parameters diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index d52cb66c5a2..c1c7470d78e 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -49,426 +49,365 @@ ////////////////////////////////////////////////////////////////////////////// // --- ROOT system --- + +#include "TSystem.h" #include "TFile.h" -#include "TTree.h" #include "TROOT.h" -#include "TObjString.h" -#include "TFolder.h" -#include "TParticle.h" + // --- Standard library --- // --- AliRoot header files --- -#include "AliRun.h" -#include "AliConfig.h" + #include "AliPHOSGetter.h" -#include "AliPHOS.h" -#include "AliPHOSDigitizer.h" -#include "AliPHOSSDigitizer.h" -#include "AliPHOSClusterizerv1.h" -#include "AliPHOSTrackSegmentMakerv1.h" -#include "AliPHOSTrackSegment.h" -#include "AliPHOSPIDv1.h" -#include "AliPHOSGeometry.h" -#include "AliPHOSRaw2Digits.h" +#include "AliRunLoader.h" +#include "AliStack.h" +#include "AliPHOSLoader.h" +// #include "AliPHOSRaw2Digits.h" //#include "AliPHOSCalibrationDB.h" #include "AliPHOSBeamTestEvent.h" + ClassImp(AliPHOSGetter) - AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; - TFile * AliPHOSGetter::fgFile = 0 ; +AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; +AliPHOSLoader * AliPHOSGetter::fgPhosLoader = 0; +Int_t AliPHOSGetter::fgDebug = 0; + +// TFile * AliPHOSGetter::fgFile = 0 ; //____________________________________________________________________________ -AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit ) +AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption) { - // This is the ctor called by GetInstance and the only one that can be used + // ctor only called by Instance() - if( fHeaderFile.Contains("_") ) { - Fatal("AliPHOSGetter", "Invalid file name (_ not allowed) %s", fHeaderFile.Data() ) ; + AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ; + if (!rl) { + rl = AliRunLoader::Open(headerFile, version, openingOption); + if (!rl) { + Fatal("AliPHOSGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ; + return ; + } + if (rl->GetAliRun() == 0x0) { + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); // should be removed + } } + fgPhosLoader = dynamic_cast(rl->GetLoader("PHOSLoader")); + if ( !fgPhosLoader ) + Error("AliPHOSGetter", "Could not find PHOSLoader") ; + else + fgPhosLoader->SetTitle(version); + + + // initialize data members + SetDebug(0) ; + fBTE = 0 ; + fPrimaries = 0 ; + fLoadingStatus = "" ; +} - //Initialize all data - - fFailed = kFALSE ; - fDebug = 0 ; - fAlice = 0 ; - fBTE = 0 ; +//____________________________________________________________________________ +AliPHOSGetter::~AliPHOSGetter() +{ + // dtor + delete fgPhosLoader ; + fgPhosLoader = 0 ; + delete fBTE ; + fBTE = 0 ; + fPrimaries->Delete() ; + delete fPrimaries ; +} - fToSplit = toSplit ; - fHeaderFile = headerFile ; +//____________________________________________________________________________ +AliPHOSClusterizer * AliPHOSGetter::Clusterizer() +{ + AliPHOSClusterizer * rv ; + rv = dynamic_cast(PhosLoader()->Reconstructioner()) ; + if (!rv) { + Event(0, "R") ; + rv = dynamic_cast(PhosLoader()->Reconstructioner()) ; + } + return rv ; +} - fPrimaries = new TObjArray(1) ; +//____________________________________________________________________________ +TObjArray * AliPHOSGetter::CpvRecPoints() +{ + // asks the Loader to return the CPV RecPoints container - fModuleFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); - fPrimariesFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data")); - fHitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); - fSDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); - fDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/Data")); - fRecoFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/RecData")); - fQAFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); - fTasksFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Tasks")) ; + TObjArray * rv = 0 ; + + rv = PhosLoader()->CpvRecPoints() ; + if (!rv) { + PhosLoader()->MakeRecPointsArray() ; + rv = PhosLoader()->CpvRecPoints() ; + } + return rv ; +} - //Set titles to branches and create PHOS specific folders - SetTitle(branchTitle) ; +//____________________________________________________________________________ +TClonesArray * AliPHOSGetter::Digits() +{ + // asks the Loader to return the Digits container - if ( fHeaderFile != "aliroot" ) { // to call the getter without a file - //open headers file - fgFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; + TClonesArray * rv = 0 ; + rv = PhosLoader()->Digits() ; - if(!fgFile) { //if file was not opened yet, read gAlice - fgFile = TFile::Open(fHeaderFile.Data(),"update") ; - if (!fgFile->IsOpen()) { - Error("AliPHOSGetter", "Cannot open %s", fHeaderFile.Data() ) ; - fFailed = kTRUE ; - return ; - } - } - gAlice = dynamic_cast(fgFile->Get("gAlice")) ; - } - - if (!gAlice) { - Error("AliPHOSGetter", "Cannot find gAlice in %s", fHeaderFile.Data() ) ; - fFailed = kTRUE ; - return ; - } - if (!PHOS()) { - if (fDebug) - Info("AliPHOSGetter", "-> Posting PHOS to Folders") ; - if (gAlice->GetDetector("PHOS")) { - AliConfig * conf = AliConfig::Instance() ; - conf->Add(static_cast(gAlice->GetDetector("PHOS"))) ; - conf->Add(static_cast(gAlice->GetDetector("PHOS"))) ; - } - else - Error("AliPHOSGetter", "detector PHOS not found") ; + if( !rv ) { + PhosLoader()->MakeDigitsArray() ; + rv = PhosLoader()->Digits() ; } + return rv ; +} - fDebug=0; +//____________________________________________________________________________ +AliPHOSDigitizer * AliPHOSGetter::Digitizer() +{ + AliPHOSDigitizer * rv ; + rv = dynamic_cast(PhosLoader()->Digitizer()) ; + if (!rv) { + Event(0, "D") ; + rv = dynamic_cast(PhosLoader()->Digitizer()) ; + } + return rv ; } + //____________________________________________________________________________ -AliPHOSGetter::~AliPHOSGetter() +TObjArray * AliPHOSGetter::EmcRecPoints() { - // dtor - if (fPrimaries) { - fPrimaries->Delete() ; - delete fPrimaries ; - } + // asks the Loader to return the EMC RecPoints container - TFolder * phosF = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - TCollection * folderslist = phosF->GetListOfFolders() ; - TIter next(folderslist) ; - TFolder * folder = 0 ; - while ( (folder = static_cast(next())) ) - phosF->Remove(folder) ; + TObjArray * rv = 0 ; - if (fgFile) { - fgFile->Close() ; - delete fgFile ; - fgFile = 0 ; + rv = PhosLoader()->EmcRecPoints() ; + if (!rv) { + PhosLoader()->MakeRecPointsArray() ; + rv = PhosLoader()->EmcRecPoints() ; } - fgObjGetter = 0 ; - + return rv ; } //____________________________________________________________________________ -void AliPHOSGetter::CloseFile() +TClonesArray * AliPHOSGetter::TrackSegments() { - // delete gAlice - - if(gAlice) - delete gAlice ; - gAlice = 0 ; - if(fAlice) - delete fAlice ; - fAlice = 0 ; + // asks the Loader to return the TrackSegments container + + TClonesArray * rv = 0 ; + + rv = PhosLoader()->TrackSegments() ; + if (!rv) { + PhosLoader()->MakeTrackSegmentsArray() ; + rv = PhosLoader()->TrackSegments() ; + } + return rv ; } //____________________________________________________________________________ -const TFolder * AliPHOSGetter::Folder(const TString what) const { - - // returns the PHOS folder required by what - // what = hits, sdigits, digits - - if ( what == "hits" ) - return dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - else if ( what == "sdigits" ) - return dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - else if ( what == "digits" ) - return dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - else { - Error("GetFolder", " %s illegal option (hits, sdigits, digits)", what.Data() ) ; - return 0 ; +AliPHOSTrackSegmentMaker * AliPHOSGetter::TrackSegmentMaker() +{ + AliPHOSTrackSegmentMaker * rv ; + rv = dynamic_cast(PhosLoader()->TrackSegmentMaker()) ; + if (!rv) { + Event(0, "T") ; + rv = dynamic_cast(PhosLoader()->TrackSegmentMaker()) ; } + return rv ; } //____________________________________________________________________________ -AliPHOSGetter * AliPHOSGetter::GetInstance() +TClonesArray * AliPHOSGetter::RecParticles() { - // Returns the pointer of the unique instance already defined + // asks the Loader to return the TrackSegments container + + TClonesArray * rv = 0 ; - if ( fgObjGetter ) { - return fgObjGetter ; - } - else { - //Warning("GetInstance", "not yet initialized") ; - return 0 ; + rv = PhosLoader()->RecParticles() ; + if (!rv) { + PhosLoader()->MakeRecParticlesArray() ; + rv = PhosLoader()->RecParticles() ; } + return rv ; } - //____________________________________________________________________________ -AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile, - const char* branchTitle, - const Bool_t toSplit) +void AliPHOSGetter::Event(const Int_t event, const char* opt) { - // Creates and returns the pointer of the unique instance - // Must be called only when the environment has changed + // Reads the content of all Tree's S, D and R - if(!fgObjGetter){ - fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ; - if(fgObjGetter->fFailed) - return 0; - else - return fgObjGetter ; + if ( event >= MaxEvent() ) { + Error("Event", "%d not found in TreeE !", event) ; + return ; } - //First checks, if header file already opened - if(!fgObjGetter->fgFile){ - fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ; - if(fgObjGetter->fFailed) - return 0; - else - return fgObjGetter ; - } + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); - if(fgObjGetter->fHeaderFile.CompareTo(headerFile)==0){ //Opened the same header file - if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0)&& //Open the same branch title - (toSplit==fgObjGetter->fToSplit)){ //Nothing should be cleaned - } - else{ //Clean all data and AliPHOS...zers - if(fgObjGetter->fToSplit) - fgObjGetter->CloseSplitFiles() ; - fgObjGetter->CleanWhiteBoard() ; - fgObjGetter->fToSplit = toSplit ; - fgObjGetter->SetTitle(branchTitle) ; - } + // checks if we are dealing with test-beam data + TBranch * btb = rl->TreeE()->GetBranch("AliPHOSBeamTestEvent") ; + if(btb){ + if(!fBTE) + fBTE = new AliPHOSBeamTestEvent() ; + btb->SetAddress(&fBTE) ; + btb->GetEntry(event) ; } - else{ //Close already opened files, clean memory and open new header file - if(gAlice){ //should first delete gAlice, then close file - //Should be in dtor of PHOS, but if one changes path ... - fgObjGetter->fModuleFolder->Remove(fgObjGetter->fModuleFolder->FindObject("PHOS")) ; - delete gAlice ; - } - if(fgObjGetter->fgFile){ - fgObjGetter->fgFile->Close() ; - fgObjGetter->fgFile=0; + else{ + if(fBTE){ + delete fBTE ; + fBTE = 0 ; } - if(fgObjGetter->fToSplit) - fgObjGetter->CloseSplitFiles() ; - fgObjGetter->CleanWhiteBoard() ; - fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ; - } - return fgObjGetter ; + + // Loads the type of object(s) requested + rl->GetEvent(event) ; + + if( strstr(opt,"X") || (strcmp(opt,"")==0) ) + ReadPrimaries() ; + + if(strstr(opt,"H") ) + ReadTreeH(); + + if(strstr(opt,"S") ) + ReadTreeS() ; + + if( strstr(opt,"D") ) + ReadTreeD() ; + + if( strstr(opt,"R") ) + ReadTreeR() ; + + if( strstr(opt,"T") ) + ReadTreeT() ; + + if( strstr(opt,"P") ) + ReadTreeP() ; + +// if( strstr(opt,"Q") ) +// ReadTreeQA() ; + +} + + +//____________________________________________________________________________ +Int_t AliPHOSGetter::EventNumber() const + { + // return the current event number + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); + return static_cast(rl->GetEventNumber()) ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::BranchExists(const TString recName) const + TClonesArray * AliPHOSGetter::Hits() { - //Looks in the tree Tree"name" if branch with current name olready exists - - TString filename("") ; - TString name, dataname, zername ; - if(recName == "SDigits"){ - filename=fSDigitsFileName ; - name = "TreeS0" ; - dataname = "PHOS" ; - zername = "AliPHOSSDigitizer" ; - } - else - if(recName == "Digits"){ - filename=fDigitsFileName ; - name = "TreeD0" ; - dataname = "PHOS" ; - zername = "AliPHOSDigitizer" ; - } - else - if(recName == "RecPoints"){ - filename=fRecPointsFileName ; - name = "TreeR0" ; - dataname = "PHOSEmcRP" ; - zername = "AliPHOSClusterizer" ; - } - else - if(recName == "TrackSegments"){ - filename=fTrackSegmentsFileName ; - name = "TreeR0" ; - dataname = "PHOSTS" ; - zername = "AliPHOSTrackSegmentMaker" ; - } - else - if(recName == "RecParticles"){ - filename= fRecParticlesFileName ; - name = "TreeR0" ; - dataname = "PHOSRP" ; - zername = "AliPHOSPID" ; - } - else - return kFALSE ; - - TFile * file ; - TTree * tree ; - if(fToSplit){ - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - if(!file) - file = TFile::Open(fSDigitsFileName.Data(),"update"); + // asks the loader to return the Hits container + + TClonesArray * rv = 0 ; + + rv = PhosLoader()->Hits() ; + if ( !rv ) { + PhosLoader()->LoadHits("read"); + rv = PhosLoader()->Hits() ; } - else - file = fgFile ; + return rv ; +} - tree = (TTree *)file->Get(name.Data()) ; +//____________________________________________________________________________ +AliPHOSGetter * AliPHOSGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption) +{ + // Creates and returns the pointer of the unique instance + // Must be called only when the environment has changed - if(!tree ) - return kFALSE ; - - TObjArray * lob = static_cast(tree->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TString titleName(fBranchTitle); - titleName+=":"; - while ((branch = (static_cast(next())))) { - TString branchName(branch->GetName() ) ; - TString branchTitle(branch->GetTitle() ) ; - if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){ - Warning("BranchExists", "branch %s with title %s already exists in %s", dataname.Data(), fBranchTitle.Data(), name.Data() ) ; - return kTRUE ; - } - if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){ - Warning("BranchExists", "branch AliPHOS... with title %s already exists in %s", branch->GetTitle(), name.Data() ) ; - return kTRUE ; - } + //::Info("Instance","alirunFileName=%s version=%s openingOption=%s",alirunFileName,version,openingOption); + + if(!fgObjGetter){ // first time the getter is called + fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; } - //We can't delete three if gAlice points to it... To be redisigned somehow???!!! - if(!fToSplit){ - if(name.Contains("TreeS")) - if(tree!=gAlice->TreeS()) - tree->Delete(); - if(name.Contains("TreeD")) - if(tree!=gAlice->TreeD()) - tree->Delete(); - if(name.Contains("TreeR")) - if(tree!=gAlice->TreeR()) - tree->Delete(); + else { // the getter has been called previously + AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()); + if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name + // check if the file is already open + TFile * galiceFile = dynamic_cast(gROOT->FindObject(rl->GetFileName()) ) ; + + if ( !galiceFile ) + fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; + + else { // the file is already open check the version name + TString currentVersionName = rl->GetEventFolder()->GetName() ; + TString newVersionName(version) ; + if (currentVersionName == newVersionName) + if(fgDebug) + ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ; + else { + fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; + } + } + } + else + fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; } - return kFALSE ; + if (!fgObjGetter) + ::Error("Instance", "Failed to create the PHOS Getter object") ; + else + if (fgDebug) + Print() ; + return fgObjGetter ; } //____________________________________________________________________________ -void AliPHOSGetter::ListBranches(Int_t event) const +AliPHOSGetter * AliPHOSGetter::Instance() { - // Iterates over branches in each TreeH, TreeS, TreeD and TreeR and - // prints lists of branches to stdout - // (I don't know why this method is needed. Yu.Kharlov) - - TBranch * branch = 0 ; - if (gAlice->GetEvent(event) == -1) - return ; - - TTree * t = gAlice->TreeH() ; - if(t){ - Info("ListBranches", "-> ****** Hits : ") ; - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; - while ( (branch = static_cast(next())) ) - Info("ListBranches", " %s", branch->GetName()) ; - } else - Warning("ListBranches", "TreeH not found for event %d", event ) ; - - t = gAlice->TreeS() ; - if(t){ - Info("ListBranches", "-> ****** SDigits : ") ; - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; - while ( (branch = static_cast(next())) ) - Info("ListBranches", " %s %s", branch->GetName(), branch->GetTitle()) ; - } else - Warning("ListBranches", "TreeS not found for event %d", event) ; - - - t = gAlice->TreeD() ; - if(t){ - Info("ListBranches", "-> ****** Digits : ") ; - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; - while ( (branch = static_cast(next())) ) - Info("ListBranches", " %s %s", branch->GetName(), branch->GetTitle()) ; - } else - Warning("ListBranches", "TreeD not found for event %d", event) ; + // Returns the pointer of the unique instance already defined + if(!fgObjGetter) + ::Error("Instance", "Getter not initialized") ; - t = gAlice->TreeR() ; - if(t){ - Info("ListBranches", "-> ****** Recon : ") ; - TObjArray * lob = t->GetListOfBranches() ; - TIter next(lob) ; - while ( (branch = static_cast(next())) ) - Info("ListBranches", " %s %s", branch->GetName(), branch->GetTitle()) ; - } else - Warning("ListBranches", "TreeR not found for event %d", event) ; - + return fgObjGetter ; + } //____________________________________________________________________________ -void AliPHOSGetter::NewBranch(TString name, Int_t event) +Int_t AliPHOSGetter::MaxEvent() const { - // Set titles for (S)Digits, RecPoints, TSegments and RecParticles branches + // returns the number of events in the run (from TE) - fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ; - Event(event) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); + return static_cast(rl->GetNumberOfEvents()) ; } //____________________________________________________________________________ -Bool_t AliPHOSGetter::NewFile(TString name) +TParticle * AliPHOSGetter::Primary(Int_t index) const { - // Open a new file - fHeaderFile = name ; - fgFile->Close() ; - fFailed = kFALSE; - - fgFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - if(!fgFile) { //if file was not opened yet, read gAlice - fgFile = TFile::Open(fHeaderFile.Data(),"update") ; - if (!fgFile->IsOpen()) { - Error("NewFile", "Cannot open %s", fHeaderFile.Data() ) ; - fFailed = kTRUE ; - return fFailed ; - } - gAlice = static_cast(fgFile->Get("gAlice")) ; - } - - if (!gAlice) { - Error("AliPHOSGetter", "Cannot find gAlice in %s", fHeaderFile.Data() ) ; - fFailed = kTRUE ; - return fFailed ; - } - return fFailed ; -} + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); + return rl->Stack()->Particle(index) ; +} //____________________________________________________________________________ -const AliPHOS * AliPHOSGetter::PHOS() +AliPHOS * AliPHOSGetter:: PHOS() const { // returns the PHOS object - AliPHOS * phos = dynamic_cast(fModuleFolder->FindObject("PHOS")) ; + AliPHOS * phos = dynamic_cast(PhosLoader()->GetModulesFolder()->FindObject("PHOS")) ; if (!phos) - if (fDebug) - Warning("PHOS", "-> PHOS module not found in Folders") ; + if (fgDebug) + Warning("PHOS", "PHOS module not found in module folders: %s", PhosLoader()->GetModulesFolder()->GetName() ) ; return phos ; } + + +//____________________________________________________________________________ +AliPHOSPID * AliPHOSGetter::PID() +{ + AliPHOSPID * rv ; + rv = dynamic_cast(PhosLoader()->PIDTask()) ; + if (!rv) { + Event(0, "P") ; + rv = dynamic_cast(PhosLoader()->PIDTask()) ; + } + return rv ; +} + //____________________________________________________________________________ -const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() +AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const { // Returns PHOS geometry @@ -479,842 +418,328 @@ const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostPrimaries(void) const -{ //------- Primaries ---------------------- +TClonesArray * AliPHOSGetter::Primaries() +{ + // creates the Primaries container if needed + if ( !fPrimaries ) { + if (fgDebug) + Info("Primaries", "Creating a new TClonesArray for primaries") ; + fPrimaries = new TClonesArray("TParticle", 1000) ; + } + return fPrimaries ; +} + +//____________________________________________________________________________ +void AliPHOSGetter::Print() +{ + // Print usefull information about the getter + + AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()); + ::Info( "Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ; +} - // the hierarchy is //Folders/RunMC/Event/Data/Primaries +//____________________________________________________________________________ +void AliPHOSGetter::ReadPrimaries() +{ + // Read Primaries from Kinematics.root - TFolder * primariesFolder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; - if ( !primariesFolder ) { - if (fDebug) { - Warning("PostPrimaries", "-> Folder //%s/Primaries/ not found!", fPrimariesFolder->GetName()) ; - Info("PostPrimaries", "-> Adding Folder //%s/Primaries", fPrimariesFolder->GetName()) ; - } - primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ; - } - TClonesArray *primaries= new TClonesArray("TParticle",1000) ; - primaries->SetName("Primaries") ; - primariesFolder->Add(primaries) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); - return kTRUE; -} + // gets kine tree from the root file (Kinematics.root) + if ( ! rl->TreeK() ) // load treeK the first time + rl->LoadKinematics() ; + + fNPrimaries = rl->Stack()->GetNtrack() ; + + if (fgDebug) + Info( "ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ; -//____________________________________________________________________________ -TObject** AliPHOSGetter::PrimariesRef(void) const -{ //------- Primaries ---------------------- + // first time creates the container + if ( Primaries() ) + fPrimaries->Clear() ; - // the hierarchy is //Folders/RunMC/Event/Data/Primaries - if ( !fPrimariesFolder ) { - Fatal("PrimariesRef", "Folder //%s not found", fPrimariesFolder) ; - } - - TFolder * primariesFolder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; - if ( !primariesFolder ) { - Fatal("PrimariesRef", "Folder //%s/Primaries/ not found", fPrimariesFolder) ; - } - - TObject * p = primariesFolder->FindObject("Primaries") ; - if(!p) { - Fatal("PrimariesRef","%s /Primaries not found !", primariesFolder->GetName() ) ; + Int_t index = 0 ; + for (index = 0 ; index < fNPrimaries; index++) { + new ((*fPrimaries)[index]) TParticle(*(Primary(index))); } - - return primariesFolder->GetListOfFolders()->GetObjectRef(p) ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostHits(void) const -{ //------- Hits ---------------------- - - // the hierarchy is //Folders/RunMC/Event/Data/PHOS/Hits +Int_t AliPHOSGetter::ReadTreeD() +{ + // Read the Digits - TFolder * phosFolder = dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - if (fDebug) { - Warning("PostHits", "-> Folder //%s/PHOS/ not found!", fHitsFolder) ; - Info("PostHits", "-> Adding Folder //%s/PHOS/", fHitsFolder) ; - } - phosFolder = fHitsFolder->AddFolder("PHOS", "Hits from PHOS") ; - } - TClonesArray *hits= new TClonesArray("AliPHOSHit",1000) ; - hits->SetName("Hits") ; - phosFolder->Add(hits) ; - return kTRUE; -} + // gets TreeD from the root file (PHOS.SDigits.root) + if ( !IsLoaded("D") ) { + PhosLoader()->LoadDigits("UPDATE") ; + PhosLoader()->LoadDigitizer("UPDATE") ; + SetLoaded("D") ; + } + return Digits()->GetEntries() ; +} //____________________________________________________________________________ -TObject** AliPHOSGetter::HitsRef(void) const -{ //------- Hits ---------------------- +Int_t AliPHOSGetter::ReadTreeH() +{ + // Read the Hits + + // gets TreeH from the root file (PHOS.Hit.root) + if ( !IsLoaded("H") ) { + PhosLoader()->LoadHits("UPDATE") ; + SetLoaded("H") ; + } + return Hits()->GetEntries() ; +} +//____________________________________________________________________________ +Int_t AliPHOSGetter::ReadTreeR() +{ + // Read the RecPoints - // the hierarchy is //Folders/RunMC/Event/Data/PHOS/Hits - if ( !fHitsFolder ) { - Fatal("HitsRef", "Folder //%s not found !", fHitsFolder) ; - } - - TFolder * phosFolder = dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - Fatal("HitsRef", "Folder //%s/PHOS/ not found !", fHitsFolder) ; - } - - TObject * h = phosFolder->FindObject("Hits") ; - if(!h) { - Fatal("HitsRef", "%s/Hits not fount !", phosFolder->GetName() ) ; + + // gets TreeR from the root file (PHOS.RecPoints.root) + if ( !IsLoaded("R") ) { + PhosLoader()->LoadRecPoints("UPDATE") ; + PhosLoader()->LoadClusterizer("UPDATE") ; + SetLoaded("R") ; } - return phosFolder->GetListOfFolders()->GetObjectRef(h) ; + return EmcRecPoints()->GetEntries() ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostSDigits(const char * name, const char * headerFile) const -{ //---------- SDigits ------------------------- - - - // the hierarchy is //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname - // because you can have sdigits from several hit files for mixing +Int_t AliPHOSGetter::ReadTreeT() +{ + // Read the TrackSegments - TFolder * phosFolder = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - if (fDebug) { - Warning("PostSDigits", "-> Folder //%s/PHOS/ not found!", fSDigitsFolder) ; - Info("PostSDigits", "-> Adding Folder //%s/PHOS/", fHitsFolder) ; - } - phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ; - } - - TString subdir(headerFile) ; - if(fToSplit){ - subdir.Remove(subdir.Last('/')+1,subdir.Length()) ; - subdir.ReplaceAll("/","_") ; - subdir+="PHOS.SDigits." ; - if(name && (strcmp(name,"Default")!=0)){ - subdir+=name ; - subdir+="." ; - } - subdir+="root" ; + // gets TreeT from the root file (PHOS.TrackSegments.root) + if ( !IsLoaded("T") ) { + PhosLoader()->LoadTracks("UPDATE") ; + PhosLoader()->LoadTrackSegmentMaker("UPDATE") ; + SetLoaded("T") ; } - - TFolder * phosSubFolder = dynamic_cast(phosFolder->FindObject(subdir)) ; - if ( !phosSubFolder ) - phosSubFolder = phosFolder->AddFolder(subdir, ""); - - TObject * sd = phosSubFolder->FindObject(name); - if ( !sd ) { - TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1) ; - sdigits->SetName(name) ; - phosSubFolder->Add(sdigits) ; - } - - return kTRUE; -} + return TrackSegments()->GetEntries() ; +} //____________________________________________________________________________ -TObject** AliPHOSGetter::SDigitsRef(const char * name, const char * foldername) const -{ //------- SDigits ---------------------- +Int_t AliPHOSGetter::ReadTreeP() +{ + // Read the TrackSegments - // the hierarchy is //Folders/RunMC/Event/Data/PHOS/SDigits/filename/SDigits - - if ( !fSDigitsFolder ) { - Fatal("SDigitsRef", "Folder //%s not found !", fSDigitsFolder) ; - } - - TFolder * phosFolder = static_cast(fSDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - Fatal("SDigitsRef", "Folder //%s/PHOS not found !", fSDigitsFolder) ; + + // gets TreeT from the root file (PHOS.TrackSegments.root) + if ( !IsLoaded("P") ) { + PhosLoader()->LoadRecParticles("UPDATE") ; + PhosLoader()->LoadPID("UPDATE") ; + SetLoaded("P") ; } - TFolder * phosSubFolder = 0 ; - - phosSubFolder = dynamic_cast(phosFolder->FindObject(foldername)) ; + return RecParticles()->GetEntries() ; +} +//____________________________________________________________________________ +Int_t AliPHOSGetter::ReadTreeS() +{ + // Read the SDigits + - if(!phosSubFolder) { - Fatal("SDigitsRef", "Folder //Folders/RunMC/Event/Data/PHOS/%s not found !", foldername) ; + // gets TreeS from the root file (PHOS.SDigits.root) + if ( !IsLoaded("S") ) { + PhosLoader()->LoadSDigits("UPDATE") ; + PhosLoader()->LoadSDigitizer("UPDATE") ; + SetLoaded("S") ; } - TObject * dis = phosSubFolder->FindObject(name) ; - if(!dis){ - Fatal("SDigitsRef", "object %s not found !", name) ; - } + return SDigits()->GetEntries() ; +} - return phosSubFolder->GetListOfFolders()->GetObjectRef(dis) ; +//____________________________________________________________________________ +TClonesArray * AliPHOSGetter::SDigits() +{ + // asks the Loader to return the Digits container + TClonesArray * rv = 0 ; + + rv = PhosLoader()->SDigits() ; + if (!rv) { + PhosLoader()->MakeSDigitsArray() ; + rv = PhosLoader()->SDigits() ; + } + return rv ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const -{ - //---------- SDigitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname - - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - - if ( !sd ) { - Error("PostDigitizer", "Task //%s/SDigitizer not found !", fTasksFolder) ; - return kFALSE ; - } - TTask * phos = dynamic_cast(sd->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostSDigitizer", "->//%s/SDigitizer/PHOS/ not found!", fTasksFolder) ; - Info("PostSDigitizer", "-> Adding //%s/SDigitizer/PHOS/", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - sd->Add(phos) ; - } - AliPHOSSDigitizer * phossd = dynamic_cast(phos->GetListOfTasks()->FindObject( sdigitizer->GetName() )); - if (phossd) { - if (fDebug) - Info("PostSDigitizer", "-> Task %s already exists", sdigitizer->GetName()) ; - phos->GetListOfTasks()->Remove(phossd) ; +AliPHOSSDigitizer * AliPHOSGetter::SDigitizer() +{ + AliPHOSSDigitizer * rv ; + rv = dynamic_cast(PhosLoader()->SDigitizer()) ; + if (!rv) { + Event(0, "S") ; + rv = dynamic_cast(PhosLoader()->SDigitizer()) ; } - phos->Add(sdigitizer) ; - return kTRUE; - + return rv ; } //____________________________________________________________________________ -TObject** AliPHOSGetter::SDigitizerRef(const char * name) const -{ - //---------- return task SDigitizer ------------------------- +TParticle * AliPHOSGetter::Secondary(const TParticle* p, const Int_t index) const +{ + // Return first (index=1) or second (index=2) secondary particle of primary particle p + + if(index <= 0) + return 0 ; + if(index > 2) + return 0 ; - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if ( !sd ) { - Fatal("SDigitizerRef", "Task //%s/SDigitizer not found !", fTasksFolder) ; - } + if(p) { + Int_t daughterIndex = p->GetDaughter(index-1) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); + return rl->GetAliRun()->Particle(daughterIndex) ; + } + else + return 0 ; +} - TTask * phos = dynamic_cast(sd->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - Fatal("SDigitizerRef", "//%s/SDigitizer/PHOS not found !", fTasksFolder) ; - } +//____________________________________________________________________________ +void AliPHOSGetter::Track(const Int_t itrack) +{ + // Read the first entry of PHOS branch in hit tree gAlice->TreeH() + + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); - TTask * task = dynamic_cast(phos->GetListOfTasks()->FindObject(name)) ; + if( !TreeH() ) // load treeH the first time + rl->LoadHits() ; - return phos->GetListOfTasks()->GetObjectRef(task) ; + // first time create the container + TClonesArray * hits = Hits() ; + if ( hits ) + hits->Clear() ; + TBranch * phosbranch = dynamic_cast(TreeH()->GetBranch("PHOS")) ; + phosbranch->SetAddress(&hits) ; + phosbranch->GetEntry(itrack) ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const -{ - //---------- SDigitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if ( !sd ) { - Error("PostSDigitizer", "Task //%s/SDigitizer not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(sd->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Error("PostSDigitizer", "-> //%s/SDigitizer/PHOS/ not found!", fTasksFolder) ; - Info("PostSDigitizer", "-> Adding //%s/SDigitizer/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - sd->Add(phos) ; +TTree * AliPHOSGetter::TreeD() const +{ + TTree * rv = 0 ; + rv = PhosLoader()->TreeD() ; + if ( !rv ) { + PhosLoader()->MakeTree("D"); + rv = PhosLoader()->TreeD() ; } - - TString sdname(name) ; - sdname.Append(":") ; - sdname.Append(file); - sdname.ReplaceAll("/","_") ; - AliPHOSSDigitizer * phossd = dynamic_cast(phos->GetListOfTasks()->FindObject( sdname )); - if (!phossd) { - phossd = new AliPHOSSDigitizer() ; - //Note, we can not call constructor with parameters: it will call Getter and scew up everething - phossd->SetName(sdname) ; - phossd->SetTitle(file) ; - phos->Add(phossd) ; - } - return kTRUE; + return rv ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostDigits(const char * name) const -{ //---------- Digits ------------------------- - - // the hierarchy is //Folders/Run/Event/Data/PHOS/SDigits/name - - TFolder * phosFolder = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - - if ( !phosFolder ) { - if (fDebug) { - Warning("PostDigitizer", "-> Folder //%s/PHOS/ not found!", fDigitsFolder) ; - Info("PostDigitizer", "-> Adding Folder //%s/PHOS/", fDigitsFolder) ; - } - phosFolder = fDigitsFolder->AddFolder("PHOS", "Digits from PHOS") ; - } - - TObject* dig = phosFolder->FindObject( name ) ; - if ( !dig ) { - TClonesArray * digits = new TClonesArray("AliPHOSDigit",1000) ; - digits->SetName(name) ; - phosFolder->Add(digits) ; - } - return kTRUE; +TTree * AliPHOSGetter::TreeH() const +{ + TTree * rv = 0 ; + rv = PhosLoader()->TreeH() ; + if ( !rv ) { + PhosLoader()->MakeTree("H"); + rv = PhosLoader()->TreeH() ; + } + + return rv ; } //____________________________________________________________________________ -TObject** AliPHOSGetter::DigitsRef(const char * name) const +TTree * AliPHOSGetter::TreeR() const { - //------- Digits ---------------------- - // the hierarchy is //Folders/Run/Event/Data/PHOS/Digits/name - - if ( !fDigitsFolder ) { - Fatal("DigitsRef", "Folder //%s not found !", fDigitsFolder) ; - } + TTree * rv = 0 ; + rv = PhosLoader()->TreeR() ; + if ( !rv ) { + PhosLoader()->MakeTree("R"); + rv = PhosLoader()->TreeR() ; + } - TFolder * phosFolder = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - Fatal("DigitsRef", "Folder //%s/PHOS/ not found !", fDigitsFolder) ; - } - - TObject * d = phosFolder->FindObject(name) ; - if(!d) { - Fatal("DigitsRef", "object %s not found !", name) ; - } - - return phosFolder->GetListOfFolders()->GetObjectRef(d) ; - + return rv ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const +TTree * AliPHOSGetter::TreeT() const { - //---------- Digitizer ------------------------- + TTree * rv = 0 ; + rv = PhosLoader()->TreeT() ; + if ( !rv ) { + PhosLoader()->MakeTree("T"); + rv = PhosLoader()->TreeT() ; + } - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if ( !sd ) { - Error("PostDigitizer", "Task //%s/Digitizer not found !", fTasksFolder) ; - return kFALSE ; - } - TTask * phos = dynamic_cast(sd->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Error("PostDigitizer", "//%s/Digitizer/PHOS not found!", fTasksFolder) ; - Info("PostDigitizer", "Adding //%s/Digitizer/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - sd->Add(phos) ; - } - - AliPHOSDigitizer * phosd = dynamic_cast(phos->GetListOfTasks()->FindObject(digitizer->GetName())) ; - if (phosd) { - phosd->Delete() ; - phos->GetListOfTasks()->Remove(phosd) ; - } - phos->Add(digitizer) ; - return kTRUE; -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostDigitizer(const char * name) const -{ - //---------- Digitizer ------------------------- - // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname - - TTask * d = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if ( !d ) { - Error("PostDigitizer", "Task //%s/Digitizer not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(d->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostDigitizer", "//%s/Digitizer/PHOS not found!", fTasksFolder) ; - Info("PostDigitizer", "Adding //%s/Digitizer/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - d->Add(phos) ; -} - - TTask * phosd = dynamic_cast(phos->GetListOfTasks()->FindObject(fDigitsTitle)) ; - if (!phosd) { - if(strcmp(name, "Digitizer")==0){ - phosd = new AliPHOSDigitizer() ; - phosd->SetName(fDigitsTitle) ; - phosd->SetTitle(fHeaderFile) ; - phos->Add(phosd) ; - } - else{ - phosd = new AliPHOSRaw2Digits() ; - phosd->SetName(fDigitsTitle) ; - phosd->SetTitle(fHeaderFile) ; - phos->Add(phosd) ; - } - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::DigitizerRef(const char * name) const -{ - // -------------- Return Digitizer task ------------------------------------ - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if ( !sd ) { - Fatal("DigitizerRef", "Task //%s/Digitizer not found !", fTasksFolder) ; - } - - TTask * phos = dynamic_cast(sd->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - Fatal("DigitizerRef", "//%s/Digitizer/PHOS", fTasksFolder) ; - } - - TTask * task = dynamic_cast(phos->GetListOfTasks()->FindObject(name)) ; - - return phos->GetListOfTasks()->GetObjectRef(task) ; - -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostRecPoints(const char * name) const -{ // -------------- RecPoints ------------------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name - // the hierarchy is //Folders/Run/Event/RecData/PHOS/CPVRecPoints/name - - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS")) ; - - if ( !phosFolder ) { - if (fDebug) { - Warning("PostRecPoints", "-> Folder //%s/PHOS/ not found!", fRecoFolder->GetName()) ; - Info("PostRecPoints", "-> Adding Folder //%s/PHOS/", fRecoFolder->GetName()) ; - } - phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ; - } - - // EMCA RecPoints - TFolder * phosRPoEMCAFolder = dynamic_cast(phosFolder->FindObject("EMCARecPoints")) ; - if ( !phosRPoEMCAFolder ) { - if (fDebug) { - Warning("PostRecPoints", "-> Folder //%s/PHOS/EMCARecPoints/ not found!", fRecoFolder->GetName()) ; - Info("PostRecPoints", "-> Adding Folder //%s/PHOS/EMCARecPoints", fRecoFolder->GetName()) ; - } - phosRPoEMCAFolder = phosFolder->AddFolder("EMCARecPoints", "EMCA RecPoints from PHOS") ; - } - - TObject * erp = phosFolder->FindObject( name ) ; - if ( !erp ) { - TObjArray * emcrp = new TObjArray(100) ; - emcrp->SetName(name) ; - phosRPoEMCAFolder->Add(emcrp) ; - } - - // CPV RecPoints - TFolder * phosRPoCPVFolder = dynamic_cast(phosFolder->FindObject("CPVRecPoints")) ; - if ( !phosRPoCPVFolder ) { - if (fDebug) { - Warning("PostRecPoints", "-> Folder //%s/PHOS/CPVRecPoints/ not found!", fRecoFolder->GetName()) ; - Info("PostRecPoints", "-> Adding Folder //%s/PHOS/CPVRecPoints/", fRecoFolder->GetName()) ; - } - phosRPoCPVFolder = phosFolder->AddFolder("CPVRecPoints", "CPV RecPoints from PHOS") ; - } - - TObject * crp = phosRPoCPVFolder->FindObject( name ) ; - if ( !crp ) { - TObjArray * cpvrp = new TObjArray(100) ; - cpvrp->SetName(name) ; - phosRPoCPVFolder->Add(cpvrp) ; - } - return kTRUE; + return rv ; } - -//____________________________________________________________________________ -TObject** AliPHOSGetter::EmcRecPointsRef(const char * name) const -{ // -------------- RecPoints ------------------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name - - if ( !fRecoFolder ) { - Fatal("EmcRecPointsRef", "Folder //%s not found !", fRecoFolder->GetName() ) ; - } - - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ; - if ( !phosFolder ) { - Fatal("EmcRecPointsRef", "Folder //%s/PHOS/EMCARecPoints/ not found !", fRecoFolder->GetName() ) ; - } - - - TObject * erp = phosFolder->FindObject(name ) ; - if ( !erp ) { - Fatal("EmcRecPointsRef", "object %s not found !", name) ; - } - return phosFolder->GetListOfFolders()->GetObjectRef(erp) ; - -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::CpvRecPointsRef(const char * name) const -{ // -------------- RecPoints ------------------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/CPVRecPoints/name - - if ( !fRecoFolder ) { - Fatal("CpvRecPointsRef", "Folder //%s not found !", fRecoFolder->GetName() ) ; - } - - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ; - if ( !phosFolder ) { - Fatal("CpvRecPointsRef", "Folder //%s/PHOS/CPVRecPoints/ not found !", fRecoFolder->GetName() ) ; - } - - TObject * crp = phosFolder->FindObject(name ) ; - if ( !crp ) { - Fatal("CpvRecPointsRef", "object %s nott found", name ) ; - } - return phosFolder->GetListOfFolders()->GetObjectRef(crp) ; - -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const -{ // ------------------ AliPHOSClusterizer ------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostClusterizer", "Task //%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostClusterizer", "//%s/Reconstructioner/PHOS not found!", fTasksFolder) ; - Info("PostClusterizer", "Adding //%s/Reconstructioner/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; - } - - AliPHOSClusterizer * phoscl = dynamic_cast(phos->GetListOfTasks()->FindObject(clu->GetName())) ; - if (phoscl) { - if (fDebug) - Info("PostClusterizer", "Task %s already exists", clu->GetName()) ; - phoscl->Delete() ; - phos->GetListOfTasks()->Remove(phoscl) ; - } - phos->Add(clu) ; - return kTRUE; -} - //____________________________________________________________________________ -TObject** AliPHOSGetter::ClusterizerRef(const char * name) const +TTree * AliPHOSGetter::TreeP() const { - // ------------------ AliPHOSClusterizer ------------------------ + TTree * rv = 0 ; + rv = PhosLoader()->TreeP() ; + if ( !rv ) { + PhosLoader()->MakeTree("P"); + rv = PhosLoader()->TreeP() ; + } - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("ClusterizerRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - Fatal("ClusterizerRef", " //%s/Reconstructioner/PHOS not founf !", fTasksFolder->GetName() ) ; - } - - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * clu = 0 ; - TString cluname(name) ; - cluname+=":clu" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(cluname)){ - clu = task ; - break ; - } - } - - if(!clu) { - Fatal("ClusterizerRef", "Task //%s/Reconstructioner/clusterizer/%s not found", fTasksFolder->GetName(), name) ; - } - - return l->GetObjectRef(clu) ; - + return rv ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostClusterizer(const char * name) const -{ // ------------------ AliPHOSClusterizer ------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostClusterizer", "Task//%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostClusterizer", "//%s/Reconstructioner/PHOS not found!", fTasksFolder) ; - Info("PostClusterizer", "Adding //%s/Reconstructioner/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; +TTree * AliPHOSGetter::TreeS() const +{ + TTree * rv = 0 ; + rv = PhosLoader()->TreeS() ; + if ( !rv ) { + PhosLoader()->MakeTree("S"); + rv = PhosLoader()->TreeS() ; } - - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TString clun(name) ; - clun+=":clu" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(clun)) - return kTRUE ; - } - - AliPHOSClusterizerv1 * phoscl = new AliPHOSClusterizerv1() ; - clun+="-v1" ; - phoscl->SetName(clun) ; - phoscl->SetTitle(fHeaderFile) ; - phos->Add(phoscl) ; - return kTRUE; + return rv ; } //____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name - - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS")) ; - - if ( !phosFolder ) { - if (fDebug) { - Warning("PostTrackSegments", "-> Folder //%s/PHOS/ not found", fRecoFolder->GetName()) ; - Info("PostTrackSegments", "-> Adding Folder //%s/PHOS", fRecoFolder->GetName()) ; - } - phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ; - } - - TFolder * phosTSFolder = dynamic_cast(phosFolder->FindObject("TrackSegments")) ; - if ( !phosTSFolder ) { - if (fDebug) { - Warning("PostTrackSegments", "-> Folder //%s/PHOS/TrackSegments/ not found!", fRecoFolder->GetName() ) ; - Info("PostTrackSegments", "-> Adding Folder //%s/PHOS/TrackSegments/", fRecoFolder->GetName()) ; - } - phosTSFolder = phosFolder->AddFolder("TrackSegments", "TrackSegments from PHOS") ; - } - - TObject * tss = phosTSFolder->FindObject( name ) ; - if (!tss) { - TClonesArray * ts = new TClonesArray("AliPHOSTrackSegment",100) ; - ts->SetName(name) ; - phosTSFolder->Add(ts) ; - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::TrackSegmentsRef(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name - - if ( !fRecoFolder ) { - Fatal("TrackSegmentsRef", "Folder //%s not found !", fRecoFolder->GetName() ) ; - } - - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS/TrackSegments")) ; - if ( !phosFolder ) { - Fatal("TrackSegmentsRef", "Folder //%s/PHOS/TrackSegments/ not found !", fRecoFolder->GetName() ) ; - } - - TObject * tss = phosFolder->FindObject(name) ; - if (!tss) { - Fatal("TrackSegmentsRef", "object %s not found !", name) ; - } - return phosFolder->GetListOfFolders()->GetObjectRef(tss) ; -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsmaker) const -{ //------------Track Segment Maker ------------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/PHOS not found!", fTasksFolder) ; - Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; - } - - AliPHOSTrackSegmentMaker * phosts = - dynamic_cast(phos->GetListOfTasks()->FindObject(tsmaker->GetName())) ; - if (phosts) { - phosts->Delete() ; - phos->GetListOfTasks()->Remove(phosts) ; - } - phos->Add(tsmaker) ; - return kTRUE; - -} -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const -{ - //------------Track Segment Maker ------------------------------ - // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/PHOS not found!", fTasksFolder->GetName() ) ; - Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/PHOS", fTasksFolder->GetName()) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; - } +Bool_t AliPHOSGetter::VersionExists(TString & opt) const +{ + // checks if the version with the present name already exists in the same directory - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TString tsn(name); - tsn+=":tsm" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(tsn)) - return kTRUE ; - } - - AliPHOSTrackSegmentMakerv1 * phosts = new AliPHOSTrackSegmentMakerv1() ; - tsn+="-v1" ; - phosts->SetName(tsn) ; - phosts->SetTitle(fHeaderFile) ; - phos->Add(phosts) ; - return kTRUE; - -} + Bool_t rv = kFALSE ; + + AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); + TString version( rl->GetEventFolder()->GetName() ) ; -//____________________________________________________________________________ -TObject** AliPHOSGetter::TSMakerRef(const char * name) const -{ - //------------Track Segment Maker ------------------------------ + opt.ToLower() ; - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("TSMakerRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - Fatal("TSMakerRef", "//%s/Reconstructioner/PHOS not found !", fTasksFolder->GetName() ) ; - } - - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * tsm = 0 ; - TString tsmname(name) ; - tsmname+=":tsm" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(tsmname)){ - tsm = task ; - break ; + if ( opt == "sdigits") { + // add the version name to the root file name + TString fileName( PhosLoader()->GetSDigitsFileName() ) ; + if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } + PhosLoader()->SetSDigitsFileName(fileName) ; } - - if(!tsm) { - Fatal("TSMakerRef", "Task //%s/Reconstructioner/PHOS/TrackSegmentMarker/%s not found !", fTasksFolder->GetName(), name) ; - } - - return l->GetObjectRef(tsm) ; - -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostRecParticles(const char * name) const -{ // -------------------- RecParticles ------------------------ - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/RecParticles/name - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS")) ; - - if ( !phosFolder ) { - if (fDebug) { - Warning("PostRecParticles", "-> Folder //%s/PHOS/ not found!", fRecoFolder->GetName()) ; - Info("PostRecParticles", "-> Adding Folder //%s/PHOS/", fRecoFolder->GetName()) ; - } - phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ; - } - - TFolder * phosRPaFolder = dynamic_cast(phosFolder->FindObject("RecParticles")) ; - if ( !phosRPaFolder ) { - if (fDebug) { - Warning("PostRecParticles", "-> Folder //%s/PHOS/RecParticles/ not found!", fRecoFolder->GetName()) ; - Info("PostRecParticles", "-> Adding Folder //%s/PHOS/RecParticles/", fRecoFolder->GetName()) ; + if ( opt == "digits") { + // add the version name to the root file name + TString fileName( PhosLoader()->GetDigitsFileName() ) ; + if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } - phosRPaFolder = phosFolder->AddFolder("RecParticles", "RecParticles from PHOS") ; - } - - TObject * rps = phosRPaFolder->FindObject( name ) ; - if ( !rps ) { - TClonesArray * rp = new TClonesArray("AliPHOSRecParticle",100) ; - rp->SetName(name) ; - phosRPaFolder->Add(rp) ; + PhosLoader()->SetDigitsFileName(fileName) ; } - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::RecParticlesRef(const char * name) const -{ // ---------------RecParticles ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name - if ( !fRecoFolder ) { - Fatal("RecParticlesRef", "Folder//%s not found !", fRecoFolder->GetName() ) ; - } + return rv ; - TFolder * phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS/RecParticles")) ; - if ( !phosFolder ) { - Fatal("RecParticlesRef", "Folder //%s/PHOS/RecParticles/ not found !", fRecoFolder->GetName() ) ; - } - - TObject * tss = phosFolder->FindObject(name ) ; - if (!tss) { - Fatal("RecParticlesRef", "object %s not found !", name) ; - } - return phosFolder->GetListOfFolders()->GetObjectRef(tss) ; } + //____________________________________________________________________________ -const UShort_t AliPHOSGetter::EventPattern(void) +UShort_t AliPHOSGetter::EventPattern(void) const { // Return the pattern (trigger bit register) of the beam-test event if(fBTE) @@ -1323,7 +748,7 @@ const UShort_t AliPHOSGetter::EventPattern(void) return 0 ; } //____________________________________________________________________________ -const Float_t AliPHOSGetter::BeamEnergy(void) +Float_t AliPHOSGetter::BeamEnergy(void) const { // Return the beam energy of the beam-test event if(fBTE) @@ -1331,1450 +756,3 @@ const Float_t AliPHOSGetter::BeamEnergy(void) else return 0 ; } -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const -{ - // ------------AliPHOS PID ----------------------------- - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostPID", "//%s/Reconstructioner/PHOS not found!", fTasksFolder) ; - Info("PostPID", "Adding //%s/Reconstructioner/PHOS", fTasksFolder) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; - } - - AliPHOSPID * phospid = dynamic_cast(phos->GetListOfTasks()->FindObject(pid->GetName())) ; - if (phospid) { - if (fDebug) - Info("PostPID", "-> Task %s qlready exists", pid->GetName()) ; - phos->GetListOfTasks()->Remove(phospid) ; - } - - phos->Add(pid) ; - return kTRUE; -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostPID(const char * name) const -{ - // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - return kFALSE ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - if (fDebug) { - Warning("PostPID", "//%s/Reconstructioner/PHOS not found!", fTasksFolder->GetName()) ; - Info("PostPID", "Adding //%s/Reconstructioner/PHOS", fTasksFolder->GetName()) ; - } - phos = new TTask("PHOS", "") ; - tasks->Add(phos) ; - } - - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TString pidname(name) ; - pidname+=":pid" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)) - return kTRUE ; - } - - AliPHOSPIDv1 * phospid = new AliPHOSPIDv1() ; - pidname+="-v1" ; - phospid->SetName(pidname) ; - phospid->SetTitle(fHeaderFile) ; - phos->Add(phospid) ; - - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::PIDRef(const char * name) const -{ - //------------PID ------------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - Fatal("PIDRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ; - } - - TTask * phos = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if ( !phos ) { - Fatal("PIDRef", "//%s/Reconstructioner/PHOS not found !", fTasksFolder->GetName() ) ; - } - - TList * l = phos->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * pid = 0 ; - TString pidname(name) ; - pidname+=":pid" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)){ - pid = task ; - break ; - } - } - - if(!pid) { - Fatal("PIDRef", "Task //%s/Reconstructioner/PHOS/PID/%s not found !", fTasksFolder->GetName(), name) ; - } - - return l->GetObjectRef(pid) ; -} - -//____________________________________________________________________________ -const Bool_t AliPHOSGetter::PostQA(void) const -{ // ------------------ QA --------------------------------- - - // the hierarchy is //Folders/Run/Conditions/QA/PHOS/alarmsName - - TFolder * phosFolder = dynamic_cast(fQAFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - if (fDebug) { - Warning("PostQA", "-> Folder //%s/PHOS/ not found!", fQAFolder) ; - Info("PostQA", "-> Adding Folder //%s/PHOS", fQAFolder) ; - } - phosFolder = fQAFolder->AddFolder("PHOS", "QA from PHOS") ; - } - - return kTRUE; -} - -//____________________________________________________________________________ -TObject** AliPHOSGetter::AlarmsRef(void) const -{ //------- Alarms ---------------------- - - - // the hierarchy is //Folders/Run/Conditions/QA/PHOS - if ( !fQAFolder ) { - Fatal("AlarmsRef", "Folder //%s not found !", fQAFolder) ; - } - - TFolder * phosFolder = dynamic_cast(fQAFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - Fatal("AlarmsRef", "Folder //%s/PHOS/ not found !", fQAFolder) ; - } - - return fQAFolder->GetListOfFolders()->GetObjectRef(phosFolder) ; -} - - -//____________________________________________________________________________ -TTree * AliPHOSGetter::TreeK(TString filename) -{ - - // returns TreeK from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; -// if (file && (filename != fHeaderFile) ) { // file already open -// file->Close() ; -// //delete fAlice ; -// } - if(!file || !file->IsOpen()) - file = TFile::Open(filename.Data(), "read") ; - if(filename != fHeaderFile ){ - fAlice = dynamic_cast(file->Get("gAlice")) ; - } - TString treeName("TreeK") ; - treeName += EventNumber() ; - TTree * tree = dynamic_cast(file->Get(treeName.Data())) ; - if (!tree && fDebug) - Warning("TreeK", "-> %s not found in %s", treeName.Data(), filename.Data()) ; - - return tree ; -} - -//____________________________________________________________________________ -TTree * AliPHOSGetter::TreeH(TString filename) -{ - - // returns TreeH from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - TString treeName("TreeH") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - if (!tree && fDebug) - Warning("TreeH", "-> %s not found in %s", treeName.Data(), filename.Data()) ; - - return tree ; -} - -//____________________________________________________________________________ -TTree * AliPHOSGetter::TreeS(TString filename) -{ - - // returns TreeS from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - TString treeName("TreeS") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - if (!tree && fDebug) - Warning("TreeS", "-> %s not found in %s", treeName.Data(), filename.Data() ); - - return tree ; -} - -//____________________________________________________________________________ -TTree * AliPHOSGetter::TreeD(TString filename) -{ - - // returns TreeD from file filename - // usefull in case of split file - - if ( filename.IsNull() ) - filename = fHeaderFile ; - - TFile * file = 0 ; - file = static_cast(gROOT->GetFile(filename.Data() ) ) ; - if (!file) { // file not open yet - file = TFile::Open(filename.Data(), "read") ; - } - TString treeName("TreeD") ; - treeName += EventNumber() ; - TTree * tree = static_cast(file->Get(treeName.Data())) ; - if (!tree && fDebug) - Warning("TreeD", "-> %s not found in %s", treeName.Data(), filename.Data()) ; - - return tree ; -} - -//____________________________________________________________________________ -const TParticle * AliPHOSGetter::Primary(Int_t index) const -{ - // Return primary particle numbered by - - if(index < 0) - return 0 ; - TParticle * p = 0 ; - if (fAlice) - p = fAlice->Particle(index) ; - else - p = gAlice->Particle(index) ; - - return p ; - -} - -//____________________________________________________________________________ -const TParticle * AliPHOSGetter::Secondary(TParticle* p, Int_t index) const -{ - // Return first (index=1) or second (index=2) secondary particle of primary particle p - - if(index <= 0) - return 0 ; - if(index > 2) - return 0 ; - - if(p) { - Int_t daughterIndex = p->GetDaughter(index-1) ; - return gAlice->Particle(daughterIndex) ; - } - else - return 0 ; -} - -//____________________________________________________________________________ -Int_t AliPHOSGetter::ReadTreeD(const Int_t event) -{ - // Read the digit tree gAlice->TreeD() - - TTree * treeD ; - if(fToSplit){ - TFile * file = static_cast(gROOT->GetFile(fDigitsFileName)); - if(!file) - file = TFile::Open(fDigitsFileName) ; - // Get Digits Tree header from file - TString treeName("TreeD") ; - treeName += event ; - treeD = dynamic_cast(file->Get(treeName.Data())); - if(!treeD){ // TreeD not found in header file - if (fDebug) - Warning("ReadTreeD", "-> Cannot find TreeD in %s", fDigitsFileName.Data()) ; - return 1; - } - } - else - treeD = gAlice->TreeD() ; - - TObjArray * lob = static_cast(treeD->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * digitsbranch = 0 ; - TBranch * digitizerbranch = 0 ; - Bool_t phosfound = kFALSE, digitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!phosfound || !digitizerfound) ) { - if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitsbranch = branch ; - phosfound = kTRUE ; - } - else if ( ((strcmp(branch->GetName(), "AliPHOSDigitizer")==0)|| - (strcmp(branch->GetName(), "AliPHOSRaw2Digits")==0)) && - (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitizerbranch = branch ; - digitizerfound = kTRUE ; - } - } - - if ( !phosfound || !digitizerfound ) { - if (fDebug) - Warning("ReadTreeD", "-> Cannot find Digits and/or Digitizer with name %s", fDigitsTitle.Data()) ; - return 2; - } - - //read digits - if(!Digits(fDigitsTitle) ) - PostDigits(fDigitsTitle); - else - Digits(fDigitsTitle)->Clear() ; - digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; - digitsbranch->GetEntry(0) ; - - // read the Digitizer - if(Digitizer()){ - if(strcmp(Digitizer()->IsA()->GetName(),digitizerbranch->GetName())!=0){ - RemoveTask("D", fDigitsTitle) ; - if(strcmp(digitizerbranch->GetName(), "AliPHOSDigitizer")==0) - PostDigitizer("Digitizer") ; - else - PostDigitizer("Raw2Digits") ; - } - } - else{ - if(strcmp(digitizerbranch->GetName(), "AliPHOSDigitizer")==0) - PostDigitizer("Digitizer") ; - else - PostDigitizer("Raw2Digits") ; - } - - - digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; - digitizerbranch->GetEntry(0) ; - - -// if((!fcdb)&&(strcmp(digitizerbranch->GetName(), "AliPHOSRaw2Digits")==0)) -// ReadCalibrationDB("Primordial","beamtest.root") ; - - - if(gAlice->TreeD()!=treeD) - treeD->Delete(); - - return 0 ; -} -//____________________________________________________________________________ -//void AliPHOSGetter::ReadCalibrationDB(const char * database,const char * filename){ -// -// if(fcdb && (strcmp(database,fcdb->GetTitle())==0)) -// return ; -// -// TFile * file = gROOT->GetFile(filename) ; -// if(!file) -// file = TFile::Open(filename); -// if(!file){ -// Error ("ReadCalibrationDB", "Cannot open file %s", filename) ; -// return ; -// } -// if(fcdb) -// fcdb->Delete() ; -// fcdb = dynamic_cast(file->Get("AliPHOSCalibrationDB")) ; -// if(!fcdb) -// Error ("ReadCalibrationDB", "No database %s in file %s", database, filename) ; -//} - -//____________________________________________________________________________ -Int_t AliPHOSGetter::ReadTreeH() -{ - // Read the first entry of PHOS branch in hit tree gAlice->TreeH() - - TTree * treeH = gAlice->TreeH() ; - - if(!treeH) {// TreeH not found in header file - - if (fDebug) - Warning("ReadTreeH", "-> Cannot find TreeH in %s", fHeaderFile.Data() ) ; - - TString searchFileName("PHOS.Hits") ; - if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){ - searchFileName+="." ; - searchFileName += fBranchTitle ; - } - searchFileName+=".root" ; - - if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits - if (fDebug) - Info("ReadTreeH", "-> TreeH found in %s", searchFileName.Data()) ; - - } else { - Error("ReadTreeH", "TreeH not found") ; - return 1; - } - } - - TBranch * hitsbranch = static_cast(treeH->GetBranch("PHOS")) ; - if ( !hitsbranch ) { - if (fDebug) - Warning("ReadTreeH", "-> Cannot find branch PHOS") ; - return 2; - } - if(!Hits()) - PostHits() ; - - if (hitsbranch->GetEntries() > 1 ) { - (dynamic_cast (*HitsRef()))->Clear() ; - TClonesArray * tempo = new TClonesArray("AliPHOSHit",1000) ; - TClonesArray * hits = dynamic_cast(*HitsRef()) ; - hitsbranch->SetAddress(&tempo) ; - Int_t index = 0 ; - Int_t i = 0 ; - for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { - hitsbranch->GetEntry(i) ; - Int_t j = 0 ; - for ( j = 0 ; j < tempo->GetEntries() ; j++) { - const AliPHOSHit * hit = static_cast(tempo->At(j)) ; - new((*hits)[index]) AliPHOSHit( *hit ) ; - index++ ; - } - } - delete tempo ; - } - else { - (dynamic_cast (*HitsRef()))->Clear() ; - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(0) ; - } - return 0 ; -} - -//____________________________________________________________________________ -void AliPHOSGetter::Track(const Int_t itrack) -{ - // Read the first entry of PHOS branch in hit tree gAlice->TreeH() - - if(gAlice->TreeH()== 0){ - Error("Track", "Cannot read TreeH") ; - return ; - } - - TBranch * hitsbranch = dynamic_cast(gAlice->TreeH()->GetListOfBranches()->FindObject("PHOS")) ; - if ( !hitsbranch ) { - if (fDebug) - Warning("Track", "Cannot find branch PHOS") ; - return ; - } - if(!Hits()) - PostHits() ; - - (dynamic_cast (*HitsRef()))->Clear() ; - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(itrack) ; - -} - -//____________________________________________________________________________ -void AliPHOSGetter::ReadTreeQA() -{ - // Read the digit tree gAlice->TreeQA() - // so far only PHOS knows about this Tree - - if(PHOS()->TreeQA()== 0){ - Error("ReadTreeQA", "Cannot read TreeQA") ; - return ; - } - - TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS") ; - if (!qabranch) { - if (fDebug) - Warning("ReadTreeQA", "Cannot find QA Alarms for PHOS"); - return ; - } - - if(!Alarms()) - PostQA() ; - - qabranch->SetAddress(AlarmsRef()) ; - - qabranch->GetEntry(0) ; - -// PostQA("PHOS") ; -// TFolder * alarmsF = Alarms() ; -// alarmsF->Clear() ; -// qabranch->SetAddress(&alarmsF) ; -// qabranch->GetEntry(0) ; - -} - -//____________________________________________________________________________ -Int_t AliPHOSGetter::ReadTreeR(const Int_t event) -{ - // Read the reconstrunction tree gAlice->TreeR() - // A particularity has been introduced here : - // if gime->Event(ievent,"R") is called branches with the current title are read, the current title - // being for example give in AliPHOSPID(fileName, title) - // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any - // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given) - // from a given set of TrackSegments (with a given name) - // This is why any is NOT used to read the branch of RecParticles - // any migh have become obsolete : to be checked - // See AliPHOSPIDv1 - - //first - clean if necessary - if(EmcRecPoints(fRecPointsTitle)){ - EmcRecPoints(fRecPointsTitle)->Delete() ; - CpvRecPoints(fRecPointsTitle)->Delete() ; - } - //clear TrackSegments - if(TrackSegments(fTrackSegmentsTitle)) - TrackSegments(fTrackSegmentsTitle)->Clear() ; - if(RecParticles(fRecParticlesTitle)) - RecParticles(fRecParticlesTitle)->Clear() ; - - TTree * treeR ; - if(fToSplit){ - TFile * file = static_cast(gROOT->GetFile(fRecPointsFileName)); - if(!file) - file = TFile::Open(fRecPointsFileName) ; - // Get Digits Tree header from file - TString treeName("TreeR") ; - treeName += event ; - treeR = dynamic_cast(file->Get(treeName.Data())); - if(!treeR){ // TreeR not found in header file - if (fDebug) - Warning("ReadTreeD", "-> Cannot find TreeR in %s", fRecPointsFileName.Data()) ; - return 1; - } - } - else - treeR = gAlice->TreeR() ; - - // RecPoints - TObjArray * lob = static_cast(treeR->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * emcbranch = 0 ; - TBranch * cpvbranch = 0 ; - TBranch * clusterizerbranch = 0 ; - Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ; - - - while ( (branch = static_cast(next())) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) ) { - if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) { - if ( strcmp(branch->GetName(), "PHOSEmcRP")==0) { - emcbranch = branch ; - phosemcrpfound = kTRUE ; - } - else if ( strcmp(branch->GetName(), "PHOSCpvRP")==0) { - cpvbranch = branch ; - phoscpvrpfound = kTRUE ; - } - else if(strcmp(branch->GetName(), "AliPHOSClusterizer")==0){ - clusterizerbranch = branch ; - clusterizerfound = kTRUE ; - } - } - } - - if ( !phosemcrpfound || !phoscpvrpfound || !clusterizerfound) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find RecPoints and/or Clusterizer with name %s", fRecPointsTitle.Data() ) ; - - } else { - if(!EmcRecPoints(fRecPointsTitle) ) - PostRecPoints(fRecPointsTitle) ; - emcbranch->SetAddress(EmcRecPointsRef(fRecPointsTitle)) ; - emcbranch->GetEntry(0) ; - - cpvbranch->SetAddress(CpvRecPointsRef(fRecPointsTitle)) ; - cpvbranch->GetEntry(0) ; - - if(!Clusterizer(fRecPointsTitle) ) - PostClusterizer(fRecPointsTitle) ; - - clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; - clusterizerbranch->GetEntry(0) ; - } - - //------------------- TrackSegments --------------------- - next.Reset() ; - TBranch * tsbranch = 0 ; - TBranch * tsmakerbranch = 0 ; - Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ; - while ( (branch = static_cast(next())) && (!phostsfound || !tsmakerfound) ) { - if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) { - if ( strcmp(branch->GetName(), "PHOSTS")==0){ - tsbranch = branch ; - phostsfound = kTRUE ; - } - else if(strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) { - tsmakerbranch = branch ; - tsmakerfound = kTRUE ; - } - } - } - - if ( !phostsfound || !tsmakerfound ) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find TrackSegments and/or TrackSegmentMaker with name %s", fTrackSegmentsTitle.Data() ) ; - } else { - // Read and Post the TrackSegments - if(!TrackSegments(fTrackSegmentsTitle)) - PostTrackSegments(fTrackSegmentsTitle) ; - tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; - tsbranch->GetEntry(0) ; - - // Read and Post the TrackSegment Maker - if(!TrackSegmentMaker(fTrackSegmentsTitle)) - PostTrackSegmentMaker(fTrackSegmentsTitle) ; - tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; - tsmakerbranch->GetEntry(0) ; - } - - - //------------ RecParticles ---------------------------- - next.Reset() ; - TBranch * rpabranch = 0 ; - TBranch * pidbranch = 0 ; - Bool_t phosrpafound = kFALSE, pidfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!phosrpafound || !pidfound) ) - if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { - if ( strcmp(branch->GetName(), "PHOSRP")==0) { - rpabranch = branch ; - phosrpafound = kTRUE ; - } - else if (strcmp(branch->GetName(), "AliPHOSPID")==0) { - pidbranch = branch ; - pidfound = kTRUE ; - } - } - - if ( !phosrpafound || !pidfound ) { - if (fDebug) - Warning("ReadTreeR", "-> Cannot find RecParticles and/or PID with name %s", fRecParticlesTitle.Data() ) ; - } else { - // Read and Post the RecParticles - if(!RecParticles(fRecParticlesTitle)) - PostRecParticles(fRecParticlesTitle) ; - rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; - rpabranch->GetEntry(0) ; - // Read and Post the PID - if(!PID(fRecParticlesTitle)) - PostPID(fRecParticlesTitle) ; - pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; - pidbranch->GetEntry(0) ; - } - - if(gAlice->TreeR()!=treeR) - treeR->Delete(); - return 0 ; -} - -//____________________________________________________________________________ -Int_t AliPHOSGetter::ReadTreeS(const Int_t event) -{ - // Reads the SDigits treeS from all files - // Files, which should be opened are listed in phosF - // So, first get list of files - TFolder * phosF = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if (!phosF) - phosF = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ; - TCollection * folderslist = phosF->GetListOfFolders() ; - - // Now iterate over the list of files and read TreeS into Whiteboard - TIter next(folderslist) ; - TFolder * folder = 0 ; - TFile * file; - TTree * treeS = 0; - while ( (folder = static_cast(next())) ) { - TString fileName("") ; - fileName = folder->GetName() ; - fileName.ReplaceAll("_","/") ; - file = static_cast(gROOT->GetFile(fileName)); - if(!file) - file = TFile::Open(fileName) ; - // Get SDigits Tree header from file - TString treeName("TreeS") ; - treeName += event ; - treeS = dynamic_cast(file->Get(treeName.Data())); - - if(!treeS){ // TreeS not found in header file - if (fDebug) - Warning("ReadTreeS", "-> Cannot find TreeS in %s", fileName.Data()) ; - return 1; - } - - //set address of the SDigits and SDigitizer - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = static_cast(treeS->GetListOfBranches()) ; - TIter next(lob) ; - Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!phosfound || !sdigitizerfound) ) { - if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - phosfound = kTRUE ; - sdigitsBranch = branch ; - } - - else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && - (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; - } - } - if ( !phosfound || !sdigitizerfound ) { - if (fDebug) - Warning("ReadSDigits", "-> Digits and/or Digitizer branch with name %s not found", GetName()) ; - return 2; - } - - if ( !folder->FindObject(fSDigitsTitle) ){ - TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1) ; - sdigits->SetName(fSDigitsTitle) ; - folder->Add(sdigits) ; - } - - ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ; - sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(fSDigitsTitle) ; - sdname+=":" ; - sdname+=folder->GetName() ; - if(!SDigitizer(sdname) ) - PostSDigitizer(fSDigitsTitle,folder->GetName()) ; - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - if(gAlice->TreeS()!=treeS) - treeS->Delete(); - } - return 0 ; -} - -//____________________________________________________________________________ -void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input) -{ - // Read the summable digits fron treeS() - - TString filename("mergefile") ; - filename+= input ; - - TFolder * phosFolder = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) { - phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ; - } - TFolder * folder=(TFolder*)phosFolder->FindObject(filename) ; - //set address of the SDigits and SDigitizer - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; - TIter next(lob) ; - Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) { - if ( strcmp(branch->GetName(), "PHOS")==0) { - phosfound = kTRUE ; - sdigitsBranch = branch ; - } - - else if ( strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; - } - } - if ( !phosfound || !sdigitizerfound ) { - if (fDebug) - Warning("ReadTreeS", "-> Digits and/or Digitizer branch not found") ; - return ; - } - - if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) - PostSDigits(sdigitsBranch->GetTitle(),filename) ; - - sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),folder->GetName())) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(sdigitsBranch->GetTitle()) ; - sdname+=":" ; - sdname+=filename ; - - if(!SDigitizer(sdigitsBranch->GetTitle()) ) - PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - if(gAlice->TreeS()!=treeS) - treeS->Delete(); -} - - -//____________________________________________________________________________ -void AliPHOSGetter::ReadPrimaries() -{ - // a lot simplified.... if 2 files are opened then we have a problem - - TClonesArray * ar = 0 ; - if(! (ar = Primaries()) ) { - PostPrimaries() ; - ar = Primaries() ; - } - ar->Delete() ; - - if (TreeK(fHeaderFile)) { // treeK found in header file - if (fDebug) - Info("ReadPrimaries", "-> TreeK found in %s", fHeaderFile.Data() ); - fNPrimaries = gAlice->GetNtrack() ; - fAlice = 0 ; - - } else { // treeK not found in header file - Error("ReadPrimaries", "TreeK not found") ; - return ; - } - - Int_t index = 0 ; - for (index = 0 ; index < fNPrimaries; index++) { - new ((*ar)[index]) TParticle(*(Primary(index))); - } -} - -//____________________________________________________________________________ -void AliPHOSGetter::Event(const Int_t event, const char* opt) -{ - // Reads the content of all Tree's S, D and R - - if (event >= gAlice->TreeE()->GetEntries() ) { - Error("Event", "%d not found in TreeE !", event) ; - return ; - } - - TBranch * btb = gAlice->TreeE()->GetBranch("AliPHOSBeamTestEvent") ; - if(btb){ - if(!fBTE) - fBTE = new AliPHOSBeamTestEvent() ; - btb->SetAddress(&fBTE) ; - btb->GetEntry(event) ; - } - else{ - if(fBTE){ - delete fBTE ; - fBTE = 0 ; - } - } - - Bool_t any = kFALSE ; - if (strstr(opt,"A") ) // do not check the title of the branches - any = kTRUE; - - gAlice->GetEvent(event) ; - - if( strstr(opt,"R") ) - ReadTreeR(event) ; - - if( strstr(opt,"D") ) - ReadTreeD(event) ; - - if(strstr(opt,"S") ) - ReadTreeS(event) ; - - if(strstr(opt,"H") ) - ReadTreeH() ; - - if( strstr(opt,"Q") ) - ReadTreeQA() ; - - if( strstr(opt,"P") || (strcmp(opt,"")==0) ) - ReadPrimaries() ; - - -} - -//____________________________________________________________________________ -TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const -{ - // get the object named "what" from the folder - // folders are named like //Folders - - if ( file.IsNull() ) - file = fHeaderFile ; - if( name.IsNull() ) - name = fBranchTitle ; - - TFolder * folder = 0 ; - TObject * phosO = 0 ; - - if ( what.CompareTo("Primaries") == 0 ) { - folder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; - if (folder) - phosO = dynamic_cast(folder->FindObject("Primaries")) ; - else - return 0 ; - } - else if ( what.CompareTo("Hits") == 0 ) { - folder = dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - if (folder) - phosO = dynamic_cast(folder->FindObject("Hits")) ; - } - else if ( what.CompareTo("SDigits") == 0 ) { - if(fToSplit){ - file.Remove(file.Last('/')+1,file.Length()-file.Last('/')-1) ; - file.ReplaceAll("/","_") ; - file+="PHOS.SDigits." ; - if(name && (strcmp(name,"Default")!=0)){ - file+=name ; - file+="." ; - } - file+="root" ; - } - TString path = "PHOS/" + file ; - folder = dynamic_cast(fSDigitsFolder->FindObject(path.Data())) ; - if (folder) { - if (name.IsNull()) - name = fSDigitsTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("Digits") == 0 ){ - folder = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - if (folder) { - if (name.IsNull()) - name = fDigitsTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("EmcRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("CpvRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("TrackSegments") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("PHOS/TrackSegments")) ; - if (folder) { - if (name.IsNull()) - name = fTrackSegmentsTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("RecParticles") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("PHOS/RecParticles")) ; - if (folder) { - if (name.IsNull()) - name = fRecParticlesTitle ; - phosO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("Alarms") == 0 ){ - phosO = dynamic_cast(fQAFolder->FindObject("PHOS")) ; - } - if (!phosO) { - if(fDebug) - Warning("ReturnO", "Object %s not found in PHOS", what.Data() ) ; - return 0 ; - } - - return phosO ; -} - -//____________________________________________________________________________ -const TTask * AliPHOSGetter::ReturnT(TString what, TString name) const -{ - // get the TTask named "what" from the folder - // folders are named like //Folders/Tasks/what/PHOS/name - - TString search(what) ; - if ( what.CompareTo("Clusterizer") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("TrackSegmentMaker") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("PID") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("QATasks") == 0 ) - search = "QA" ; - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject(search)) ; - - if (!tasks) { - Error("ReturnT", "Task %s not found !", what.Data() ) ; - return 0 ; - } - - TTask * phosT = dynamic_cast(tasks->GetListOfTasks()->FindObject("PHOS")) ; - if (!phosT) { - Error("ReturnT", "Task %s/PHOS not found !", what.Data() ) ; - return 0 ; - } - - TList * list = phosT->GetListOfTasks() ; - - if (what.CompareTo("SDigitizer") == 0) { - if ( name.IsNull() ) - name = fSDigitsTitle ; - } else if (what.CompareTo("Digitizer") == 0){ - if ( name.IsNull() ) - name = fDigitsTitle ; - } else if (what.CompareTo("Clusterizer") == 0){ - if ( name.IsNull() ) - name = fRecPointsTitle ; - name.Append(":clu") ; - } - else if (what.CompareTo("TrackSegmentMaker") == 0){ - if ( name.IsNull() ) - name = fTrackSegmentsTitle ; - name.Append(":tsm") ; - } - else if (what.CompareTo("PID") == 0){ - if ( name.IsNull() ) - name = fRecParticlesTitle ; - name.Append(":pid") ; - } - else if (what.CompareTo("QATasks") == 0){ - if ( name.IsNull() ) - return phosT ; - } - - TIter it(list) ; - TTask * task = 0 ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(name)) - return task ; - } - - if(fDebug) - Warning("ReturnT", "-> Task %s/PHOS/%s not found", search.Data(), name.Data() ) ; - return 0 ; -} - -//____________________________________________________________________________ -void AliPHOSGetter::RemoveTask(TString opt, TString name) const -{ - // remove a task from the folder - // path is fTasksFolder/SDigitizer/PHOS/name - - TTask * task = 0 ; - TTask * phos = 0 ; - TList * lofTasks = 0 ; - - if (opt == "S") { // SDigitizer - task = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if (!task) - return ; - } - else if (opt == "D") { // Digitizer - task = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if (!task) - return ; - } - else if (opt == "C" || opt == "T" || opt == "P" ) { // Clusterizer, TrackSegmentMaker, PID - task = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - if (!task) - return ; - } - else { - Warning("RemoveTask", "Unknown option %s", opt.Data() ); - return ; - } - phos = dynamic_cast(task->GetListOfTasks()->FindObject("PHOS")) ; - if (!phos) - return ; - lofTasks = phos->GetListOfTasks() ; - if (!lofTasks) - return ; - TObject * obj = lofTasks->FindObject(name) ; - if (obj) - lofTasks->Remove(obj) ; - -} - -//____________________________________________________________________________ -void AliPHOSGetter::RemoveObjects(TString opt, TString name) const -{ - // remove SDigits from the folder - // path is fSDigitsFolder/fHeaderFileName/name - - TFolder * phos = 0 ; - TFolder * phosmain = 0 ; - - if (opt == "H") { // Hits - phos = dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - if (!phos) - return ; - name = "Hits" ; - } - - else if ( opt == "S") { // SDigits - phosmain = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if (!phosmain) - return ; - phos = dynamic_cast(phosmain->FindObject(fHeaderFile)) ; - if (!phos) - return ; - } - - else if (opt == "D") { // Digits - phos = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - if (!phos) - return ; - } - - else if (opt == "RE") { // EMCARecPoints - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ; - if (!phos) - return ; - } - - else if (opt == "RC") { // CPVRecPoints - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ; - if (!phos) - return ; - } - - else if (opt == "T") { // TrackSegments - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/TrackSegments")) ; - if (!phos) - return ; - } - - else if (opt == "P") { // RecParticles - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/RecParticles")) ; - if (!phos) - return ; - } - - else { - Warning("RemoveObjects", "Unknown option %s", opt.Data() ) ; - return ; - } - - TObjArray * ar = dynamic_cast(phos->FindObject(name)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - - if (opt == "S") - phosmain->Remove(phos) ; - -} - -//____________________________________________________________________________ -void AliPHOSGetter::RemoveSDigits() const -{ - // Clean SDigit array - - TFolder * phos= dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if (!phos) - return ; - - phos->SetOwner() ; - phos->Clear() ; -} - -//____________________________________________________________________________ -void AliPHOSGetter::CleanWhiteBoard(void) -{ - // Delete all PHOS objects from folders - - TFolder * phosmain = 0 ; - TFolder * phos ; - TObjArray * ar ; - TList * lofTasks = 0 ; - TTask * task = 0 ; - TTask * phost = 0 ; - - // Hits - phos = dynamic_cast(fHitsFolder->FindObject("PHOS")) ; - if (phos){ - TObjArray * ar = dynamic_cast(phos->FindObject("Hits")) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - // SDigits - phosmain = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if (phosmain){ - phos = dynamic_cast(phosmain->FindObject(fHeaderFile)) ; - if (phos) { - ar = dynamic_cast(phos->FindObject(fSDigitsTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - phosmain->Remove(phos) ; - } - - - // Digits - phos = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - if (phos){ - ar = dynamic_cast(phos->FindObject(fDigitsTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - - // EMCARecPoints - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ; - if (phos){ - ar = dynamic_cast(phos->FindObject(fRecPointsTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - - // CPVRecPoints - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ; - if (phos){ - ar = dynamic_cast(phos->FindObject(fRecPointsTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - - // TrackSegments - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/TrackSegments")) ; - if (phos) { - ar = dynamic_cast(phos->FindObject(fTrackSegmentsTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - - - // RecParticles - phos = dynamic_cast(fRecoFolder->FindObject("PHOS/RecParticles")) ; - if (phos){ - ar = dynamic_cast(phos->FindObject(fRecParticlesTitle)) ; - if (ar) { - phos->Remove(ar) ; - ar->Delete() ; - delete ar ; - } - } - - - //---- Now Tasks ----------- - - TObject * obj ; - TString sdname(fSDigitsTitle); - - // Digitizer - task = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if (task){ - phost = dynamic_cast(task->GetListOfTasks()->FindObject("PHOS")) ; - if (phost){ - lofTasks = phost->GetListOfTasks() ; - if (lofTasks){ - obj = lofTasks->FindObject(sdname.Data()) ; - if (obj) - lofTasks->Remove(obj) ; - } - } - } - - - sdname.Append(":") ; - // Clusterizer, TrackSegmentMaker, PID - task = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - if (task){ - phost = dynamic_cast(task->GetListOfTasks()->FindObject("PHOS")) ; - if (phost){ - lofTasks = phost->GetListOfTasks() ; - TIter next(lofTasks); - while((obj=next())){ - TString oname(obj->GetName()) ; - if (oname.BeginsWith(sdname)){ - lofTasks->Remove(obj) ; - } - } - } - } - - - // SDigitizer - sdname.Append(fHeaderFile) ; - task = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if (task) { - phost = dynamic_cast(task->GetListOfTasks()->FindObject("PHOS")) ; - if (phost){ - lofTasks = phost->GetListOfTasks() ; - if (lofTasks){ - obj = lofTasks->FindObject(sdname.Data()) ; - if (obj) - lofTasks->Remove(obj) ; - } - } - } - -} -//____________________________________________________________________________ -void AliPHOSGetter::SetTitle(const char * branchTitle ) -{ - // Set branch titles and add folders with PHOS data - - fBranchTitle = branchTitle ; - fSDigitsTitle = branchTitle ; - fDigitsTitle = branchTitle ; - fRecPointsTitle = branchTitle ; - fRecParticlesTitle = branchTitle ; - fTrackSegmentsTitle = branchTitle ; - if(fToSplit){ - //First - extract full path if necessary - TString sFileName(fHeaderFile) ; - Ssiz_t islash = sFileName.Last('/') ; - if(islash(fHitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) - phosFolder = fHitsFolder->AddFolder("PHOS", "Hits from PHOS") ; - - phosFolder = dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) - phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ; - - //Make folder for SDigits - fSDigitsFileName.ReplaceAll("/","_") ; - phosFolder->AddFolder(fSDigitsFileName.Data(),""); - - phosFolder = dynamic_cast(fDigitsFolder->FindObject("PHOS")) ; - if ( !phosFolder ) - phosFolder = fDigitsFolder->AddFolder("PHOS", "Digits from PHOS") ; - - phosFolder = dynamic_cast(fRecoFolder->FindObject("PHOS")) ; - if ( !phosFolder ) - phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ; - -} -//____________________________________________________________________________ -void AliPHOSGetter::CloseSplitFiles(void) -{ - // Close files opened in a split mode - TFile * file ; - file = static_cast(gROOT->GetFile(fSDigitsFileName.Data() ) ) ; - if(file) - file->Close() ; - file = static_cast(gROOT->GetFile(fDigitsFileName.Data() ) ) ; - if(file) - file->Close() ; - file = static_cast(gROOT->GetFile(fRecPointsFileName.Data() ) ) ; - if(file) - file->Close() ; - file = static_cast(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ; - if(file) - file->Close() ; - file = static_cast(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ; - if(file) - file->Close() ; - -} diff --git a/PHOS/AliPHOSGetter.h b/PHOS/AliPHOSGetter.h index 7c40cf34847..9b2b3c0e077 100644 --- a/PHOS/AliPHOSGetter.h +++ b/PHOS/AliPHOSGetter.h @@ -17,47 +17,41 @@ // --- ROOT system --- -#include "TClonesArray.h" -#include "TFolder.h" -#include "TTree.h" -#include "TFile.h" -class TString ; -class TParticle ; -class TTask ; +#include "TObject.h" +#include "TClonesArray.h" +// #include "TFolder.h" +// #include "TTree.h" +// #include "TFile.h" +// class TString ; + class TParticle ; +// class TTask ; // --- Standard library --- -#include // --- AliRoot header files --- +#include "AliConfig.h" + +// #include "AliRun.h" +class AliPHOS ; +#include "AliPHOSHit.h" -#include "AliRun.h" -#include "AliPHOS.h" -#include "AliPHOSHit.h" -#include "AliPHOSDigit.h" -#include "AliPHOSEmcRecPoint.h" -#include "AliPHOSCpvRecPoint.h" -#include "AliPHOSTrackSegment.h" -#include "AliPHOSRecParticle.h" class AliPHOSGeometry ; -class AliPHOSDigitizer ; -class AliPHOSSDigitizer ; -class AliPHOSClusterizer ; -class AliPHOSTrackSegmentMaker ; -class AliPHOSPID ; -//class AliPHOSCalibrationDB ; -class AliPHOSConTableDB ; +#include "AliPHOSDigitizer.h" +#include "AliPHOSSDigitizer.h" +// //class AliPHOSCalibrationDB ; +// class AliPHOSConTableDB ; class AliPHOSBeamTestEvent ; +#include "AliPHOSLoader.h" + class AliPHOSGetter : public TObject { - public: - + public: AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ; } AliPHOSGetter(const AliPHOSGetter & obj) { // cpy ctor requested by Coding Convention - // but not yet needed Fatal("cpy ctor", "not implemented") ; } @@ -69,190 +63,166 @@ class AliPHOSGetter : public TObject { virtual ~AliPHOSGetter() ; //=========== Instantiators ================ - static AliPHOSGetter * GetInstance(const char* headerFile, - const char* branchTitle = "Default", - const Bool_t toSplit = kFALSE ) ; - static AliPHOSGetter * GetInstance() ; + static AliPHOSGetter * Instance(const char* headerFile, + const char* version = AliConfig::fgkDefaultEventFolderName, + Option_t * openingOption = "READ" ) ; + static AliPHOSGetter * Instance() ; + + static void Print() ; - //=========== General information about run ============== - const Int_t MaxEvent() const { return static_cast(gAlice->TreeE()->GetEntries()) ; } - const Int_t EventNumber() const { return static_cast(gAlice->GetEvNumber()) ; } - const Bool_t BranchExists(const TString tree) const ; - const UShort_t EventPattern(void) ; - const Float_t BeamEnergy(void) ; +// //=========== General information about run ============== + Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; } + void SetLoaded(const TString tree) { fLoadingStatus += tree ; } + + Int_t MaxEvent() const ; + Int_t EventNumber() const ; + Bool_t VersionExists(TString & opt) const ; + UShort_t EventPattern(void) const ; + Float_t BeamEnergy(void) const ; - //========== PHOSGeometry and PHOS ============= - const AliPHOS * PHOS() ; - const AliPHOSGeometry * PHOSGeometry() ; +// //========== PHOSGeometry and PHOS ============= + AliPHOS * PHOS() const ; + AliPHOSGeometry * PHOSGeometry() const ; - //========== Methods to read something from file ========== +// //========== Methods to read something from file ========== void Event(const Int_t event, const char * opt = "HSDRP") ; void Track(const Int_t itrack) ; - void ReadTreeS(TTree * treeS,Int_t input) ; //Method to be used when - //digitizing is under the control ofAliRunDigizer, - //which opens all files etc. - //========== Alarms ====================== - TFolder * Alarms() const { return dynamic_cast(ReturnO("Alarms", 0)) ; } - const TObjArray * Alarms(const char * name ) const { return dynamic_cast(ReturnO("Alarms", name)) ; } - const TTask * QATasks(const char * name = 0) const { return ReturnT("QATasks", name) ; } - //-----------------now getter's data-------------------------------------- -// AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } -// void ReadCalibrationDB(const char * name, const char * filename) ; +// //-----------------now getter's data-------------------------------------- +// // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } +// // void ReadCalibrationDB(const char * name, const char * filename) ; //=========== Primaries ============ - TTree * TreeK(TString filename="") ; - TClonesArray * Primaries(void) const { return dynamic_cast(ReturnO("Primaries")) ; } - const TParticle * Primary(Int_t index) const ; - const Int_t NPrimaries()const { return fNPrimaries; } - const TParticle * Secondary(TParticle * p, Int_t index=1) const ; - - //=========== Hits ================= - TTree * TreeH(TString filename="") ; - const TClonesArray * Hits(void) { return dynamic_cast(ReturnO("Hits")) ; } - const AliPHOSHit * Hit(Int_t index) { return dynamic_cast(Hits()->At(index) );} +// TTree * TreeK(TString filename="") ; + TClonesArray * Primaries(void) ; + TParticle * Primary(Int_t index) const ; + Int_t NPrimaries()const { return fNPrimaries; } + TParticle * Secondary(const TParticle * p, const Int_t index=1) const ; + +// //=========== Hits ================= +// TTree * TreeH(TString filename="") ; + TClonesArray * Hits(void) ; + AliPHOSHit * Hit(const Int_t index) { return dynamic_cast(Hits()->At(index) );} + TTree * TreeH() const ; //=========== SDigits ============== - TTree * TreeS(TString filename="") ; - TClonesArray * SDigits(const char * name = 0, const char * file=0) const { - return dynamic_cast(ReturnO("SDigits", name, file)) ; } - //const AliPHOSDigit * SDigit(Int_t index) { return static_cast(SDigits()->At(index)) ;} !!! why no such method ? - const AliPHOSSDigitizer * SDigitizer(const char * name =0) const { - return (const AliPHOSSDigitizer *) ReturnT("SDigitizer", name) ; // here static or dynamic cast does not work ! why ? - } + TClonesArray * SDigits() ; + AliPHOSDigit * SDigit(const Int_t index) { return static_cast(SDigits()->At(index)) ;} + TTree * TreeS() const ; + AliPHOSSDigitizer * SDigitizer() ; + + TString GetSDigitsFileName() { return PhosLoader()->GetSDigitsFileName() ; } + Int_t LoadSDigits(Option_t* opt="") { return PhosLoader()->LoadSDigits(opt) ; } + Int_t LoadSDigitizer(Option_t* opt=""){ return PhosLoader()->LoadSDigitizer(opt) ; } + Int_t WriteSDigits(Option_t* opt="") { return PhosLoader()->WriteSDigits(opt) ; } + Int_t WriteSDigitizer(Option_t* opt=""){ + return PhosLoader()->WriteSDigitizer(opt) ; } //========== Digits ================ - TTree * TreeD(TString filename="") ; - TClonesArray * Digits(const char * name = 0)const { - return dynamic_cast(ReturnO("Digits", name)) ; } - //const AliPHOSDigit * Digit(Int_t index) { return static_cast(Digits()->At(index)) ;} !!! why no such method ? - const TTask * Digitizer(const char * name = 0) const { - return ReturnT("Digitizer", name) ; } + TClonesArray * Digits() ; + AliPHOSDigit * Digit(const Int_t index) { return static_cast(Digits()->At(index)) ;} + TTree * TreeD() const ; + AliPHOSDigitizer * Digitizer() ; + TString GetDigitsFileName() { return PhosLoader()->GetDigitsFileName() ; } + Int_t LoadDigits(Option_t* opt="") { return PhosLoader()->LoadDigits(opt) ; } + Int_t LoadDigitizer(Option_t* opt=""){ + return PhosLoader()->LoadDigitizer(opt) ; } + Int_t WriteDigits(Option_t* opt="") { return PhosLoader()->WriteDigits(opt) ; } + Int_t WriteDigitizer(Option_t* opt=""){ + return PhosLoader()->WriteDigitizer(opt) ; } //========== RecPoints ============= - TObjArray * EmcRecPoints(const char * name = 0) { - return dynamic_cast(ReturnO("EmcRecPoints", name)) ; } - //const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast(EmcRecPoints()->At(index)) ;} !!! why no such method ? - TObjArray * CpvRecPoints(const char * name = 0) { - return dynamic_cast(ReturnO("CpvRecPoints", name)) ; } - const AliPHOSClusterizer * Clusterizer (const char * name =0) const { - return (const AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; // here static or dynamic cast does not work ! why ? - } - - //========== TrackSegments ========== - TClonesArray * TrackSegments(const char * name = 0) { - return static_cast(ReturnO("TrackSegments", name)) ; } - const AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const { - return (const AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; } - + TObjArray * EmcRecPoints() ; + AliPHOSEmcRecPoint * EmcRecPoint(const Int_t index) { return static_cast(EmcRecPoints()->At(index)) ;} + TObjArray * CpvRecPoints() ; + AliPHOSCpvRecPoint * CpvRecPoint(const Int_t index) { return static_cast(CpvRecPoints()->At(index)) ;} + TTree * TreeR() const ; + AliPHOSClusterizer * Clusterizer() ; + TString GetRecPointsFileName() { return PhosLoader()->GetRecPointsFileName() ; } + Int_t LoadRecPoints(Option_t* opt="") { return PhosLoader()->LoadRecPoints(opt) ; } + Int_t LoadClusterizer(Option_t* opt=""){ + return PhosLoader()->LoadClusterizer(opt) ; } + Int_t WriteRecPoints(Option_t* opt="") { return PhosLoader()->WriteRecPoints(opt) ; } + Int_t WriteClusterizer(Option_t* opt=""){ + return PhosLoader()->WriteClusterizer(opt) ; } + + //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { + TClonesArray * TrackSegments() ; + AliPHOSTrackSegment * TrackSegments(const Int_t index) { return static_cast(TrackSegments()->At(index)) ;} + TTree * TreeT() const ; + AliPHOSTrackSegmentMaker * TrackSegmentMaker() ; + TString GetTracksFileName() { return PhosLoader()->GetTracksFileName() ; } + Int_t LoadTracks(Option_t* opt="") { return PhosLoader()->LoadTracks(opt) ; } + Int_t LoadTrackSegementMaker(Option_t* opt=""){ + return PhosLoader()->LoadTrackSegmentMaker(opt) ; } + Int_t WriteTracks(Option_t* opt="") { return PhosLoader()->WriteTracks(opt) ; } + Int_t WriteTrackSegmentMaker(Option_t* opt=""){ + return PhosLoader()->WriteTracker(opt) ; } //========== RecParticles =========== - TClonesArray * RecParticles(const char * name = 0) { - return static_cast(ReturnO("RecParticles", name)) ; } - const AliPHOSPID * PID(const char * name =0) const { - return (const AliPHOSPID*)(ReturnT("PID", name)) ; } // here static or dynamic cast does not work ! why ? - - //-----------------Auxiliary methods: cleaners----------------- - void RemoveTask(TString opt, TString name) const ; - void RemoveObjects(TString opt, TString name) const ; - void RemoveSDigits() const ; - - //----------------Auxiliary methods: miscellana---------------- - void CloseFile() ; - const TFolder * Folder(const TString what) const ; - const Bool_t HasFailed() const { return fFailed ; } - void ListBranches(Int_t event=0) const ; - void NewBranch(TString name, Int_t event = 0) ; - Bool_t NewFile(TString name) ; - TFolder * SDigitsFolder() { return dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; } - void SetDebug(Int_t level) {fDebug = level;} // Set debug level - void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; } - - //------------Auxiliary methods: Posters-------------------- - const Bool_t PostPrimaries(void ) const ; - const Bool_t PostHits(void ) const ; - const Bool_t PostSDigits( const char * name, const char * file = 0) const ; - const Bool_t PostDigits( const char * name ) const ; - const Bool_t PostRecPoints( const char * name ) const ; - const Bool_t PostTrackSegments(const char * name) const ; - const Bool_t PostRecParticles( const char * name) const ; - const Bool_t PostClusterizer( const char * name) const ; - const Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ; - const Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ; - const Bool_t PostSDigitizer ( const char * name, const char * file ) const ; - const Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ; - const Bool_t PostDigitizer ( const char * name) const ; - const Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ; - const Bool_t PostTrackSegmentMaker(const char * name ) const ; - const Bool_t PostPID (AliPHOSPID * pid) const ; - const Bool_t PostPID (const char * name ) const ; - const Bool_t PostQA (void) const ; + TClonesArray * RecParticles() ; + AliPHOSRecParticle * RecPaticles(const Int_t index) { return static_cast(RecParticles()->At(index)) ;} + TTree * TreeP() const ; + AliPHOSPID * PID() ; + TString GetRecParticlesFileName() { return PhosLoader()->GetRecParticlesFileName() ; } + Int_t LoadRecParticles(Option_t* opt="") { return PhosLoader()->LoadRecParticles(opt) ; } + Int_t LoadPID(Option_t* opt=""){ + return PhosLoader()->LoadPID(opt) ; } + Int_t WriteRecParticles(Option_t* opt="") { return PhosLoader()->WriteRecParticles(opt) ; } + Int_t WritePID(Option_t* opt=""){ + return PhosLoader()->WritePID(opt) ; } + + + void SetDebug(Int_t level) {fgDebug = level;} // Set debug level + void PostClusterizer(AliPHOSClusterizer * clu) + const{PhosLoader()->PostClusterizer(clu) ; } + void PostPID(AliPHOSPID * pid) + const{PhosLoader()->PostPID(pid) ; } + void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr) + const{PhosLoader()->PostTrackSegmentMaker(tr) ; } + void PostSDigitizer (AliPHOSSDigitizer * sdigitizer) + const {PhosLoader()->PostSDigitizer(sdigitizer);} + void PostDigitizer (AliPHOSDigitizer * digitizer) + const {PhosLoader()->PostDigitizer(dynamic_cast(digitizer));} + + TString Version() const { return PhosLoader()->GetTitle() ; } + AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } + private: - AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default", const Bool_t toSplit = kFALSE) ; - TObject * ReturnO(TString what, TString name=0, TString file=0) const ; - const TTask * ReturnT(TString what,TString name=0) const ; - void DefineBranchTitles(char* branch, char* branchTitle) ; - Int_t ReadTreeD(const Int_t event) ; + AliPHOSGetter(const char* headerFile, + const char* version = AliConfig::fgkDefaultEventFolderName, + Option_t * openingOption = "READ") ; + + Int_t ReadTreeD(void) ; Int_t ReadTreeH(void) ; - Int_t ReadTreeR(const Int_t event) ; - Int_t ReadTreeS(const Int_t event) ; - void ReadTreeQA(void) ; + Int_t ReadTreeR(void) ; + Int_t ReadTreeT(void) ; + Int_t ReadTreeS(void) ; + Int_t ReadTreeP(void) ; + + void ReadPrimaries(void) ; - void CleanWhiteBoard(void) ; - void CloseSplitFiles(void) ; - void SetTitle(const char * title) ; - - TObject** PrimariesRef(void) const ; - TObject** HitsRef(void) const ; - TObject** SDigitsRef(const char * name, const char * file = 0 ) const; - TObject** DigitsRef (const char * name) const ; - TObject** EmcRecPointsRef (const char * name) const ; - TObject** CpvRecPointsRef (const char * name) const ; - TObject** TrackSegmentsRef(const char * name) const ; - TObject** RecParticlesRef (const char * name) const ; - TObject** AlarmsRef (void) const ; - - TObject** SDigitizerRef (const char * name) const ; - TObject** DigitizerRef (const char * name) const ; - TObject** ClusterizerRef(const char * name) const ; - TObject** TSMakerRef (const char * name) const ; - TObject** PIDRef (const char * name) const ; - - private: - - static TFile * fgFile; //! - Bool_t fToSplit ; //! Do we work in the split mode + +private: + +// static TFile * fgFile; //! + AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event - TString fHeaderFile ; //! File in which gAlice lives - TString fBranchTitle ; //! - TString fTrackSegmentsTitle ; //! - TString fTrackSegmentsFileName ;//! - TString fRecPointsTitle ; //! - TString fRecPointsFileName ; //! - TString fRecParticlesTitle ; //! - TString fRecParticlesFileName ; //! - TString fDigitsTitle ; //! TDirectory tempo(gDirectory) - TString fDigitsFileName ; //! TDirectory tempo(gDirectory) - TString fSDigitsTitle ; //! - TString fSDigitsFileName ; //! - Bool_t fFailed ; //! set if file not opend or galice not found - Int_t fDebug ; //! Debug level - AliRun * fAlice ; //! needed to read TreeK if in an other file than fHeaderFile - Int_t fNPrimaries ; //! # of primaries - TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing - TFolder * fModuleFolder ; //!Folder that contains the modules - TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles - TFolder * fHitsFolder ; //!Folder that contains the Hits - TFolder * fSDigitsFolder ; //!Folder that contains the SDigits - TFolder * fDigitsFolder ; //!Folder that contains the Digits - TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles) - TFolder * fQAFolder ; //!Folder that contains the QA objects - TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner) + + static Int_t fgDebug ; //! Debug level + + TString fLoadingStatus ; //! tells which trees are loaded + Int_t fNPrimaries ; //! # of primaries + TClonesArray * fPrimaries ; //! list of lists of primaries // AliPHOSCalibrationDB * fcdb ; //! + static AliPHOSLoader * fgPhosLoader ; static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton + + enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; + ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index diff --git a/PHOS/AliPHOSHit.cxx b/PHOS/AliPHOSHit.cxx index 18a6070c29c..c9b8519efca 100644 --- a/PHOS/AliPHOSHit.cxx +++ b/PHOS/AliPHOSHit.cxx @@ -22,15 +22,18 @@ //*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) // --- ROOT system --- -#include "TVector3.h" // --- Standard library --- +#include +#include // --- AliRoot header files --- #include "AliPHOSHit.h" #include "AliRun.h" -#include "AliPHOS.h" +#include "AliConst.h" +#include "AliPHOSLoader.h" #include "AliPHOSGeometry.h" +#include "AliPHOS.h" ClassImp(AliPHOSHit) @@ -144,23 +147,4 @@ ostream& operator << (ostream& out, const AliPHOSHit& hit) } - - - - - - - - - - - - - - - - - - - diff --git a/PHOS/AliPHOSHit.h b/PHOS/AliPHOSHit.h index f792c0eb3ad..c8dd1e3f31f 100644 --- a/PHOS/AliPHOSHit.h +++ b/PHOS/AliPHOSHit.h @@ -12,6 +12,7 @@ //*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH) // --- ROOT system --- +#include // --- AliRoot header files --- #include "AliHit.h" diff --git a/PHOS/AliPHOSIhepAnalyze.cxx b/PHOS/AliPHOSIhepAnalyze.cxx index 04c78538b74..ea129c8ed36 100644 --- a/PHOS/AliPHOSIhepAnalyze.cxx +++ b/PHOS/AliPHOSIhepAnalyze.cxx @@ -39,10 +39,14 @@ // --- AliRoot header files --- +#include "AliRunLoader.h" +#include "AliHeader.h" + +// --- PHOS header files --- #include "AliPHOSIhepAnalyze.h" #include "AliPHOSDigit.h" #include "AliPHOSRecParticle.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" #include "AliPHOSHit.h" #include "AliPHOSImpact.h" #include "AliPHOSvImpacts.h" @@ -55,11 +59,21 @@ ClassImp(AliPHOSIhepAnalyze) //____________________________________________________________________________ - AliPHOSIhepAnalyze::AliPHOSIhepAnalyze() {} +AliPHOSIhepAnalyze::AliPHOSIhepAnalyze() + { + fRunLoader = 0x0; + } //____________________________________________________________________________ -AliPHOSIhepAnalyze::AliPHOSIhepAnalyze(Text_t * name) : fFileName(name) {} +AliPHOSIhepAnalyze::AliPHOSIhepAnalyze(Text_t * name) : fFileName(name) + { + fRunLoader = AliRunLoader::Open(fFileName); + if (fRunLoader == 0x0) + { + Fatal("AliPHOSIhepAnalyze","Can not load event from file %s",name); + } + } //____________________________________________________________________________ void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents) @@ -87,7 +101,15 @@ void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents) TList * fCpvImpacts ; TBranch * branchCPVimpacts; - AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); + + + AliPHOSLoader* please = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( please == 0 ) + { + Error("AnalyzeCPV1","Could not obtain the Loader object !"); + return ; + } + const AliPHOSGeometry * fGeom = please->PHOSGeometry(); Info("AnalyzeCPV1", "Start CPV Analysis-1. Resolutions, cluster multiplicity and lengths") ; @@ -99,10 +121,19 @@ void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents) Int_t ntracks = gAlice->GetEvent(ievent); Info("AnalyzeCPV1", ">>>>>>>Event %d .<<<<<<<", ievent) ; + /******************************************************************/ + TTree* treeH = please->TreeH(); + if (treeH == 0x0) + { + Error("AnalyzeCPV1","Can not get TreeH"); + return; + } +/******************************************************************/ + // Get branch of CPV impacts - if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) { + if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) { Info("AnalyzeCPV1", "Couldn't find branch PHOSCpvImpacts. Exit.") ; - return; + return; } // Create and fill arrays of hits for each CPV module @@ -148,7 +179,7 @@ void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents) // The distance from the rec.point to the closest hit // gives the coordinate resolution of the CPV - please->Event(ievent); + fRunLoader->GetEvent(ievent); TIter nextRP(please->CpvRecPoints()) ; AliPHOSCpvRecPoint *cpvRecPoint ; Float_t xgen, ygen, zgen; @@ -306,7 +337,13 @@ void AliPHOSIhepAnalyze::AnalyzeEMC1(Int_t Nevents) TList * fEmcImpacts ; TBranch * branchEMCimpacts; - AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); + AliPHOSLoader* please = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( please == 0 ) + { + Error("AnalyzeEMC1","Could not obtain the Loader object !"); + return ; + } + const AliPHOSGeometry * fGeom = please->PHOSGeometry(); Info("AnalyzeCPV1", "Start EMC Analysis-1. Resolutions, cluster multiplicity and lengths"); @@ -315,10 +352,19 @@ void AliPHOSIhepAnalyze::AnalyzeEMC1(Int_t Nevents) Int_t nTotalGen = 0; Int_t ntracks = gAlice->GetEvent(ievent); + Info("AnalyzeCPV1", " >>>>>>>Event %d .<<<<<<<", ievent) ; + + TTree* treeH = please->TreeH(); + if (treeH == 0x0) + { + Error("AnalyzeEMC1","Can not get TreeH"); + return; + } + // Get branch of EMC impacts - if (! (branchEMCimpacts =gAlice->TreeH()->GetBranch("PHOSEmcImpacts")) ) { + if (! (branchEMCimpacts =treeH->GetBranch("PHOSEmcImpacts")) ) { Info("AnalyzeCPV1", " Couldn't find branch PHOSEmcImpacts. Exit."); return; } @@ -364,7 +410,7 @@ void AliPHOSIhepAnalyze::AnalyzeEMC1(Int_t Nevents) // The distance from the rec.point to the closest hit // gives the coordinate resolution of the EMC - please->Event(ievent); + fRunLoader->GetEvent(ievent); TIter nextRP(please->EmcRecPoints()) ; AliPHOSEmcRecPoint *emcRecPoint ; Float_t xgen, ygen, zgen; @@ -497,33 +543,46 @@ void AliPHOSIhepAnalyze::AnalyzeCPV2(Int_t Nevents) // 24 March 2001 - TH1F* hDrijCpvR = new TH1F("DrijCpvR","Distance between reconstructed hits in CPV",140,0,50); - TH1F* hDrijCpvG = new TH1F("Drij_cpv_g","Distance between generated hits in CPV",140,0,50); - TH1F* hDrijCpvRatio = new TH1F("DrijCpvRatio","R_{ij}^{rec}/R_{ij}^{gen} in CPV",140,0,50); + TH1F* hDrij_cpv_r = new TH1F("Drij_cpv_r","Distance between reconstructed hits in CPV",140,0,50); + TH1F* hDrij_cpv_g = new TH1F("Drij_cpv_g","Distance between generated hits in CPV",140,0,50); + TH1F* hDrij_cpv_ratio = new TH1F("Drij_cpv_ratio","R_{ij}^{rec}/R_{ij}^{gen} in CPV",140,0,50); // TH1F* hT0 = new TH1F("hT0","Type of entering particle",20000,-10000,10000); - hDrijCpvR->Sumw2(); - hDrijCpvG->Sumw2(); - hDrijCpvRatio->Sumw2(); //correct treatment of errors + hDrij_cpv_r->Sumw2(); + hDrij_cpv_g->Sumw2(); + hDrij_cpv_ratio->Sumw2(); //correct treatment of errors TList * fCpvImpacts = new TList(); TBranch * branchCPVimpacts; - AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); + AliPHOSLoader* please = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( please == 0 ) + { + Error("AnalyzeCPV2","Could not obtain the Loader object !"); + return ; + } const AliPHOSGeometry * fGeom = please->PHOSGeometry(); + fRunLoader->LoadHeader(); for (Int_t nev=0; nevGetEvent(nev); - please->Event(nev); + fRunLoader->GetEvent(nev); + Int_t ntracks = fRunLoader->GetHeader()->GetNtrack(); - Int_t nrecCPV = 0; // Reconstructed points in event - Int_t ngenCPV = 0; // Impacts in event + Int_t nrec_cpv = 0; // Reconstructed points in event + Int_t ngen_cpv = 0; // Impacts in event // Get branch of CPV impacts - if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return; + TTree* treeH = please->TreeH(); + if (treeH == 0x0) + { + Error("AnalyzeCPV2","Can not get TreeH"); + return; + } + + if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) return; // Create and fill arrays of hits for each CPV module Int_t nOfModules = fGeom->GetNModules(); @@ -557,19 +616,19 @@ void AliPHOSIhepAnalyze::AnalyzeCPV2(Int_t Nevents) Int_t nsum = hitsPerModule[iModule]->GetEntriesFast(); printf("CPV module %d has %d hits\n",iModule,nsum); - AliPHOSImpact* genHit1; - AliPHOSImpact* genHit2; + AliPHOSImpact* GenHit1; + AliPHOSImpact* GenHit2; Int_t irp1,irp2; for(irp1=0; irp1< nsum; irp1++) { - genHit1 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp1)); + GenHit1 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp1)); for(irp2 = irp1+1; irp2At(irp2)); - Float_t dx = genHit1->X() - genHit2->X(); - Float_t dz = genHit1->Z() - genHit2->Z(); + GenHit2 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp2)); + Float_t dx = GenHit1->X() - GenHit2->X(); + Float_t dz = GenHit1->Z() - GenHit2->Z(); Float_t dr = TMath::Sqrt(dx*dx + dz*dz); - hDrijCpvG->Fill(dr); + hDrij_cpv_g->Fill(dr); // Info("AnalyzeCPV1", "(dx dz dr): %f %f", dx, dz); } } @@ -579,48 +638,48 @@ void AliPHOSIhepAnalyze::AnalyzeCPV2(Int_t Nevents) //--------- Combinatoric distance between rec. hits in CPV TObjArray* cpvRecPoints = please->CpvRecPoints(); - nrecCPV = cpvRecPoints->GetEntriesFast(); + nrec_cpv = cpvRecPoints->GetEntriesFast(); - if(nrecCPV) + if(nrec_cpv) { - AliPHOSCpvRecPoint* recHit1; - AliPHOSCpvRecPoint* recHit2; - TIter nextCPVrec1(cpvRecPoints); - while(TObject* obj1 = nextCPVrec1() ) + AliPHOSCpvRecPoint* RecHit1; + AliPHOSCpvRecPoint* RecHit2; + TIter next_cpv_rec1(cpvRecPoints); + while(TObject* obj1 = next_cpv_rec1() ) { - TIter nextCPVrec2(cpvRecPoints); - while (TObject* obj2 = nextCPVrec2()) + TIter next_cpv_rec2(cpvRecPoints); + while (TObject* obj2 = next_cpv_rec2()) { if(!obj2->IsEqual(obj1)) { - recHit1 = (AliPHOSCpvRecPoint*)obj1; - recHit2 = (AliPHOSCpvRecPoint*)obj2; + RecHit1 = (AliPHOSCpvRecPoint*)obj1; + RecHit2 = (AliPHOSCpvRecPoint*)obj2; TVector3 locpos1; TVector3 locpos2; - recHit1->GetLocalPosition(locpos1); - recHit2->GetLocalPosition(locpos2); + RecHit1->GetLocalPosition(locpos1); + RecHit2->GetLocalPosition(locpos2); Float_t dx = locpos1.X() - locpos2.X(); Float_t dz = locpos1.Z() - locpos2.Z(); Float_t dr = TMath::Sqrt(dx*dx + dz*dz); - if(recHit1->GetPHOSMod() == recHit2->GetPHOSMod()) - hDrijCpvR->Fill(dr); + if(RecHit1->GetPHOSMod() == RecHit2->GetPHOSMod()) + hDrij_cpv_r->Fill(dr); } } } } Info("AnalyzeCPV1", " Event %d . Total of %d hits, %d rec.points.", - nev, ngenCPV, nrecCPV) ; + nev, ngen_cpv, nrec_cpv) ; delete [] hitsPerModule; } // End of loop over events. -// hDrijCpvG->Draw(); -// hDrijCpvR->Draw(); - hDrijCpvRatio->Divide(hDrijCpvR,hDrijCpvG); - hDrijCpvRatio->Draw(); +// hDrij_cpv_g->Draw(); +// hDrij_cpv_r->Draw(); + hDrij_cpv_ratio->Divide(hDrij_cpv_r,hDrij_cpv_g); + hDrij_cpv_ratio->Draw(); // hT0->Draw(); @@ -640,11 +699,16 @@ void AliPHOSIhepAnalyze::CpvSingle(Int_t nevents) TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" ,21,-0.5,20.5); TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" ,21,-0.5,20.5); - AliPHOSGetter* gime = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); + AliPHOSLoader* gime = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("CpvSingle","Could not obtain the Loader object !"); + return ; + } for(Int_t ievent=0; ieventEvent(ievent); + fRunLoader->GetEvent(ievent); if(gime->CpvRecPoints()->GetEntriesFast()>1) continue; AliPHOSCpvRecPoint* pt = (AliPHOSCpvRecPoint*)(gime->CpvRecPoints())->At(0); @@ -721,19 +785,31 @@ void AliPHOSIhepAnalyze::HitsCPV(TClonesArray& hits, Int_t nev) TList * fCpvImpacts ; TBranch * branchCPVimpacts; - AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); + AliPHOSLoader* please = dynamic_cast(fRunLoader->GetLoader("PHOSLoader")); + if ( please == 0 ) + { + Error("HitsCPV","Could not obtain the Loader object !"); + return ; + } const AliPHOSGeometry * fGeom = please->PHOSGeometry(); printf("\n=================== Event %10d ===================\n",nev); - Int_t ntracks = gAlice->GetEvent(nev); - please->Event(nev); + fRunLoader->GetEvent(nev); + Int_t ntracks = fRunLoader->GetHeader()->GetNtrack(); -// Int_t nrecCPV = 0; // Reconstructed points in event // 01.10.2001 -// Int_t ngenCPV = 0; // Impacts in event +// Int_t nrec_cpv = 0; // Reconstructed points in event // 01.10.2001 +// Int_t ngen_cpv = 0; // Impacts in event // Get branch of CPV impacts - if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return; + TTree* treeH = please->TreeH(); + if (treeH == 0x0) + { + Error("CPVSingle","Can not get TreeH"); + return; + } + + if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) return; // Create and fill arrays of hits for each CPV module Int_t nOfModules = fGeom->GetNModules(); @@ -772,7 +848,7 @@ void AliPHOSIhepAnalyze::HitsCPV(TClonesArray& hits, Int_t nev) // AliPHOSImpact* impact; // TClonesArray* impacts; -// AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS"); +// AliPHOSLoader * please = AliPHOSLoader::GetInstance(GetFileName().Data(),"PHOS"); // const AliPHOSGeometry * fGeom = please->PHOSGeometry(); // Int_t ntracks = gAlice->GetEvent(ievent); @@ -831,11 +907,11 @@ void AliPHOSIhepAnalyze::HitsCPV(TClonesArray& hits, Int_t nev) // Info("AnalyzeCPV1", " PHOS module "<GetEntries()<<" charged CPV hits."); // } -Bool_t AliPHOSIhepAnalyze::IsCharged(Int_t pdgCode) +Bool_t AliPHOSIhepAnalyze::IsCharged(Int_t pdg_code) { // For HIJING - Info("AnalyzeCPV1", "pdgCode %d", pdgCode); - if(pdgCode==211 || pdgCode==-211 || pdgCode==321 || pdgCode==-321 || pdgCode==11 || pdgCode==-11 || pdgCode==2212 || pdgCode==-2212) return kTRUE; + Info("AnalyzeCPV1", "pdg_code %d", pdg_code); + if(pdg_code==211 || pdg_code==-211 || pdg_code==321 || pdg_code==-321 || pdg_code==11 || pdg_code==-11 || pdg_code==2212 || pdg_code==-2212) return kTRUE; else return kFALSE; } diff --git a/PHOS/AliPHOSIhepAnalyze.h b/PHOS/AliPHOSIhepAnalyze.h index ae03e9ea60d..23330615815 100644 --- a/PHOS/AliPHOSIhepAnalyze.h +++ b/PHOS/AliPHOSIhepAnalyze.h @@ -17,6 +17,7 @@ // --- Standard library --- // --- AliRoot header files --- +class AliRunLoader; class AliPHOSIhepAnalyze : public TObject { @@ -24,24 +25,22 @@ class AliPHOSIhepAnalyze : public TObject { AliPHOSIhepAnalyze() ; // ctor AliPHOSIhepAnalyze(Text_t * name) ; // ctor - virtual ~AliPHOSIhepAnalyze() { - // dtor - } - + void AnalyzeCPV1(Int_t Nevents); // resolutions, mult and cluster lengths for CPV void AnalyzeEMC1(Int_t Nevents); // resolutions, mult and cluster lengths for EMC void AnalyzeCPV2(Int_t Nevents); // delta(gen)/delta(rec) between hits void CpvSingle(Int_t Nevents); // signle particle analysis virtual void HitsCPV(TClonesArray& hits, Int_t event); - const TString GetFileName() const { return fFileName; } + TString GetFileName() { return fFileName; } private: - Bool_t IsCharged(Int_t pdgCode); + Bool_t IsCharged(Int_t pdg_code); private: - - TString fFileName; //Name of file analyzed + + AliRunLoader *fRunLoader; + TString fFileName; ClassDef(AliPHOSIhepAnalyze,1) // PHOSv1 event analyzis algorithm diff --git a/PHOS/AliPHOSImpact.cxx b/PHOS/AliPHOSImpact.cxx index 81ad525a8a6..dd66ec79b29 100644 --- a/PHOS/AliPHOSImpact.cxx +++ b/PHOS/AliPHOSImpact.cxx @@ -71,10 +71,7 @@ AliPHOSImpact::AliPHOSImpact(Int_t shunt, Int_t primary, Int_t track, Int_t pid, //____________________________________________________________________________ void AliPHOSImpact::Print() { - //Print information of the impact printf("Impact Pid=%4d, p=(%6.2f,%6.2f,%6.2f,%6.2f) GeV, x=(%6.1f,%6.1f,%6.1f) cm\n", fPid,fMomentum.Px(),fMomentum.Py(),fMomentum.Pz(),fMomentum.E(), fX,fY,fZ); } - - diff --git a/PHOS/AliPHOSJetFinder.cxx b/PHOS/AliPHOSJetFinder.cxx index a94cb162855..0506d28fb18 100644 --- a/PHOS/AliPHOSJetFinder.cxx +++ b/PHOS/AliPHOSJetFinder.cxx @@ -298,7 +298,7 @@ Double_t AliPHOSJetFinder::Calibrate(const AliPHOSDigit * digit){ // } // else{ //simulation if(fSimGain==0){ //read simulation parameters - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; if(!gime){ Error("Calibrate","Can not read Calibration parameters") ; return 0 ; diff --git a/PHOS/AliPHOSLink.h b/PHOS/AliPHOSLink.h index 6b99cd5c800..e17576f8968 100644 --- a/PHOS/AliPHOSLink.h +++ b/PHOS/AliPHOSLink.h @@ -28,15 +28,15 @@ public: // dtor } Int_t Compare(const TObject * obj) const; - const Int_t GetEmc(void) const { + Int_t GetEmc(void) { // returns the index of EMC return fEmcN; } - const Int_t GetPpsd(void) const { + Int_t GetPpsd(void) { // returns the index of PPSD return fPpsdN ; } - const Float_t GetR(void) const { + Float_t GetR(void) { // returns the distance between EMC and PPSD return fR ; } diff --git a/PHOS/AliPHOSLoader.cxx b/PHOS/AliPHOSLoader.cxx new file mode 100644 index 00000000000..11bae856d0a --- /dev/null +++ b/PHOS/AliPHOSLoader.cxx @@ -0,0 +1,946 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* $Id: */ + +/* $Log: + 29.05.2001 Yuri Kharlov: + Everywhere reading the treese TTree->GetEvent(i) + is replaced by reading the branches TBranch->GetEntry(0) +*/ + +//_________________________________________________________________________ +// A singleton. This class should be used in the analysis stage to get +// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, +// instead of directly reading them from galice.root file. This container +// ensures, that one reads Digits, made of these particular digits, RecPoints, +// made of these particular RecPoints, TrackSegments and RecParticles. +// This becomes non trivial if there are several identical branches, produced with +// different set of parameters. +// +// An example of how to use (see also class AliPHOSAnalyser): +// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) +// AliPHOSRecParticle * part = gime->RecParticle(1) ; +// ................ +// please->GetEvent(event) ; // reads new event from galice.root +// +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) +//*-- Completely redesigned by Dmitri Peressounko March 2001 +// +//*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make +//*-- systematic usage of TFolders without changing the interface +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +#include "TFile.h" +#include "TTree.h" +#include "TROOT.h" +#include "TObjString.h" +#include "TFolder.h" +#include "TParticle.h" + +// --- Standard library --- +#include + +// --- AliRoot header files --- + +#include "AliRun.h" +#include "AliConfig.h" +#include "AliDataLoader.h" +#include "AliPHOSLoader.h" +#include "AliPHOS.h" +#include "AliPHOSDigitizer.h" +#include "AliPHOSSDigitizer.h" +#include "AliPHOSClusterizer.h" +#include "AliPHOSClusterizerv1.h" +#include "AliPHOSTrackSegmentMaker.h" +#include "AliPHOSTrackSegmentMakerv1.h" +#include "AliPHOSTrackSegment.h" +#include "AliPHOSPID.h" +#include "AliPHOSPIDv1.h" +#include "AliPHOSGeometry.h" +#include "AliPHOSCalibrationDB.h" + +ClassImp(AliPHOSLoader) + + +const TString AliPHOSLoader::fgkHitsName("HITS");//Name for TClonesArray with hits from one event +const TString AliPHOSLoader::fgkSDigitsName("SDIGITS");//Name for TClonesArray +const TString AliPHOSLoader::fgkDigitsName("DIGITS");//Name for TClonesArray +const TString AliPHOSLoader::fgkEmcRecPointsName("EMCRECPOINTS");//Name for TClonesArray +const TString AliPHOSLoader::fgkCpvRecPointsName("CPVRECPOINTS");//Name for TClonesArray +const TString AliPHOSLoader::fgkTracksName("TRACKS");//Name for TClonesArray +const TString AliPHOSLoader::fgkRecParticlesName("RECPARTICLES");//Name for TClonesArray + +const TString AliPHOSLoader::fgkEmcRecPointsBranchName("PHOSEmcRP");//Name for branch with EMC Reconstructed Points +const TString AliPHOSLoader::fgkCpvRecPointsBranchName("PHOSCpvRP");//Name for branch with CPV Reconstructed Points +const TString AliPHOSLoader::fgkTrackSegmentsBranchName("PHOSTS");//Name for branch with TrackSegments +const TString AliPHOSLoader::fgkRecParticlesBranchName("PHOSRP");//Name for branch with Reconstructed Particles +//____________________________________________________________________________ +AliPHOSLoader::AliPHOSLoader() + { + fDebug = 0; + } +//____________________________________________________________________________ +AliPHOSLoader::AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername): + AliLoader(detname,eventfoldername) +{ + fDebug=0; +} +//____________________________________________________________________________ + +AliPHOSLoader::~AliPHOSLoader() +{ + //remove and delete arrays + Clean(fgkHitsName); + Clean(fgkSDigitsName); + Clean(fgkDigitsName); + Clean(fgkEmcRecPointsName); + Clean(fgkCpvRecPointsName); + Clean(fgkTracksName); + Clean(fgkRecParticlesName); +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanFolders() + { + CleanRecParticles(); + AliLoader::CleanFolders(); + } +//____________________________________________________________________________ + +Int_t AliPHOSLoader::SetEvent() +{ +//Cleans loaded stuff and and sets Files and Directories +// do not post any data to folder/tasks + + + Int_t retval = AliLoader::SetEvent(); + if (retval) + { + Error("SetEvent","AliLoader::SetEvent returned error"); + return retval; + } + + + if (Hits()) Hits()->Clear(); + if (SDigits()) SDigits()->Clear(); + if (Digits()) Digits()->Clear(); + if (EmcRecPoints()) EmcRecPoints()->Clear(); + if (CpvRecPoints()) CpvRecPoints()->Clear(); + if (TrackSegments()) TrackSegments()->Clear(); + if (RecParticles()) RecParticles()->Clear(); + + return 0; +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::GetEvent() +{ +//Overloads GetEvent method called by AliRunLoader::GetEvent(Int_t) method +//to add Rec Particles specific for PHOS + +//First call the original method to get whatever from std. setup is needed + Int_t retval; + + retval = AliLoader::GetEvent(); + if (retval) + { + Error("GetEvent","AliLoader::GetEvent returned error"); + return retval; + } + + if (GetHitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadHits(); + if (GetSDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadSDigits(); + if (GetDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadDigits(); + if (GetRecPointsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecPoints(); + if (GetTracksDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadTracks(); + if (GetRecParticlesDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecParticles(); + + +//Now, check if RecPart were loaded + return 0; +} +//____________________________________________________________________________ + + +//____________________________________________________________________________ +const AliPHOS * AliPHOSLoader::PHOS() +{ + // returns the PHOS object + AliPHOS * phos = dynamic_cast(GetModulesFolder()->FindObject(fDetectorName)); + if ( phos == 0x0) + if (fDebug) + cout << "WARNING: AliPHOSLoader::PHOS -> PHOS module not found in Folders" << endl ; + return phos ; +} + +//____________________________________________________________________________ +const AliPHOSGeometry * AliPHOSLoader::PHOSGeometry() +{ + AliPHOSGeometry * rv = 0 ; + if (PHOS() ) + rv = PHOS()->GetGeometry(); + return rv ; +} + + +//____________________________________________________________________________ +Int_t AliPHOSLoader::LoadHits(Option_t* opt) +{ +//------- Hits ---------------------- +//Overload (extends) LoadHits implemented in AliLoader +// + Int_t res; + + //First call the AliLoader's method to send the TreeH to folder + res = AliLoader::LoadHits(opt); + + if (res) + {//oops, error + Error("LoadHits","AliLoader::LoadHits returned error"); + return res; + } + + //read the data from tree in folder and send it to folder + res = ReadHits(); + return 0; +} + + +//____________________________________________________________________________ +Int_t AliPHOSLoader::LoadSDigits(Option_t* opt) +{ //---------- SDigits ------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + res = AliLoader::LoadSDigits(opt); + if (res) + {//oops, error + Error("PostSDigits","AliLoader::LoadSDigits returned error"); + return res; + } + return ReadSDigits(); + +} +//____________________________________________________________________________ +Int_t AliPHOSLoader::LoadDigits(Option_t* opt) +{ + Int_t res; + //First call the AliLoader's method to send the TreeS to folder + res = AliLoader::LoadDigits(opt); + if (res) + {//oops, error + Error("LoadDigits","AliLoader::LoadDigits returned error"); + return res; + } + return ReadDigits(); +} +//____________________________________________________________________________ +Int_t AliPHOSLoader::LoadRecPoints(Option_t* opt) +{ // -------------- RecPoints ------------------------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeR to folder + res = AliLoader::LoadRecPoints(opt); + if (res) + {//oops, error + Error("LoadRecPoints","AliLoader::LoadRecPoints returned error"); + return res; + } + + TFolder * phosFolder = GetDetectorDataFolder(); + if ( phosFolder == 0x0 ) + { + Error("PostDigits","Can not get detector data folder"); + return 1; + } + return ReadRecPoints(); +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::LoadTracks(Option_t* opt) +{ + //Loads Tracks: Open File, Reads Tree and posts, Read Data and Posts + if (GetDebug()) Info("LoadTracks","opt = %s",opt); + Int_t res; + res = AliLoader::LoadTracks(opt); + if (res) + {//oops, error + Error("LoadTracks","AliLoader::LoadTracks returned error"); + return res; + } + return ReadTracks(); +} + +//____________________________________________________________________________ +Int_t AliPHOSLoader::LoadRecParticles(Option_t* opt) +{ // -------------- RecPoints ------------------------------------------- + Int_t res; + //First call the AliLoader's method to send the TreeT to folder + res = AliLoader::LoadRecParticles(opt); + if (res) + {//oops, error + Error("LoadRecParticles","AliLoader::LoadRecParticles returned error"); + return res; + } + return ReadRecParticles(); +} + +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostHits() +{ + Int_t reval = AliLoader::PostHits(); + if (reval) + { + Error("PostHits","AliLoader:: returned error"); + return reval; + } + return ReadHits(); +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostSDigits() +{ + Int_t reval = AliLoader::PostSDigits(); + if (reval) + { + Error("PostSDigits","AliLoader::PostSDigits returned error"); + return reval; + } + return ReadSDigits(); +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostDigits() +{ + Int_t reval = AliLoader::PostDigits(); + if (reval) + { + Error("PostDigits","AliLoader::PostDigits returned error"); + return reval; + } + return ReadDigits(); +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostRecPoints() +{ + Int_t reval = AliLoader::PostRecPoints(); + if (reval) + { + Error("PostRecPoints","AliLoader::PostRecPoints returned error"); + return reval; + } + return ReadRecPoints(); +} + +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostRecParticles() +{ + Int_t reval = AliLoader::PostRecParticles(); + if (reval) + { + Error("PostRecParticles","AliLoader::PostRecParticles returned error"); + return reval; + } + return ReadRecParticles(); +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::PostTracks() +{ + Int_t reval = AliLoader::PostTracks(); + if (reval) + { + Error("PostTracks","AliLoader::PostTracks returned error"); + return reval; + } + return ReadTracks(); +} +//____________________________________________________________________________ + + + +//____________________________________________________________________________ +Int_t AliPHOSLoader::ReadHits() +{ +// If there is no Clones Array in folder creates it and sends to folder +// then tries to read +// Reads the first entry of PHOS branch in hit tree TreeH() +// Reads data from TreeH and stores it in TClonesArray that sits in DetectorDataFolder +// + TObject** hitref = HitsRef(); + if(hitref == 0x0) + { + MakeHitsArray(); + hitref = HitsRef(); + } + + TClonesArray* hits = dynamic_cast(*hitref); + + TTree* treeh = TreeH(); + + if(treeh == 0) + { + Error("ReadHits"," Cannot read TreeH from folder"); + return 1; + } + + TBranch * hitsbranch = treeh->GetBranch(fDetectorName); + if (hitsbranch == 0) + { + Error("ReadHits"," Cannot find branch PHOS"); + return 1; + } + + if (GetDebug()) Info("ReadHits","Reading Hits"); + + if (hitsbranch->GetEntries() > 1) + { + TClonesArray * tempo = new TClonesArray("AliPHOSHit",1000); + + hitsbranch->SetAddress(&tempo); + Int_t index = 0 ; + Int_t i = 0 ; + for (i = 0 ; i < hitsbranch->GetEntries(); i++) + { + hitsbranch->GetEntry(i) ; + Int_t j = 0 ; + for ( j = 0 ; j < tempo->GetEntries() ; j++) + { + AliPHOSHit* hit = (AliPHOSHit*)tempo->At(j); + new((*hits)[index]) AliPHOSHit( *hit ) ; + index++ ; + } + } + delete tempo; + } + else + { + hitsbranch->SetAddress(hitref); + hitsbranch->GetEntry(0) ; + } + + return 0; +} +//____________________________________________________________________________ +Int_t AliPHOSLoader::ReadSDigits() +{ +// Read the summable digits tree TreeS(): +// Check if TClones is in folder +// if not create and add to folder +// connect to tree if available +// Read the data + + TObject** sdref = SDigitsRef(); + if(sdref == 0x0) + { + MakeSDigitsArray(); + sdref = SDigitsRef(); + } + + TTree * treeS = TreeS(); + if(treeS==0) + { + //May happen if file is truncated or new in LoadSDigits + //Error("ReadSDigits","There is no SDigit Tree"); + return 0; + } + + TBranch * branch = treeS->GetBranch(fDetectorName); + if (branch == 0) + {//easy, maybe just a new tree + //Error("ReadSDigits"," Cannot find branch PHOS"); + return 0; + } + + branch->SetAddress(SDigitsRef()); + branch->GetEntry(0); + return 0; +} + +//____________________________________________________________________________ +Int_t AliPHOSLoader::ReadDigits() +{ +// Read the summable digits tree TreeS(): +// Check if TClones is in folder +// if not create and add to folder +// connect to tree if available +// Read the data + + TObject** dref = DigitsRef(); + if(dref == 0x0) + {//if there is not array in folder, create it and put it there + MakeDigitsArray(); + dref = DigitsRef(); + } + + TTree * treeD = TreeD(); + if(treeD==0) + { + //May happen if file is truncated or new in LoadSDigits + //Error("ReadDigits","There is no Digit Tree"); + return 0; + } + + TBranch * branch = treeD->GetBranch(fDetectorName); + if (branch == 0) + {//easy, maybe just a new tree + //Error("ReadDigits"," Cannot find branch ",fDetectorName.Data()); + return 0; + } + + branch->SetAddress(dref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} + +//____________________________________________________________________________ + +void AliPHOSLoader::Track(Int_t itrack) +{ +// Read the first entry of PHOS branch in hit tree gAlice->TreeH() + if(TreeH()== 0) + { + if (LoadHits()) + { + Error("Track","Can not load hits."); + return; + } + } + + TBranch * hitsbranch = dynamic_cast(TreeH()->GetListOfBranches()->FindObject("PHOS")) ; + if ( !hitsbranch ) { + if (fDebug) + cout << "WARNING: AliPHOSLoader::ReadTreeH -> Cannot find branch PHOS" << endl ; + return ; + } + if(!Hits()) PostHits(); + + hitsbranch->SetAddress(HitsRef()); + hitsbranch->GetEntry(itrack); + +} +//____________________________________________________________________________ +void AliPHOSLoader::ReadTreeQA() +{ + // Read the digit tree gAlice->TreeQA() + // so far only PHOS knows about this Tree + + if(PHOS()->TreeQA()== 0){ + cerr << "ERROR: AliPHOSLoader::ReadTreeQA: can not read TreeQA " << endl ; + return ; + } + + TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS"); + if (!qabranch) { + if (fDebug) + cout << "WARNING: AliPHOSLoader::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ; + return ; + } + +// if(!Alarms()) PostQA(); + + qabranch->SetAddress(AlarmsRef()) ; + + qabranch->GetEntry(0) ; + +} + + +//____________________________________________________________________________ +Int_t AliPHOSLoader::ReadRecPoints() +{ +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to array + + MakeRecPointsArray(); + + TObjArray * cpva = 0x0 ; + TObjArray * emca = 0x0 ; + + TTree * treeR = TreeR(); + + if(treeR==0) + { + //May happen if file is truncated or new in LoadSDigits + return 0; + } + + Int_t retval = 0; + TBranch * emcbranch = treeR->GetBranch(fgkEmcRecPointsBranchName); + + if (emcbranch == 0x0) + { + Error("ReadRecPoints","Can not get branch with EMC Rec. Points named %s",fgkEmcRecPointsBranchName.Data()); + retval = 1; + } + else + { + emcbranch->SetAddress(&emca) ; + emcbranch->GetEntry(0) ; + } + TBranch * cpvbranch = treeR->GetBranch(fgkCpvRecPointsBranchName); + if (cpvbranch == 0x0) + { + Error("ReadRecPoints","Can not get branch with CPV Rec. Points named %s",fgkCpvRecPointsBranchName.Data()); + retval = 2; + } + else + { + cpvbranch->SetAddress(&cpva); + cpvbranch->GetEntry(0) ; + } + + Int_t ii ; + Int_t maxemc = emca->GetEntries() ; + for ( ii= 0 ; ii < maxemc ; ii++ ) + EmcRecPoints()->Add(emca->At(ii)) ; + + Int_t maxcpv = cpva->GetEntries() ; + for ( ii= 0 ; ii < maxcpv ; ii++ ) + CpvRecPoints()->Add(cpva->At(ii)) ; + + return retval; +} + +//____________________________________________________________________________ +Int_t AliPHOSLoader::ReadTracks() +{ +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to arry + + TObject** trkref = TracksRef(); + if ( trkref == 0x0 ) + {//Create and post array + MakeTrackSegmentsArray(); + trkref = TracksRef(); + } + + TTree * treeT = TreeT(); + if(treeT==0) + { + //May happen if file is truncated or new in LoadSDigits, or the file is in update mode, + //but tracking was not performed yet for a current event + //Error("ReadTracks","There is no Tree with Tracks"); + return 0; + } + + TBranch * branch = treeT->GetBranch(fgkTrackSegmentsBranchName); + if (branch == 0) + {//easy, maybe just a new tree + Error("ReadTracks"," Cannot find branch named %s",fgkTrackSegmentsBranchName.Data()); + return 0; + } + + branch->SetAddress(trkref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} +//____________________________________________________________________________ + +Int_t AliPHOSLoader::ReadRecParticles() +{ +//Reads Reconstructed Particles from file +//Creates and posts to folder an array container, +//connects branch in tree (if exists), and reads data to arry + + TObject** recpartref = RecParticlesRef(); + + if ( recpartref == 0x0 ) + {//Create and post array + MakeRecParticlesArray(); + recpartref = RecParticlesRef(); + } + + TTree * treeP = TreeP(); + if(treeP==0) + { + //May happen if file is truncated or new in LoadSDigits, + //or the file is in update mode, + //but tracking was not performed yet for a current event + // Error("ReadRecParticles","There is no Tree with Tracks and Reconstructed Particles"); + return 0; + } + + TBranch * branch = treeP->GetBranch(fgkRecParticlesBranchName); + if (branch == 0) + {//easy, maybe just a new tree + Error("ReadRecParticles"," Cannot find branch %s",fgkRecParticlesBranchName.Data()); + return 0; + } + + branch->SetAddress(recpartref);//connect branch to buffer sitting in folder + branch->GetEntry(0);//get first event + + return 0; +} + + +AliPHOSGeometry* AliPHOSLoader::GetPHOSGeometry() +{ +//returns PHOS geometry from gAlice +//static Method used by some classes where it is not convienient to pass eventfoldername + if (gAlice == 0x0) + return 0x0; + AliPHOS* phos=dynamic_cast(gAlice->GetDetector("PHOS")); + if (phos == 0x0) + return 0x0; + return phos->GetGeometry(); +} +/***************************************************************************************/ + +AliPHOSLoader* AliPHOSLoader::GetPHOSLoader(const char* eventfoldername) +{ + AliRunLoader* rn = AliRunLoader::GetRunLoader(eventfoldername); + if (rn == 0x0) + { + cerr<<"Error: : " + << "Can not find Run Loader in folder "<(rn->GetLoader("PHOSLoader")); +} +/***************************************************************************************/ + +Bool_t AliPHOSLoader::BranchExists(const TString& recName) + { + if (fBranchTitle.IsNull()) return kFALSE; + TString dataname, zername ; + TTree* tree; + if(recName == "SDigits") + { + tree = TreeS(); + dataname = GetDetectorName(); + zername = "AliPHOSSDigitizer" ; + } + else + if(recName == "Digits"){ + tree = TreeD(); + dataname = GetDetectorName(); + zername = "AliPHOSDigitizer" ; + } + else + if(recName == "RecPoints"){ + tree = TreeR(); + dataname = fgkEmcRecPointsBranchName; + zername = "AliPHOSClusterizer" ; + } + else + if(recName == "TrackSegments"){ + tree = TreeT(); + dataname = fgkTrackSegmentsBranchName; + zername = "AliPHOSTrackSegmentMaker"; + } + else + if(recName == "RecParticles"){ + tree = TreeP(); + dataname = fgkRecParticlesBranchName; + zername = "AliPHOSPID"; + } + else + return kFALSE ; + + + if(!tree ) + return kFALSE ; + + TObjArray * lob = static_cast(tree->GetListOfBranches()) ; + TIter next(lob) ; + TBranch * branch = 0 ; + TString titleName(fBranchTitle); + titleName+=":"; + + while ((branch = (static_cast(next())))) { + TString branchName(branch->GetName() ) ; + TString branchTitle(branch->GetTitle() ) ; + if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){ + Warning("BranchExists","branch %s with title %s ",dataname.Data(),fBranchTitle.Data()); + return kTRUE ; + } + if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){ + Warning("BranchExists","branch AliPHOS... with title %s ",branch->GetTitle()); + return kTRUE ; + } + } + return kFALSE ; + + } + +void AliPHOSLoader::SetBranchTitle(const TString& btitle) + { + if (btitle.CompareTo(fBranchTitle) == 0) return; + fBranchTitle = btitle; + ReloadAll(); + } +//____________________________________________________________________________ + +void AliPHOSLoader::CleanHits() +{ + AliLoader::CleanHits(); + //Clear an array + TClonesArray* hits = Hits(); + if (hits) hits->Clear(); +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanSDigits() +{ + AliLoader::CleanSDigits(); + TClonesArray* sdigits = SDigits(); + if (sdigits) sdigits->Clear(); + +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanDigits() +{ + AliLoader::CleanDigits(); + TClonesArray* digits = Digits(); + if (digits) digits->Clear(); +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanRecPoints() +{ + AliLoader::CleanRecPoints(); + TObjArray* recpoints = EmcRecPoints(); + if (recpoints) recpoints->Clear(); + recpoints = CpvRecPoints(); + if (recpoints) recpoints->Clear(); +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanTracks() +{ +//Cleans Tracks stuff + + AliLoader::CleanTracks();//tree + + //and clear the array + TClonesArray* tracks = TrackSegments(); + if (tracks) tracks->Clear(); + +} +//____________________________________________________________________________ + +void AliPHOSLoader::CleanRecParticles() + { + + TClonesArray *recpar = RecParticles(); + if (recpar) recpar->Clear(); + + + } +//____________________________________________________________________________ + +void AliPHOSLoader::ReadCalibrationDB(const char * database,const char * filename) +{ + + if(fcdb && (strcmp(database,fcdb->GetTitle())==0)) + return ; + + TFile * file = gROOT->GetFile(filename) ; + if(!file) + file = TFile::Open(filename); + if(!file){ + Error ("ReadCalibrationDB", "Cannot open file %s", filename) ; + return ; + } + if(fcdb) + fcdb->Delete() ; + fcdb = dynamic_cast(file->Get("AliPHOSCalibrationDB")) ; + if(!fcdb) + Error ("ReadCalibrationDB", "No database %s in file %s", database, filename) ; +} +//____________________________________________________________________________ + +// AliPHOSSDigitizer* AliPHOSLoader::PHOSSDigitizer() +// { +// //return PHOS SDigitizer +// return dynamic_cast(SDigitizer()) ; +// } + +//____________________________________________________________________________ +void AliPHOSLoader::MakeHitsArray() +{ + if (Hits()) return; + TClonesArray* hits = new TClonesArray("AliPHOSHit",1000); + hits->SetName(fgkHitsName); + GetDetectorDataFolder()->Add(hits); +} + +//____________________________________________________________________________ +void AliPHOSLoader::MakeSDigitsArray() +{ + if ( SDigits()) return; + TClonesArray* sdigits = new TClonesArray("AliPHOSDigit",1); + sdigits->SetName(fgkSDigitsName); + GetDetectorDataFolder()->Add(sdigits); +} + +//____________________________________________________________________________ +void AliPHOSLoader::MakeDigitsArray() +{ + if ( Digits()) return; + TClonesArray* digits = new TClonesArray("AliPHOSDigit",1); + digits->SetName(fgkDigitsName); + GetDetectorDataFolder()->Add(digits); + +} + +//____________________________________________________________________________ +void AliPHOSLoader::MakeRecPointsArray() +{ + if ( EmcRecPoints() == 0x0) + { + if (GetDebug()>9) Info("MakeRecPointsArray","Making array for EMC"); + TObjArray* emc = new TObjArray(100) ; + emc->SetName(fgkEmcRecPointsName) ; + GetDetectorDataFolder()->Add(emc); + } + + if ( CpvRecPoints() == 0x0) + { + if (GetDebug()>9) Info("MakeRecPointsArray","Making array for CPV"); + TObjArray* cpv = new TObjArray(100) ; + cpv->SetName(fgkCpvRecPointsName); + GetDetectorDataFolder()->Add(cpv); + } +} + +//____________________________________________________________________________ +void AliPHOSLoader::MakeTrackSegmentsArray() +{ + if ( TrackSegments()) return; + TClonesArray * ts = new TClonesArray("AliPHOSTrackSegment",100) ; + ts->SetName(fgkTracksName); + GetDetectorDataFolder()->Add(ts); + +} + +//____________________________________________________________________________ +void AliPHOSLoader::MakeRecParticlesArray() +{ + if ( RecParticles()) return; + TClonesArray * rp = new TClonesArray("AliPHOSRecParticle",100) ; + rp->SetName(fgkRecParticlesName); + GetDetectorDataFolder()->Add(rp); +} diff --git a/PHOS/AliPHOSLoader.h b/PHOS/AliPHOSLoader.h new file mode 100644 index 00000000000..453ed14996c --- /dev/null +++ b/PHOS/AliPHOSLoader.h @@ -0,0 +1,334 @@ +#ifndef ALIPHOSLOADER_H +#define ALIPHOSLOADER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// A singleton that returns various objects +// Should be used on the analysis stage to avoid confusing between different +// branches of reconstruction tree: e.g. reading RecPoints and TS made from +// another set of RecPoints. +// +// The objects are retrived from folders. +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) +// + + +// --- ROOT system --- +#include "TClonesArray.h" +#include "TFolder.h" +#include "TTree.h" +class TString ; +class TParticle ; +class TTask ; + +// --- Standard library --- +#include +#include + +// --- AliRoot header files --- + +#include "AliRun.h" +#include "AliLoader.h" +#include "AliRunLoader.h" +#include "AliPHOS.h" +#include "AliPHOSHit.h" +#include "AliPHOSDigit.h" +#include "AliPHOSEmcRecPoint.h" +#include "AliPHOSCpvRecPoint.h" +#include "AliPHOSTrackSegment.h" +#include "AliPHOSRecParticle.h" +class AliPHOSGeometry ; +#include "AliPHOSDigitizer.h" +#include "AliPHOSSDigitizer.h" +#include "AliPHOSClusterizer.h" +#include "AliPHOSTrackSegmentMaker.h" +#include "AliPHOSPID.h" +class AliPHOSCalibrationDB ; + + +// + +class AliPHOSLoader : public AliLoader { + + public: + + AliPHOSLoader(); + AliPHOSLoader(const AliPHOSLoader & obj){} + AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername); + + virtual ~AliPHOSLoader() ; + + // assignement operator requested by coding convention, but not needed + AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;} + + Int_t GetEvent();//extends the method on PHOS RecPart posting + Int_t SetEvent();//extends the method on PHOS RecPart posting + + Bool_t BranchExists(const TString& recName); + Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree + Int_t LoadSDigits(Option_t* opt=""); + Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree + Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree + Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree + Int_t LoadRecParticles(Option_t* opt=""); + + Int_t PostHits(); //Posts the + Int_t PostSDigits(); + Int_t PostDigits(); + Int_t PostRecPoints(); + Int_t PostTracks(); + Int_t PostRecParticles(); + + void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean + + void CleanHits(); + void CleanSDigits(); + void CleanDigits(); + void CleanRecPoints(); + void CleanTracks(); + void CleanRecParticles(); + +//up to now it is only here -> no definition about global/incremental tracking/PID + +// Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles +// Int_t WritePID(Option_t* opt="");//writes the task for PID to file +// Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;} +// Bool_t PostQA (void) const ; //it was empty anyway + +/*******************************************************************/ +/*******************************************************************/ +/*******************************************************************/ + + TObject** HitsRef(){return GetDetectorDataRef(Hits());} + TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());} + TObject** DigitsRef(){return GetDetectorDataRef(Digits());} + TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());} + TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());} + TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());} + TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());} + TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());} + void Track(Int_t itrack) ; + + static AliPHOSGeometry* GetPHOSGeometry(); + static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername); + + //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. + Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();} + Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();} + + const AliPHOS * PHOS(); + const AliPHOSGeometry *PHOSGeometry() ; + // Alarms + // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); } + TObjArray * Alarms(); + + /*********************************************/ + /************ TClonesArrays ***********/ + /*********************************************/ + /**** H i t s ****/ + TClonesArray* Hits(void); + const AliPHOSHit* Hit(Int_t index); + void MakeHitsArray(); + /**** S D i g i t s ****/ + TClonesArray* SDigits(); + const AliPHOSDigit* SDigit(Int_t index); + void MakeSDigitsArray(); + /**** D i g i t s ****/ + TClonesArray* Digits(); + const AliPHOSDigit * Digit(Int_t index); + void MakeDigitsArray(); + /**** R e c P o i n t s ****/ + TObjArray * EmcRecPoints(); + TObjArray * CpvRecPoints(); + const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ; + const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ; + void MakeRecPointsArray(); + /**** T r a c k S e g m e n t s ****/ + TClonesArray * TrackSegments(); + const AliPHOSTrackSegment * TrackSegment(Int_t index); + void MakeTrackSegmentsArray(); + /**** R e c P a r t ic l e s ****/ + TClonesArray * RecParticles() ; + const AliPHOSRecParticle * RecParticle(Int_t index); + void MakeRecParticlesArray(); + + /*********************************************/ + /************ T A S K S **************/ + /*********************************************/ + // + // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName); + //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast(Digitizer()) ;} + + AliPHOSClusterizer* Clusterizer () {return dynamic_cast(Reconstructioner()) ;} + Int_t PostClusterizer(TTask* clust){return PostReconstructioner(clust);} + Int_t LoadClusterizer(Option_t * opt="") {return LoadReconstructioner(opt);} + Int_t WriteClusterizer(Option_t * opt="") {return WriteReconstructioner(opt);} + + AliPHOSPID * PID (){return dynamic_cast(PIDTask()) ;} + Int_t PostPID(TTask* pid){return PostPIDTask(pid);} + Int_t LoadPID(Option_t * opt="") {return LoadPIDTask(opt);} + Int_t WritePID(Option_t * opt="") {return WritePIDTask(opt);} + + + AliPHOSTrackSegmentMaker * TrackSegmentMaker () { return dynamic_cast(Tracker()) ;} + Int_t PostTrackSegmentMaker(TTask* segmaker){return PostTracker(segmaker);} + Int_t LoadTrackSegmentMaker(Option_t * opt="") {return LoadTracker(opt);} + Int_t WriteTrackSegmentMaker(Option_t * opt="") {return WriteTracker(opt);} + + + void SetDebug(Int_t level) {fDebug = level;} // Set debug level + void SetBranchTitle(const TString& btitle); + + AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } + void ReadCalibrationDB(const char * name, const char * filename); + +protected: + TString fBranchTitle; //Title of the branch + AliPHOSCalibrationDB * fcdb ; //! + +private: + + Int_t ReadHits(); + Int_t ReadDigits(); + Int_t ReadSDigits(); + Int_t ReadRecPoints(); + Int_t ReadTracks(); + Int_t ReadRecParticles(); + + void ReadTreeQA() ; + Int_t fDebug ; // Debug level + + public: + + static const TString fgkHitsName;//Name for TClonesArray with hits from one event + static const TString fgkSDigitsName;//Name for TClonesArray + static const TString fgkDigitsName;//Name for TClonesArray + static const TString fgkEmcRecPointsName;//Name for TClonesArray + static const TString fgkCpvRecPointsName;//Name for TClonesArray + static const TString fgkTracksName;//Name for TClonesArray + static const TString fgkRecParticlesName;//Name for TClonesArray + + static const TString fgkEmcRecPointsBranchName;//Name for branch + static const TString fgkCpvRecPointsBranchName;//Name for branch + static const TString fgkTrackSegmentsBranchName;//Name for branch + static const TString fgkRecParticlesBranchName;//Name for branch + + ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index + +}; + +/******************************************************************************/ +/**************** I N L I N E S ****************************************/ +/******************************************************************************/ + +inline TClonesArray* AliPHOSLoader::Hits() +{ + return (TClonesArray*)GetDetectorData(fgkHitsName); +} +/******************************************************************************/ + +inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index) +{ + const TClonesArray* tcarr = Hits(); + if (tcarr) + return (const AliPHOSHit*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray* AliPHOSLoader::SDigits() +{ + return dynamic_cast(GetDetectorData(fgkSDigitsName)); +} +/******************************************************************************/ + +inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index) +{ + const TClonesArray* tcarr = SDigits(); + if (tcarr) + return (const AliPHOSDigit*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray* AliPHOSLoader::Digits() +{ + return dynamic_cast(GetDetectorData(fgkDigitsName)); +} +/******************************************************************************/ + +inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index) +{ + const TClonesArray* tcarr = Digits(); + if (tcarr) + return (const AliPHOSDigit*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TObjArray * AliPHOSLoader::EmcRecPoints() +{ + return dynamic_cast(GetDetectorData(fgkEmcRecPointsName)); +} +/******************************************************************************/ + +inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index) +{ + TObjArray* tcarr = EmcRecPoints(); + if (tcarr) + return (const AliPHOSEmcRecPoint*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TObjArray * AliPHOSLoader::CpvRecPoints() +{ + return dynamic_cast(GetDetectorData(fgkCpvRecPointsName)); +} +/******************************************************************************/ + +inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index) +{ + TObjArray* tcarr = CpvRecPoints(); + if (tcarr) + return (const AliPHOSCpvRecPoint*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray * AliPHOSLoader::TrackSegments() +{ + return dynamic_cast(GetDetectorData(fgkTracksName)); +} +/******************************************************************************/ + +inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index) +{ + const TClonesArray* tcarr = TrackSegments(); + if (tcarr) + return (const AliPHOSTrackSegment*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ + +inline TClonesArray * AliPHOSLoader::RecParticles() +{ + return dynamic_cast(GetDetectorData(fgkRecParticlesName)); +} +/******************************************************************************/ + +inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index) +{ + TClonesArray* tcarr = RecParticles(); + if (tcarr) + return (const AliPHOSRecParticle*) tcarr->At(index); + return 0x0; +} +/******************************************************************************/ +inline TObjArray * AliPHOSLoader::Alarms() +{ return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));} + +#endif // AliPHOSLOADER_H diff --git a/PHOS/AliPHOSPID.cxx b/PHOS/AliPHOSPID.cxx index 4ae90bb5994..22320cda3ae 100644 --- a/PHOS/AliPHOSPID.cxx +++ b/PHOS/AliPHOSPID.cxx @@ -27,11 +27,15 @@ // --- ROOT system --- - +#include "TGeometry.h" +#include "TDirectory.h" +#include "TFile.h" +#include "TTree.h" + // --- Standard library --- - // --- AliRoot header files --- +#include "AliRun.h" #include "AliPHOSPID.h" ClassImp(AliPHOSPID) @@ -40,33 +44,20 @@ ClassImp(AliPHOSPID) AliPHOSPID::AliPHOSPID():TTask("","") { // ctor - fSplitFile= 0 ; - + fEventFolderName = "" ; } //____________________________________________________________________________ -AliPHOSPID::AliPHOSPID(const char* headerFile, const char * name, const Bool_t toSplit):TTask(name, headerFile) +AliPHOSPID::AliPHOSPID(const TString alirunFileName, const TString eventFolderName) +:TTask("PHOS"+AliConfig::fgkPIDTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - - fToSplit = toSplit ; - fSplitFile= 0 ; -} - -//____________________________________________________________________________ - AliPHOSPID::AliPHOSPID(AliPHOSPID &pid):TTask(pid) -{ - // copy ctor - fSplitFile = pid.fSplitFile ; - fToSplit = pid.fToSplit ; - } //____________________________________________________________________________ AliPHOSPID::~AliPHOSPID() { // dtor - - fSplitFile = 0 ; } + diff --git a/PHOS/AliPHOSPID.h b/PHOS/AliPHOSPID.h index 3b8469747e1..722d14b0592 100644 --- a/PHOS/AliPHOSPID.h +++ b/PHOS/AliPHOSPID.h @@ -13,10 +13,12 @@ // --- ROOT system --- -#include "TTask.h" +#include "TTask.h" +#include "AliConfig.h" + class TFormula ; class TClonesArray ; -class TFile ; + // --- Standard library --- // --- AliRoot header files --- @@ -30,36 +32,26 @@ class AliPHOSPID : public TTask { public: AliPHOSPID() ; // ctor - AliPHOSPID(const char* headerFile,const char * name, const Bool_t toSplit) ; - AliPHOSPID(AliPHOSPID& pid) ; // cpy ctor + AliPHOSPID (const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliPHOSPID(const AliPHOSPID & pid) {;} virtual ~AliPHOSPID() ; // dtor virtual void Exec(Option_t * option) { Warning("Exec", "not defined" ) ; } - // virtual char * GetRecParticlesBranch()const { Warning("GetRecParticlesBranch", "not defined" ) ; return 0 ; } - // virtual char * GetTrackSegmentsBranch()const { Warning("GetTrackSegmentsBranch", "not defined" ) ; return 0 ; } virtual const Int_t GetRecParticlesInRun() const { Warning("GetRecParticlesInRun", "not defined" ) ; return 0 ;} - virtual void Print(Option_t * option) const { Warning("Print", "not defined" ) ;} - //virtual void PlotDispersionCuts()const = 0; - //virtual void SetIdentificationMethod(char * option) = 0 ; - //virtual void SetShowerProfileCut(char * formula) = 0 ; - //virtual void SetDispersionCut(Float_t cut) = 0 ; - virtual void SetCpvtoEmcDistanceCut(Float_t ClusterEn, TString EffPur,Float_t cut ) { Warning("SetCpvtoEmcDistanceCut", "not defined" ) ;} - virtual void SetTimeGate(Float_t ClusterEn, TString EffPur, Float_t gate) { Warning("SetTimeGate", "not defined" ) ; } - // virtual void SetTrackSegmentsBranch(const char* title) { Warning("Exec", "not defined" ) ; } - // virtual void SetRecParticlesBranch (const char* title) { Warning("SetTecParticlesBranch", "not defined" ) ; } - // virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ; + virtual void Print() const { Warning("Print", "not defined" ) ;} + virtual void SetCpvtoEmcDistanceCut(Float_t Cluster_En, TString Eff_Pur,Float_t cut ) { Warning("SetCpvtoEmcDistanceCut", "not defined" ) ;} + void SetEventFolderName(TString name) { fEventFolderName = name ; } + virtual void SetTimeGate(Float_t Cluster_En, TString Eff_Pur, Float_t gate) { Warning("SetTimeGate", "not defined" ) ; } virtual const char * Version() const { Warning("Version", "not defined" ) ; return 0 ; } virtual void WriteRecParticles(Int_t event) { Warning("WriteRecParticles", "not defined" ) ; } - AliPHOSPID & operator = (const AliPHOSPID & pid) { return *this ; } -protected: +private: virtual void Init() { Warning("Init", "not defined" ) ; } protected: + TString fEventFolderName ; // event folder name - TFile * fSplitFile ; //! file in which RecParticles will eventually be stored - Bool_t fToSplit ; //! do we in the split mode - ClassDef(AliPHOSPID,1) // Particle Identifier algorithm (base class) + ClassDef(AliPHOSPID,3) // Particle Identifier algorithm (base class) } ; diff --git a/PHOS/AliPHOSPIDv0.cxx b/PHOS/AliPHOSPIDv0.cxx index 3e62804e717..9479caa6aeb 100644 --- a/PHOS/AliPHOSPIDv0.cxx +++ b/PHOS/AliPHOSPIDv0.cxx @@ -63,17 +63,23 @@ #include "TF2.h" #include "TFormula.h" #include "TCanvas.h" +#include "TFolder.h" +#include "TSystem.h" #include "TBenchmark.h" // --- Standard library --- // --- AliRoot header files --- +#include "AliRun.h" #include "AliGenerator.h" +#include "AliPHOS.h" #include "AliPHOSPIDv0.h" +#include "AliPHOSClusterizerv1.h" #include "AliPHOSTrackSegment.h" +#include "AliPHOSTrackSegmentMakerv1.h" #include "AliPHOSRecParticle.h" #include "AliPHOSGeometry.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" ClassImp( AliPHOSPIDv0) @@ -85,7 +91,7 @@ AliPHOSPIDv0::AliPHOSPIDv0():AliPHOSPID() fDispersion = 0. ; fCpvEmcDistance = 0 ; fTimeGate = 2.e-9 ; - fHeaderFileName = "" ; + fEventFolderName = "" ; fTrackSegmentsTitle= "" ; fRecPointsTitle = "" ; fRecParticlesTitle = "" ; @@ -96,7 +102,7 @@ AliPHOSPIDv0::AliPHOSPIDv0():AliPHOSPID() } //____________________________________________________________________________ -AliPHOSPIDv0::AliPHOSPIDv0(const char * headerFile,const char * name, const Bool_t toSplit) : AliPHOSPID(headerFile, name,toSplit) +AliPHOSPIDv0::AliPHOSPIDv0(const char * evFolderName,const char * name) : AliPHOSPID(evFolderName, name) { //ctor with the indication on where to look for the track segments @@ -105,36 +111,17 @@ AliPHOSPIDv0::AliPHOSPIDv0(const char * headerFile,const char * name, const Bool fCpvEmcDistance = 3.0 ; fTimeGate = 2.e-9 ; - fHeaderFileName = GetTitle() ; - fTrackSegmentsTitle = GetName() ; - fRecPointsTitle = GetName() ; - fRecParticlesTitle = GetName() ; + fEventFolderName = GetTitle() ; + fTrackSegmentsTitle = GetName(); + fRecPointsTitle = GetName(); + fRecParticlesTitle = GetName(); fIDOptions = "dis time" ; - TString tempo(GetName()) ; - tempo.Append(":") ; - tempo.Append(Version()) ; - SetName(tempo) ; fRecParticlesInRun = 0 ; Init() ; } -AliPHOSPIDv0::AliPHOSPIDv0(AliPHOSPIDv0 & pid):AliPHOSPID(pid) -{ - // copy ctor - fHeaderFileName = pid.fHeaderFileName ; - fTrackSegmentsTitle = pid.fTrackSegmentsTitle ; - fRecPointsTitle = pid.fRecPointsTitle ; - fRecParticlesTitle = pid.fRecParticlesTitle ; - fIDOptions = pid.fIDOptions ; - fNEvent = pid.fNEvent ; - fFormula = new TFormula(*pid.fFormula) ; - fDispersion = pid.fDispersion ; - fCpvEmcDistance = pid.fCpvEmcDistance ; - fRecParticlesInRun = pid.fRecParticlesInRun ; - Init() ; -} //____________________________________________________________________________ AliPHOSPIDv0::~AliPHOSPIDv0() @@ -146,7 +133,7 @@ Float_t AliPHOSPIDv0::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cp { // Calculates the distance between the EMC RecPoint and the PPSD RecPoint - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + const AliPHOSGeometry * geom = AliPHOSLoader::GetPHOSGeometry() ; TVector3 vecEmc ; TVector3 vecCpv ; @@ -181,46 +168,38 @@ void AliPHOSPIDv0::Exec(Option_t * option) gBenchmark->Start("PHOSPID"); if(strstr(option,"print")) { - Print("") ; + Print() ; return ; } - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); + if(runget == 0x0) + { + Error("Exec","Can not find run getter in event folder \"%s\"",GetTitle()); + return; + } + + AliPHOSLoader* gime = dynamic_cast(runget->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("Exec","Could not obtain the Loader object !"); + return ; + } + if(gime->BranchExists("RecParticles") ) return ; -// gAlice->GetEvent(0) ; -// //check, if the branch with name of this" already exits? -// TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ; -// TIter next(lob) ; -// TBranch * branch = 0 ; -// Bool_t phospidfound = kFALSE, pidfound = kFALSE ; -// TString taskName(GetName()) ; -// taskName.Remove(taskName.Index(Version())-1) ; + Int_t nevents = runget->GetNumberOfEvents() ; //(Int_t) gAlice->TreeE()->GetEntries() ; -// while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) { -// if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) -// phospidfound = kTRUE ; - -// else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) -// pidfound = kTRUE ; -// } - -// if ( phospidfound || pidfound ) { -// Error("Exec", "RecParticles and/or PIDtMaker branch with name %s already exists", taskName.Data() ) ; -// return ; -// } - - Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ - gime->Event(ievent,"R") ; + runget->GetEvent(ievent); Info("Exec", "event %d %d %d", ievent, gime->EmcRecPoints(), gime->TrackSegments()) ; MakeRecParticles() ; - WriteRecParticles(ievent); + WriteRecParticles(); if(strstr(option,"deb")) PrintRecParticles(option) ; @@ -243,57 +222,50 @@ void AliPHOSPIDv0::Init() // Make all memory allocations that are not possible in default constructor // Add the PID task to the list of PHOS tasks - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; + AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); + if(runget == 0x0) + { + Error("Exec","Can not find run getter in event folder \"%s\"",GetTitle()); + return; + } - TString taskName(GetName()) ; - taskName.Remove(taskName.Index(Version())-1) ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data(),fToSplit) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !") ; - return ; - } + AliPHOSLoader* gime = dynamic_cast(runget->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("Exec","Could not obtain the Loader object !"); + return ; + } - fSplitFile = 0 ; - if(fToSplit){ - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } - - - gime->PostPID(this) ; - // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName - gime->PostRecParticles(taskName.Data() ) ; + gime->PostPID(this); + gime->LoadRecParticles("UPDATE"); } //____________________________________________________________________________ void AliPHOSPIDv0::MakeRecParticles(){ - // Makes a RecParticle out of a TrackSegment TString taskName(GetName()) ; taskName.Remove(taskName.Index(Version())-1) ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - TObjArray * emcRecPoints = gime->EmcRecPoints(taskName) ; - TObjArray * cpvRecPoints = gime->CpvRecPoints(taskName) ; - TClonesArray * trackSegments = gime->TrackSegments(taskName) ; - TClonesArray * recParticles = gime->RecParticles(taskName) ; + AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); + if(runget == 0x0) + { + Error("Exec","Can not find run getter in event folder \"%s\"",GetTitle()); + return; + } + + AliPHOSLoader* gime = dynamic_cast(runget->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("Exec","Could not obtain the Loader object !"); + return ; + } + + TObjArray * emcRecPoints = gime->EmcRecPoints() ; + TObjArray * cpvRecPoints = gime->CpvRecPoints() ; + TClonesArray * trackSegments = gime->TrackSegments() ; + TClonesArray * recParticles = gime->RecParticles() ; + recParticles->Clear(); TIter next(trackSegments) ; @@ -367,11 +339,11 @@ void AliPHOSPIDv0::MakeRecParticles(){ } //____________________________________________________________________________ -void AliPHOSPIDv0:: Print(Option_t * option) const +void AliPHOSPIDv0:: Print() const { // Print the parameters used for the particle type identification TString message ; - message = "=============== AliPHOSPID1 ================\n" ; + message = "=============== AliPHOSPIDv0 ================\n" ; message += "Making PID\n" ; message += " Headers file: %s\n" ; message += " RecPoints branch title: %s\n" ; @@ -380,7 +352,7 @@ void AliPHOSPIDv0:: Print(Option_t * option) const message += "with parameters:\n" ; message += " Maximal EMC - CPV distance (cm) %f\n" ; Info("Print", message.Data(), - fHeaderFileName.Data(), + GetTitle(), fRecPointsTitle.Data(), fTrackSegmentsTitle.Data(), fRecParticlesTitle.Data(), @@ -404,77 +376,50 @@ void AliPHOSPIDv0::SetShowerProfileCut(char * formula) fFormula = new TFormula("Lambda Cut",formula) ; } //____________________________________________________________________________ -void AliPHOSPIDv0::WriteRecParticles(Int_t event) +void AliPHOSPIDv0::WriteRecParticles() { - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; - TString taskName(GetName()) ; - taskName.Remove(taskName.Index(Version())-1) ; - TClonesArray * recParticles = gime->RecParticles(taskName) ; + AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); + if(runget == 0x0) + { + Error("Exec","Can not find run getter in event folder \"%s\"",GetTitle()); + return; + } + + AliPHOSLoader* gime = dynamic_cast(runget->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("Exec","Could not obtain the Loader object !"); + return ; + } + + TClonesArray * recParticles = gime->RecParticles() ; recParticles->Expand(recParticles->GetEntriesFast() ) ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - char name[10] ; - sprintf(name,"%s%d", "TreeR",event) ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } + TTree * treeR = gime->TreeR(); if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; + gime->MakeTree("R"); + treeR = gime->TreeR() ; } - -// //Make branch in TreeR for RecParticles -// char * filename = 0; -// if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name -// filename = new char[strlen(gAlice->GetBaseFile())+20] ; -// sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ; -// } - -// TDirectory *cwd = gDirectory; //First rp Int_t bufferSize = 32000 ; TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize); rpBranch->SetTitle(fRecParticlesTitle); -// if (filename) { -// rpBranch->SetFile(filename); -// TIter next( rpBranch->GetListOfBranches()); -// TBranch * sb ; -// while ((sb=(TBranch*)next())) { -// sb->SetFile(filename); -// } -// cwd->cd(); -// } //second, pid Int_t splitlevel = 0 ; AliPHOSPIDv0 * pid = this ; TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel); pidBranch->SetTitle(fRecParticlesTitle.Data()); -// if (filename) { -// pidBranch->SetFile(filename); -// TIter next( pidBranch->GetListOfBranches()); -// TBranch * sb ; -// while ((sb=(TBranch*)next())) { -// sb->SetFile(filename); -// } -// cwd->cd(); -// } rpBranch->Fill() ; pidBranch->Fill() ; - - treeR->AutoSave() ; //Write(0,kOverwrite) ; - + + gime->WriteRecParticles("OVERWRITE"); + gime->WritePID("OVERWRITE"); + } //____________________________________________________________________________ @@ -560,11 +505,23 @@ void AliPHOSPIDv0::PrintRecParticles(Option_t * option) { // Print table of reconstructed particles - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; + AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); + if(runget == 0x0) + { + Error("WriteRecParticles","Can not find run getter in event folder \"%s\"",GetTitle()); + return; + } + + AliPHOSLoader* gime = dynamic_cast(runget->GetLoader("PHOSLoader")); + if ( gime == 0 ) + { + Error("WriteRecParticles","Could not obtain the Loader object !"); + return ; + } TString taskName(GetName()) ; taskName.Remove(taskName.Index(Version())-1) ; - TClonesArray * recParticles = gime->RecParticles(taskName) ; + TClonesArray * recParticles = gime->RecParticles() ; TString message ; message = "event %d\n" ; @@ -573,7 +530,7 @@ void AliPHOSPIDv0::PrintRecParticles(Option_t * option) if(strstr(option,"all")) { // printing found TS Info("PrintRecParticles"," PARTICLE Index \n" ) ; - + Int_t index ; for (index = 0 ; index < recParticles->GetEntries() ; index++) { AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ; diff --git a/PHOS/AliPHOSPIDv0.h b/PHOS/AliPHOSPIDv0.h index b9e458b8d7b..bb5ae82416a 100644 --- a/PHOS/AliPHOSPIDv0.h +++ b/PHOS/AliPHOSPIDv0.h @@ -29,8 +29,7 @@ class AliPHOSPIDv0 : public AliPHOSPID { public: AliPHOSPIDv0() ; // ctor - AliPHOSPIDv0(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ; - AliPHOSPIDv0(AliPHOSPIDv0 & pid) ; // cpy ctor + AliPHOSPIDv0(const char* evFolderName, const char * tsBranch = "Default"); virtual ~AliPHOSPIDv0() ; // dtor virtual void Exec(Option_t * option); @@ -39,7 +38,7 @@ public: virtual const Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;} virtual void PlotDispersionCuts()const ; - virtual void Print(Option_t * option)const ; + virtual void Print()const ; virtual void SetIdentificationMethod(char * option = "CPV DISP" ){fIDOptions = option ;} virtual void SetShowerProfileCut(char * formula = "0.35*0.35 - (x-1.386)*(x-1.386) - 1.707*1.707*(y-1.008)*(y-1.008)") ; virtual void SetDispersionCut(Float_t cut){fDispersion = cut ; } @@ -48,7 +47,7 @@ public: // virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;} // virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;} virtual const char * Version() const { return "pid-v0" ; } - AliPHOSPIDv0 & operator = (const AliPHOSPIDv0 & pid) { return *this ; } + private: virtual void Init() ; @@ -56,11 +55,11 @@ public: Float_t GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ; // Relative Distance CPV-EMC TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const ; void PrintRecParticles(Option_t * option) ; - virtual void WriteRecParticles(Int_t event) ; + virtual void WriteRecParticles(); private: - TString fHeaderFileName ; // file name with event header + TString fEventFolderName; // file name with event header TString fTrackSegmentsTitle; // branch name with track segments TString fRecPointsTitle ; // branch name with rec points TString fRecParticlesTitle ; // branch name with rec particles diff --git a/PHOS/AliPHOSPIDv1.cxx b/PHOS/AliPHOSPIDv1.cxx index e52ef2e8944..ca775fc2f3b 100644 --- a/PHOS/AliPHOSPIDv1.cxx +++ b/PHOS/AliPHOSPIDv1.cxx @@ -94,11 +94,9 @@ // --- Standard library --- -#include // --- AliRoot header files --- -#include "AliRun.h" #include "AliGenerator.h" #include "AliPHOS.h" #include "AliPHOSPIDv1.h" @@ -118,53 +116,41 @@ AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID() InitParameters() ; fDefaultInit = kTRUE ; - } //____________________________________________________________________________ -AliPHOSPIDv1::AliPHOSPIDv1(AliPHOSPIDv1 & pid ):AliPHOSPID(pid) +AliPHOSPIDv1::AliPHOSPIDv1(const AliPHOSPIDv1 & pid ):AliPHOSPID(pid) { // ctor InitParameters() ; - Init() ; - fDefaultInit = kFALSE ; } //____________________________________________________________________________ -AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name, const Bool_t toSplit) -:AliPHOSPID(headerFile, name,toSplit) +AliPHOSPIDv1::AliPHOSPIDv1(const TString alirunFileName, const TString eventFolderName):AliPHOSPID(alirunFileName, eventFolderName) { //ctor with the indication on where to look for the track segments InitParameters() ; - Init() ; fDefaultInit = kFALSE ; - } //____________________________________________________________________________ AliPHOSPIDv1::~AliPHOSPIDv1() { // dtor - // fDefaultInit = kTRUE if PID created by default ctor (to get just the parameters) delete [] fX ; // Principal input delete [] fPPhoton ; // Photon Principal components delete [] fPPi0 ; // Pi0 Principal components - - if (!fDefaultInit) - fSplitFile = 0 ; } - //____________________________________________________________________________ const TString AliPHOSPIDv1::BranchName() const { - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + + return GetName() ; } //____________________________________________________________________________ @@ -173,42 +159,10 @@ void AliPHOSPIDv1::Init() // Make all memory allocations that are not possible in default constructor // Add the PID task to the list of PHOS tasks - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname(GetName()) ; - branchname.Remove(branchname.Index(Version())-1) ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(),fToSplit ) ; - - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !" ) ; - return ; - } - - fSplitFile = 0 ; - if(fToSplit){ - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } - - gime->PostPID(this) ; - // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName - gime->PostRecParticles(branchname) ; - + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()) ; + + if ( !gime->PID() ) + gime->PostPID(this) ; } //____________________________________________________________________________ @@ -218,15 +172,52 @@ void AliPHOSPIDv1::InitParameters() fRecParticlesInRun = 0 ; fNEvent = 0 ; fRecParticlesInRun = 0 ; - TString pidName( GetName()) ; - if (pidName.IsNull() ) - pidName = "Default" ; - pidName.Append(":") ; - pidName.Append(Version()) ; - SetName(pidName) ; SetParameters() ; // fill the parameters matrix from parameters file } +//________________________________________________________________________ +void AliPHOSPIDv1::Exec(Option_t * option) +{ + //Steering method + + + if(strstr(option,"tim")) + gBenchmark->Start("PHOSPID"); + + if(strstr(option,"print")) { + Print() ; + return ; + } + + + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + Int_t nevents = gime->MaxEvent() ; + Int_t ievent ; + + + for(ievent = 0; ievent < nevents; ievent++){ + gime->Event(ievent,"TR") ; + if(gime->TrackSegments() && //Skip events, where no track segments made + gime->TrackSegments()->GetEntriesFast()) { + MakeRecParticles() ; + WriteRecParticles(ievent); + if(strstr(option,"deb")) + PrintRecParticles(option) ; + //increment the total number of rec particles per run + fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; + } + } + if(strstr(option,"tim")){ + gBenchmark->Stop("PHOSPID"); + Info("Exec", "took %f seconds for PID %f seconds per event", + gBenchmark->GetCpuTime("PHOSPID"), + gBenchmark->GetCpuTime("PHOSPID")/nevents) ; + } + + Unload(); +} + //____________________________________________________________________________ const TString AliPHOSPIDv1::GetFileNamePrincipal(TString particle) const { @@ -251,6 +242,22 @@ const Float_t AliPHOSPIDv1::GetParameterCalibration(Int_t i) const return param; } +//____________________________________________________________________________ +const Float_t AliPHOSPIDv1::GetCalibratedEnergy(const Float_t e) const +{ +// It calibrates Energy depending on the recpoint energy. +// The energy of the reconstructed cluster is corrected with +// the formula A + B* E + C* E^2, whose parameters where obtained +// through the study of the reconstructed energy distribution of +// monoenergetic photons. + + Float_t p[]={0.,0.,0.}; + for (Int_t i=0; i<3; i++) p[i] = GetParameterCalibration(i); + Float_t enerec = p[0] + p[1]*e + p[2]*e*e; + return enerec ; + +} + //____________________________________________________________________________ const Float_t AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const { @@ -268,49 +275,36 @@ const Float_t AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const } //____________________________________________________________________________ -const Float_t AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const +const Float_t AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) const { - // Get TimeGate parameter depending on Purity-Efficiency i: - // i=0 - Low purity, i=1 - Medium purity, i=2 - High purity - Float_t param = 0.; - if(i>2 || i<0) - Error("GetParameterTimeGate","Invalid Efficiency-Purity choice %d",i); - else - param = (*fParameters)(3,i) ; - return param; + // Get CpvtoEmcDistance Cut depending on the cluster energy, axis and + // Purity-Efficiency point + + axis.ToLower(); + Float_t p[]={0.,0.,0.}; + for (Int_t i=0; i<3; i++) p[i] = GetParameterCpv2Emc(i,axis); + Float_t sig = p[0] + TMath::Exp(p[1] - p[2]*e); + return sig; } -//_____________________________________________________________________________ -const Float_t AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const -{ - // Get the parameter "i" that is needed to calculate the ellipse - // parameter "param" for the particle "particle" ("photon" or "pi0") +//____________________________________________________________________________ +const Float_t AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param, Float_t e) const +{ + // Calculates the parameter param of the ellipse particle.ToLower(); param. ToLower(); - Int_t offset = -1; - if (particle == "photon") offset=0; - else if (particle == "pi0") offset=5; - else - Error("GetParameterToCalculateEllipse","Wrong particle name: %s (choose from pi0/photon)\n",particle.Data()); - - Int_t p= -1; - Float_t par = 0; - - if (param.Contains("a")) p=4+offset; - else if(param.Contains("b")) p=5+offset; - else if(param.Contains("c")) p=6+offset; - else if(param.Contains("x0"))p=7+offset; - else if(param.Contains("y0"))p=8+offset; + Float_t p[4]={0.,0.,0.,0.}; + Float_t value = 0.0; + for (Int_t i=0; i<4; i++) p[i] = GetParameterToCalculateEllipse(particle,param,i); + if (particle == "photon") { + if (param.Contains("a")) e = TMath::Min((Double_t)e,70.); + else if (param.Contains("b")) e = TMath::Min((Double_t)e,70.); + else if (param.Contains("x0")) e = TMath::Max((Double_t)e,1.1); + } - if (i>4 || i<0) - Error("GetParameterToCalculateEllipse", "No parameter with index", i) ; - else if (p==-1) - Error("GetParameterToCalculateEllipse", "No parameter with name %s", param.Data() ) ; - else - par = (*fParameters)(p,i) ; - - return par; + value = p[0]/TMath::Sqrt(e) + p[1]*e + p[2]*e*e + p[3]; + return value; } //_____________________________________________________________________________ @@ -340,142 +334,58 @@ const Float_t AliPHOSPIDv1::GetParameterPi0Boundary (Int_t i) const } //____________________________________________________________________________ -const Float_t AliPHOSPIDv1::GetCalibratedEnergy(const Float_t e) const -{ -// It calibrates Energy depending on the recpoint energy. -// The energy of the reconstructed cluster is corrected with -// the formula A + B* E + C* E^2, whose parameters where obtained -// through the study of the reconstructed energy distribution of -// monoenergetic photons. - - Float_t p[]={0.,0.,0.}; - for (Int_t i=0; i<3; i++) p[i] = GetParameterCalibration(i); - Float_t enerec = p[0] + p[1]*e + p[2]*e*e; - return enerec ; - -} -//____________________________________________________________________________ -const Float_t AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) const -{ - // Get CpvtoEmcDistance Cut depending on the cluster energy, axis and - // Purity-Efficiency point - - axis.ToLower(); - Float_t p[]={0.,0.,0.}; - for (Int_t i=0; i<3; i++) p[i] = GetParameterCpv2Emc(i,axis); - Float_t sig = p[0] + TMath::Exp(p[1] - p[2]*e); - return sig; -} - -//____________________________________________________________________________ -const Float_t AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param, Float_t e) const -{ - // Calculates the parameter param of the ellipse - - particle.ToLower(); - param. ToLower(); - Float_t p[4]={0.,0.,0.,0.}; - Float_t value = 0.0; - for (Int_t i=0; i<4; i++) p[i] = GetParameterToCalculateEllipse(particle,param,i); - if (particle == "photon") { - if (param.Contains("a")) e = TMath::Min((Double_t)e,70.); - else if (param.Contains("b")) e = TMath::Min((Double_t)e,70.); - else if (param.Contains("x0")) e = TMath::Max((Double_t)e,1.1); - } - - value = p[0]/TMath::Sqrt(e) + p[1]*e + p[2]*e*e + p[3]; - return value; -} - -//____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterCalibration(Int_t i,Float_t param) +const Float_t AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const { - // Set parameter "Calibration" i to a value param + // Get TimeGate parameter depending on Purity-Efficiency i: + // i=0 - Low purity, i=1 - Medium purity, i=2 - High purity + Float_t param = 0.; if(i>2 || i<0) - Error("SetParameterCalibration","Invalid parameter number: %d",i); + Error("GetParameterTimeGate","Invalid Efficiency-Purity choice %d",i); else - (*fParameters)(0,i) = param ; + param = (*fParameters)(3,i) ; + return param; } -//____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterCpv2Emc(Int_t i, TString axis, Float_t cut) -{ - // Set the parameters to calculate Cpv-to-Emc Distance Cut depending on - // Purity-Efficiency point i - - if(i>2 || i<0) - Error("SetParameterCpv2Emc","Invalid parameter number: %d",i); - else { - axis.ToLower(); - if (axis == "x") (*fParameters)(1,i) = cut; - else if (axis == "z") (*fParameters)(2,i) = cut; - else Error("SetParameterCpv2Emc","Invalid axis name: %s",axis.Data()); - } -} //_____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterTimeGate(Int_t i, Float_t gate) -{ - // Set the parameter TimeGate depending on Purity-Efficiency point i - if (i>2 || i<0) - Error("SetParameterTimeGate","Invalid Efficiency-Purity choice %d",i); - else - (*fParameters)(3,i)= gate ; -} -//_____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t par) -{ - // Set the parameter "i" that is needed to calculate the ellipse - // parameter "param" for a particle "particle" - +const Float_t AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const +{ + // Get the parameter "i" that is needed to calculate the ellipse + // parameter "param" for the particle "particle" ("photon" or "pi0") + particle.ToLower(); param. ToLower(); - Int_t p= -1; - Int_t offset=0; - + Int_t offset = -1; if (particle == "photon") offset=0; else if (particle == "pi0") offset=5; else - Error("SetParameterToCalculateEllipse","Wrong particle name: %s (choose from pi0/photon)\n",particle.Data()); + Error("GetParameterToCalculateEllipse","Wrong particle name: %s (choose from pi0/photon)\n",particle.Data()); + + Int_t p= -1; + Float_t par = 0; if (param.Contains("a")) p=4+offset; else if(param.Contains("b")) p=5+offset; else if(param.Contains("c")) p=6+offset; else if(param.Contains("x0"))p=7+offset; else if(param.Contains("y0"))p=8+offset; - if((i>4)||(i<0)) - Error("SetEllipseParameter", "No parameter with index %d", i) ; - else if(p==-1) - Error("SetEllipseParameter", "No parameter with name %s", param.Data() ) ; - else - (*fParameters)(p,i) = par ; -} -//____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterPhotonBoundary(Int_t i,Float_t param) -{ - // Set parameter "Hard photon boundary" i to a value param - if(i>4 || i<0) - Error("SetParameterPhotonBoundary","Invalid parameter number: %d",i); + if (i>4 || i<0) + Error("GetParameterToCalculateEllipse", "No parameter with index", i) ; + else if (p==-1) + Error("GetParameterToCalculateEllipse", "No parameter with name %s", param.Data() ) ; else - (*fParameters)(14,i) = param ; + par = (*fParameters)(p,i) ; + + return par; } -//____________________________________________________________________________ -void AliPHOSPIDv1::SetParameterPi0Boundary(Int_t i,Float_t param) -{ - // Set parameter "Hard pi0 boundary" i to a value param - if(i>1 || i<0) - Error("SetParameterPi0Boundary","Invalid parameter number: %d",i); - else - (*fParameters)(15,i) = param ; -} //____________________________________________________________________________ const Float_t AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * axis)const { // Calculates the distance between the EMC RecPoint and the PPSD RecPoint - const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; + const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; TVector3 vecEmc ; TVector3 vecCpv ; if(cpv){ @@ -581,140 +491,33 @@ const Int_t AliPHOSPIDv1::GetHardPi0Bit(AliPHOSEmcRecPoint * emc) const } //____________________________________________________________________________ -void AliPHOSPIDv1::SetParameters() -{ - // PCA : To do the Principal Components Analysis it is necessary - // the Principal file, which is opened here - fX = new double[7]; // Data for the PCA - fPPhoton = new double[7]; // Eigenvalues of the PCA - fPPi0 = new double[7]; // Eigenvalues of the Pi0 PCA - - // Read photon principals from the photon file - - fFileNamePrincipalPhoton = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root" ; - TFile f( fFileNamePrincipalPhoton.Data(), "read" ) ; - fPrincipalPhoton = dynamic_cast (f.Get("principal")) ; - f.Close() ; - - // Read pi0 principals from the pi0 file - - fFileNamePrincipalPi0 = "$ALICE_ROOT/PHOS/PCA_pi0_40-120.root" ; - TFile fPi0( fFileNamePrincipalPi0.Data(), "read" ) ; - fPrincipalPi0 = dynamic_cast (fPi0.Get("principal")) ; - fPi0.Close() ; - - // Open parameters file and initialization of the Parameters matrix. - // In the File Parameters.dat are all the parameters. These are introduced - // in a matrix of 16x4 - // - // All the parameters defined in this file are, in order of row: - // line 0 : calibration - // lines 1,2 : CPV rectangular cat for X and Z - // line 3 : TOF cut - // lines 4-8 : parameters to calculate photon PCA ellipse - // lines 9-13: parameters to calculate pi0 PCA ellipse - // lines 14-15: parameters to calculate border for high-pt photons and pi0 - - fFileNameParameters = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters.dat"); - fParameters = new TMatrix(16,4) ; - const Int_t maxLeng=255; - char string[maxLeng]; - - // Open a text file with PID parameters - FILE *fd = fopen(fFileNameParameters.Data(),"r"); - if (!fd) - Fatal("SetParameter","File %s with a PID parameters cannot be opened\n", - fFileNameParameters.Data()); - - Int_t i=0; - // Read parameter file line-by-line and skip empty line and comments - while (fgets(string,maxLeng,fd) != NULL) { - if (string[0] == '\n' ) continue; - if (string[0] == '!' ) continue; - sscanf(string, "%f %f %f %f", - &(*fParameters)(i,0), &(*fParameters)(i,1), - &(*fParameters)(i,2), &(*fParameters)(i,3)); - i++; - printf("line %d: %s",i,string); - } - fclose(fd); -} +TVector3 AliPHOSPIDv1::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const +{ + // Calculates the momentum direction: + // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint + // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints + // However because of the poor position resolution of PPSD the direction is always taken as if we were + // in case 1. -//________________________________________________________________________ -void AliPHOSPIDv1::Exec(Option_t * option) -{ - //Steering method + TVector3 dir(0,0,0) ; - if( strcmp(GetName(), "")== 0 ) - Init() ; + TVector3 emcglobalpos ; + TMatrix dummy ; - if(strstr(option,"tim")) - gBenchmark->Start("PHOSPID"); + emc->GetGlobalPosition(emcglobalpos, dummy) ; - if(strstr(option,"print")) { - Print("") ; - return ; - } - - -// gAlice->GetEvent(0) ; - -// //check, if the branch with name of this" already exits? -// if (gAlice->TreeR()) { -// TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ; -// TIter next(lob) ; -// TBranch * branch = 0 ; -// Bool_t phospidfound = kFALSE, pidfound = kFALSE ; - -// TString taskName(GetName()) ; -// taskName.Remove(taskName.Index(Version())-1) ; - -// while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) { -// if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) -// phospidfound = kTRUE ; - -// else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) -// pidfound = kTRUE ; -// } - -// if ( phospidfound || pidfound ) { -// Error("Exec", "RecParticles and/or PIDtMaker branch with name %s already exists", taskName.Data() ) ; -// return ; -// } -// } - -// Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; -// Int_t ievent ; -// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - if(gime->BranchExists("RecParticles") ) - return ; - Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ; - Int_t ievent ; + dir = emcglobalpos ; + dir.SetZ( -dir.Z() ) ; // why ? + dir.SetMag(1.) ; - for(ievent = 0; ievent < nevents; ievent++){ - gime->Event(ievent,"R") ; - - MakeRecParticles() ; - - WriteRecParticles(ievent); - - if(strstr(option,"deb")) - PrintRecParticles(option) ; - - //increment the total number of rec particles per run - fRecParticlesInRun += gime->RecParticles(BranchName())->GetEntriesFast() ; + //account correction to the position of IP + Float_t xo,yo,zo ; //Coordinates of the origin + gAlice->Generator()->GetOrigin(xo,yo,zo) ; + TVector3 origin(xo,yo,zo); + dir = dir - origin ; - } - - if(strstr(option,"tim")){ - gBenchmark->Stop("PHOSPID"); - Info("Exec", "took %f seconds for PID %f seconds per event", - gBenchmark->GetCpuTime("PHOSPID"), - gBenchmark->GetCpuTime("PHOSPID")/nevents) ; - } + return dir ; } //____________________________________________________________________________ @@ -722,7 +525,7 @@ void AliPHOSPIDv1::MakeRecParticles() { // Makes a RecParticle out of a TrackSegment - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; TClonesArray * trackSegments = gime->TrackSegments() ; @@ -847,110 +650,33 @@ void AliPHOSPIDv1::MakeRecParticles() } //____________________________________________________________________________ -void AliPHOSPIDv1::Print() +void AliPHOSPIDv1::Print() const { // Print the parameters used for the particle type identification - TString message ; - message = "\n=============== AliPHOSPID1 ================\n" ; - message += "Making PID\n"; - message += " Pricipal analysis file from 0.5 to 100 %s\n" ; - message += " Name of parameters file %s\n" ; - message += " Matrix of Parameters: 14x4\n" ; - message += " Energy Calibration 1x3 [3 parametres to calibrate energy: A + B* E + C * E^2]\n" ; - message += " RCPV 2x3 rows x and z, columns function cut parameters\n" ; - message += " TOF 1x3 [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]\n" ; - message += " PCA 5x4 [5 ellipse parametres and 4 parametres to calculate them: A/Sqrt(E) + B* E + C * E^2 + D]\n" ; - message += " Pi0 PCA 5x3 [5 ellipse parametres and 3 parametres to calculate them: A + B* E + C * E^2]\n" ; - Info("Print", message.Data(), fFileNamePrincipalPhoton.Data(), fFileNameParameters.Data() ) ; + Info("Print", "=============== AliPHOSPIDv1 ================") ; + printf("Making PID\n") ; + printf(" Pricipal analysis file from 0.5 to 100 %s\n", fFileNamePrincipalPhoton.Data() ) ; + printf(" Name of parameters file %s\n", fFileNameParameters.Data() ) ; + printf(" Matrix of Parameters: 14x4\n") ; + printf(" Energy Calibration 1x3 [3 parametres to calibrate energy: A + B* E + C * E^2]\n") ; + printf(" RCPV 2x3 rows x and z, columns function cut parameters\n") ; + printf(" TOF 1x3 [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]\n") ; + printf(" PCA 5x4 [5 ellipse parametres and 4 parametres to calculate them: A/Sqrt(E) + B* E + C * E^2 + D]\n") ; + Printf(" Pi0 PCA 5x3 [5 ellipse parametres and 3 parametres to calculate them: A + B* E + C * E^2]\n") ; fParameters->Print() ; } -//____________________________________________________________________________ -void AliPHOSPIDv1::WriteRecParticles(Int_t event) -{ - - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; - TClonesArray * recParticles = gime->RecParticles() ; - recParticles->Expand(recParticles->GetEntriesFast() ) ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - char name[10] ; - sprintf(name,"%s%d", "TreeR",event) ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - - if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; - } - - //First rp - Int_t bufferSize = 32000 ; - TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize); - rpBranch->SetTitle(BranchName()); - - - //second, pid - Int_t splitlevel = 0 ; - AliPHOSPIDv1 * pid = this ; - TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel); - pidBranch->SetTitle(BranchName()); - - rpBranch->Fill() ; - pidBranch->Fill() ; - - treeR->AutoSave() ; //Write(0,kOverwrite) ; - if(gAlice->TreeR()!=treeR){ - treeR->Delete(); - } -} -//____________________________________________________________________________ -TVector3 AliPHOSPIDv1::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const -{ - // Calculates the momentum direction: - // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint - // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints - // However because of the poor position resolution of PPSD the direction is always taken as if we were - // in case 1. - - TVector3 dir(0,0,0) ; - - TVector3 emcglobalpos ; - TMatrix dummy ; - - emc->GetGlobalPosition(emcglobalpos, dummy) ; - - - dir = emcglobalpos ; - dir.SetZ( -dir.Z() ) ; // why ? - dir.SetMag(1.) ; - - //account correction to the position of IP - Float_t xo,yo,zo ; //Coordinates of the origin - gAlice->Generator()->GetOrigin(xo,yo,zo) ; - TVector3 origin(xo,yo,zo); - dir = dir - origin ; - - return dir ; -} //____________________________________________________________________________ void AliPHOSPIDv1::PrintRecParticles(Option_t * option) { // Print table of reconstructed particles - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter *gime = AliPHOSGetter::Instance() ; - TClonesArray * recParticles = gime->RecParticles(BranchName()) ; + TClonesArray * recParticles = gime->RecParticles() ; TString message ; message = "\nevent " ; @@ -975,3 +701,179 @@ void AliPHOSPIDv1::PrintRecParticles(Option_t * option) } Info("Print", message.Data() ) ; } + +//____________________________________________________________________________ +void AliPHOSPIDv1::SetParameters() +{ + // PCA : To do the Principal Components Analysis it is necessary + // the Principal file, which is opened here + fX = new double[7]; // Data for the PCA + fPPhoton = new double[7]; // Eigenvalues of the PCA + fPPi0 = new double[7]; // Eigenvalues of the Pi0 PCA + + // Read photon principals from the photon file + + fFileNamePrincipalPhoton = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root" ; + TFile f( fFileNamePrincipalPhoton.Data(), "read" ) ; + fPrincipalPhoton = dynamic_cast (f.Get("principal")) ; + f.Close() ; + + // Read pi0 principals from the pi0 file + + fFileNamePrincipalPi0 = "$ALICE_ROOT/PHOS/PCA_pi0_40-120.root" ; + TFile fPi0( fFileNamePrincipalPi0.Data(), "read" ) ; + fPrincipalPi0 = dynamic_cast (fPi0.Get("principal")) ; + fPi0.Close() ; + + // Open parameters file and initialization of the Parameters matrix. + // In the File Parameters.dat are all the parameters. These are introduced + // in a matrix of 16x4 + // + // All the parameters defined in this file are, in order of row: + // line 0 : calibration + // lines 1,2 : CPV rectangular cat for X and Z + // line 3 : TOF cut + // lines 4-8 : parameters to calculate photon PCA ellipse + // lines 9-13: parameters to calculate pi0 PCA ellipse + // lines 14-15: parameters to calculate border for high-pt photons and pi0 + + fFileNameParameters = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters.dat"); + fParameters = new TMatrix(16,4) ; + const Int_t maxLeng=255; + char string[maxLeng]; + + // Open a text file with PID parameters + FILE *fd = fopen(fFileNameParameters.Data(),"r"); + if (!fd) + Fatal("SetParameter","File %s with a PID parameters cannot be opened\n", + fFileNameParameters.Data()); + + Int_t i=0; + // Read parameter file line-by-line and skip empty line and comments + while (fgets(string,maxLeng,fd) != NULL) { + if (string[0] == '\n' ) continue; + if (string[0] == '!' ) continue; + sscanf(string, "%f %f %f %f", + &(*fParameters)(i,0), &(*fParameters)(i,1), + &(*fParameters)(i,2), &(*fParameters)(i,3)); + i++; + //printf("line %d: %s",i,string); + } + fclose(fd); +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterCalibration(Int_t i,Float_t param) +{ + // Set parameter "Calibration" i to a value param + if(i>2 || i<0) + Error("SetParameterCalibration","Invalid parameter number: %d",i); + else + (*fParameters)(0,i) = param ; +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterCpv2Emc(Int_t i, TString axis, Float_t cut) +{ + // Set the parameters to calculate Cpv-to-Emc Distance Cut depending on + // Purity-Efficiency point i + + if(i>2 || i<0) + Error("SetParameterCpv2Emc","Invalid parameter number: %d",i); + else { + axis.ToLower(); + if (axis == "x") (*fParameters)(1,i) = cut; + else if (axis == "z") (*fParameters)(2,i) = cut; + else Error("SetParameterCpv2Emc","Invalid axis name: %s",axis.Data()); + } +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterPhotonBoundary(Int_t i,Float_t param) +{ + // Set parameter "Hard photon boundary" i to a value param + if(i>4 || i<0) + Error("SetParameterPhotonBoundary","Invalid parameter number: %d",i); + else + (*fParameters)(14,i) = param ; +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterPi0Boundary(Int_t i,Float_t param) +{ + // Set parameter "Hard pi0 boundary" i to a value param + if(i>1 || i<0) + Error("SetParameterPi0Boundary","Invalid parameter number: %d",i); + else + (*fParameters)(15,i) = param ; +} + +//_____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterTimeGate(Int_t i, Float_t gate) +{ + // Set the parameter TimeGate depending on Purity-Efficiency point i + if (i>2 || i<0) + Error("SetParameterTimeGate","Invalid Efficiency-Purity choice %d",i); + else + (*fParameters)(3,i)= gate ; +} + +//_____________________________________________________________________________ +void AliPHOSPIDv1::SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t par) +{ + // Set the parameter "i" that is needed to calculate the ellipse + // parameter "param" for a particle "particle" + + particle.ToLower(); + param. ToLower(); + Int_t p= -1; + Int_t offset=0; + + if (particle == "photon") offset=0; + else if (particle == "pi0") offset=5; + else + Error("SetParameterToCalculateEllipse","Wrong particle name: %s (choose from pi0/photon)\n",particle.Data()); + + if (param.Contains("a")) p=4+offset; + else if(param.Contains("b")) p=5+offset; + else if(param.Contains("c")) p=6+offset; + else if(param.Contains("x0"))p=7+offset; + else if(param.Contains("y0"))p=8+offset; + if((i>4)||(i<0)) + Error("SetEllipseParameter", "No parameter with index %d", i) ; + else if(p==-1) + Error("SetEllipseParameter", "No parameter with name %s", param.Data() ) ; + else + (*fParameters)(p,i) = par ; +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::Unload() +{ + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + gime->PhosLoader()->UnloadRecPoints() ; + gime->PhosLoader()->UnloadTracks() ; + gime->PhosLoader()->UnloadRecParticles() ; +} + +//____________________________________________________________________________ +void AliPHOSPIDv1::WriteRecParticles(Int_t event) +{ + + AliPHOSGetter *gime = AliPHOSGetter::Instance() ; + + TClonesArray * recParticles = gime->RecParticles() ; + recParticles->Expand(recParticles->GetEntriesFast() ) ; + TTree * treeP = gime->TreeP(); + + //First rp + Int_t bufferSize = 32000 ; + TBranch * rpBranch = treeP->Branch("PHOSRP",&recParticles,bufferSize); + rpBranch->SetTitle(BranchName()); + + rpBranch->Fill() ; + + gime->WriteRecParticles("OVERWRITE"); + gime->WritePID("OVERWRITE"); +} + diff --git a/PHOS/AliPHOSPIDv1.h b/PHOS/AliPHOSPIDv1.h index aef74e25986..78c71c775b6 100644 --- a/PHOS/AliPHOSPIDv1.h +++ b/PHOS/AliPHOSPIDv1.h @@ -29,9 +29,9 @@ class AliPHOSPIDv1 : public AliPHOSPID { public: - AliPHOSPIDv1() ; // ctor - AliPHOSPIDv1(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ; - AliPHOSPIDv1(AliPHOSPIDv1 & pid) ; // cpy ctor + AliPHOSPIDv1() ; // ctor + AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ; // cpy ctor virtual ~AliPHOSPIDv1() ; // dtor @@ -67,8 +67,7 @@ public: void SetParameterPhotonBoundary(Int_t i, Float_t param); void SetParameterPi0Boundary (Int_t i, Float_t param); - virtual void Print(Option_t * option) const {} - void Print() ; + void Print() const ; virtual const char * Version() const { return "pid-v1" ; } @@ -90,6 +89,7 @@ private: void PrintRecParticles(Option_t * option) ; virtual void WriteRecParticles(Int_t event) ; void SetParameters() ; //Fills the matrix of parameters + void Unload(); private: @@ -107,7 +107,7 @@ private: TMatrix *fParameters; //! Matrix of identification Parameters - ClassDef( AliPHOSPIDv1,8) // Particle identifier implementation version 1 + ClassDef( AliPHOSPIDv1,9) // Particle identifier implementation version 1 }; diff --git a/PHOS/AliPHOSPpsdRecPoint.cxx b/PHOS/AliPHOSPpsdRecPoint.cxx index bc3ca8205af..153529ad54d 100644 --- a/PHOS/AliPHOSPpsdRecPoint.cxx +++ b/PHOS/AliPHOSPpsdRecPoint.cxx @@ -34,7 +34,7 @@ #include "AliPHOSPpsdRecPoint.h" #include "AliPHOSCpvRecPoint.h" #include "AliRun.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" ClassImp(AliPHOSPpsdRecPoint) @@ -185,7 +185,7 @@ void AliPHOSPpsdRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * dig Float_t x = 0. ; Float_t z = 0. ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ; AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); AliPHOSDigit * digit ; @@ -218,7 +218,7 @@ void AliPHOSPpsdRecPoint::EvalUp(TClonesArray * digits) Int_t relid[4] ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ; AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); diff --git a/PHOS/AliPHOSPpsdRecPoint.h b/PHOS/AliPHOSPpsdRecPoint.h index f2a101bef9f..1c30ae397e5 100644 --- a/PHOS/AliPHOSPpsdRecPoint.h +++ b/PHOS/AliPHOSPpsdRecPoint.h @@ -24,7 +24,7 @@ class AliPHOSPpsdRecPoint : public AliPHOSRecPoint { public: - AliPHOSPpsdRecPoint() ; // ctor + AliPHOSPpsdRecPoint(); // ctor virtual ~AliPHOSPpsdRecPoint(){ // dtor } diff --git a/PHOS/AliPHOSQAAlarm.h b/PHOS/AliPHOSQAAlarm.h index 1ec22ce8de0..395015c2206 100644 --- a/PHOS/AliPHOSQAAlarm.h +++ b/PHOS/AliPHOSQAAlarm.h @@ -19,7 +19,7 @@ // --- Standard library --- -//#include +#include // --- AliRoot header files --- diff --git a/PHOS/AliPHOSQAChecker.cxx b/PHOS/AliPHOSQAChecker.cxx index 7e8ee442075..12021318026 100644 --- a/PHOS/AliPHOSQAChecker.cxx +++ b/PHOS/AliPHOSQAChecker.cxx @@ -23,10 +23,12 @@ // --- ROOT system --- #include "TROOT.h" +#include "TFolder.h" // --- Standard library --- // --- AliRoot header files --- +#include "AliConfig.h" #include "AliPHOSQAChecker.h" #include "AliPHOSQAVirtualCheckable.h" @@ -39,8 +41,18 @@ ClassImp(AliPHOSQAChecker) { // ctor // stores checkers in the PHOS QA TTask folder //Folders/Task/QA - TTask * aliceQA = (TTask*)gROOT->FindObjectAny("Folders/Tasks/QA") ; - TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ; + + TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron + TString phosqatn(AliConfig::Instance()->GetQATaskName()); //skowron + + TTask * aliceQA = (TTask*)topfold->FindObjectAny(phosqatn); //skowron + if (aliceQA == 0x0) + { + Fatal("AliPHOSQAChecker","Can not find QA main task"); + return;//never reached + } + + TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS"); //hard wired name !!!; skowron if (phosQA) // PHOS QA Tasks container exists phosQA->Add(this) ; else // create //Folders/Task/QA/PHOS diff --git a/PHOS/AliPHOSQAChecker.h b/PHOS/AliPHOSQAChecker.h index 6eb101e711d..2df6c2238ec 100644 --- a/PHOS/AliPHOSQAChecker.h +++ b/PHOS/AliPHOSQAChecker.h @@ -18,6 +18,8 @@ class TString ; // --- Standard library --- +#include + // --- AliRoot header files --- #include "AliPHOSQAVirtualCheckable.h" @@ -31,14 +33,14 @@ public: fCheckable = 0; } ; // default ctor (not to be used) AliPHOSQAChecker(const char * name, const char * title) ; // ctor - AliPHOSQAChecker(AliPHOSQAChecker& qac) {Fatal("AliPHOSQAChecker", "Copy CTOR not implemented") ; } + AliPHOSQAChecker(AliPHOSQAChecker& obj) {assert(0==1);} virtual ~AliPHOSQAChecker() ; // dtor void Alarms() { ExecuteTask("A") ; } virtual TString CheckingOperation(){ return TString(""); } // where the checking operation must be implemented void CheckIt() ; void CheckIt(AliPHOSQAVirtualCheckable *ca) ; - void Delete() const { delete this ; } // Hara-Kiri + void Delete() { delete this ; } // Hara-Kiri TList * GetListOfCheckables() const { return fCheckablesList ; } virtual void Exec(Option_t *option) ; virtual void Print() ; @@ -51,7 +53,6 @@ public: friend void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch) ; friend AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) ; - AliPHOSQAChecker & operator = (AliPHOSQAChecker & qac) { return *this ; } private: diff --git a/PHOS/AliPHOSQAFloatCheckable.cxx b/PHOS/AliPHOSQAFloatCheckable.cxx index 8686f28190b..9ad160d8b67 100644 --- a/PHOS/AliPHOSQAFloatCheckable.cxx +++ b/PHOS/AliPHOSQAFloatCheckable.cxx @@ -18,14 +18,13 @@ //_________________________________________________________________________ // Class for a QA checkable that is a Float // -// To be used with AliPHOSChecker -// or any derived class -// //*-- Author : Yves Schutz (SUBATECH) ////////////////////////////////////////////////////////////////////////////// // --- ROOT system --- +#include "TClass.h" + // --- Standard library --- // --- AliRoot header files --- @@ -43,13 +42,6 @@ ClassImp(AliPHOSQAFloatCheckable) fValue = 0. ; } -//____________________________________________________________________________ - AliPHOSQAFloatCheckable::AliPHOSQAFloatCheckable(AliPHOSQAFloatCheckable & fch) : AliPHOSQAVirtualCheckable(fch.GetName()) -{ - //ctor initial value is zero - fType = "F" ; - fValue = fch.fValue ; -} //____________________________________________________________________________ AliPHOSQAFloatCheckable::~AliPHOSQAFloatCheckable() diff --git a/PHOS/AliPHOSQAFloatCheckable.h b/PHOS/AliPHOSQAFloatCheckable.h index 42b48a418d3..3906ea14842 100644 --- a/PHOS/AliPHOSQAFloatCheckable.h +++ b/PHOS/AliPHOSQAFloatCheckable.h @@ -25,7 +25,7 @@ public: AliPHOSQAFloatCheckable(){} // default ctor not to be used AliPHOSQAFloatCheckable(const char * name) ; // ctor - AliPHOSQAFloatCheckable(AliPHOSQAFloatCheckable& obj) ; + AliPHOSQAFloatCheckable(AliPHOSQAFloatCheckable& obj) {assert(0==1);} virtual ~AliPHOSQAFloatCheckable() ; // dtor virtual Float_t GetValue() const { return fValue ; } @@ -33,10 +33,10 @@ public: virtual void Reset() { fValue=0.; fChange=kFALSE ; } void Set(Float_t value) ; void Update(Float_t value) ; - AliPHOSQAFloatCheckable & operator = ( AliPHOSQAFloatCheckable & obj ) {return *this ; } + private: - Float_t fValue ; // the value of the checkable + Float_t fValue ; ClassDef(AliPHOSQAFloatCheckable,1) // description diff --git a/PHOS/AliPHOSQAIntCheckable.cxx b/PHOS/AliPHOSQAIntCheckable.cxx index 7ae97770274..2421fe60818 100644 --- a/PHOS/AliPHOSQAIntCheckable.cxx +++ b/PHOS/AliPHOSQAIntCheckable.cxx @@ -17,14 +17,14 @@ //_________________________________________________________________________ // Class for a QA checkable that is an Int -// To be used with AliPHOSChecker -// or any derived class -// .. +// //*-- Author : Yves Schutz (SUBATECH) ////////////////////////////////////////////////////////////////////////////// // --- ROOT system --- +#include "TClass.h" + // --- Standard library --- // --- AliRoot header files --- @@ -42,13 +42,6 @@ ClassImp(AliPHOSQAIntCheckable) fValue = 0 ; } -//____________________________________________________________________________ - AliPHOSQAIntCheckable::AliPHOSQAIntCheckable(AliPHOSQAIntCheckable & ich) : AliPHOSQAVirtualCheckable(ich.GetName()) -{ - //ctor initial value is zero - fType = "I" ; - fValue = ich.fValue ; -} //____________________________________________________________________________ AliPHOSQAIntCheckable::~AliPHOSQAIntCheckable() diff --git a/PHOS/AliPHOSQAIntCheckable.h b/PHOS/AliPHOSQAIntCheckable.h index e0394384cb6..94a3f556a13 100644 --- a/PHOS/AliPHOSQAIntCheckable.h +++ b/PHOS/AliPHOSQAIntCheckable.h @@ -25,7 +25,7 @@ public: AliPHOSQAIntCheckable(){} // default ctor not to be used AliPHOSQAIntCheckable(const char * name) ; // ctor - AliPHOSQAIntCheckable(AliPHOSQAIntCheckable& obj) ; + AliPHOSQAIntCheckable(AliPHOSQAIntCheckable& obj) {assert(0==1);} virtual ~AliPHOSQAIntCheckable() ; // dtor virtual Float_t GetValue() const { return (Float_t)fValue ; } @@ -33,11 +33,10 @@ public: virtual void Reset() { fValue=0; fChange=kFALSE ; } void Set(Int_t value) ; void Update(Int_t value) ; - AliPHOSQAIntCheckable & operator = ( AliPHOSQAIntCheckable & obj) { return *this ; } - + private: - Int_t fValue ; // the value of the checkable + Int_t fValue ; ClassDef(AliPHOSQAIntCheckable,1) // description diff --git a/PHOS/AliPHOSQAMeanChecker.cxx b/PHOS/AliPHOSQAMeanChecker.cxx index 84199d9d27c..c7aeb06b6b1 100644 --- a/PHOS/AliPHOSQAMeanChecker.cxx +++ b/PHOS/AliPHOSQAMeanChecker.cxx @@ -23,11 +23,15 @@ // --- ROOT system --- +#include "TDatime.h" +#include "TFolder.h" + // --- Standard library --- // --- AliRoot header files --- #include "AliPHOSQAMeanChecker.h" +#include "AliPHOSQAAlarm.h" ClassImp(AliPHOSQAMeanChecker) diff --git a/PHOS/AliPHOSQAMeanChecker.h b/PHOS/AliPHOSQAMeanChecker.h index cfd1d34aa98..5c455b2e3e3 100644 --- a/PHOS/AliPHOSQAMeanChecker.h +++ b/PHOS/AliPHOSQAMeanChecker.h @@ -14,8 +14,12 @@ // --- ROOT system --- +#include "TTask.h" + // --- Standard library --- +#include + // --- AliRoot header files --- #include "AliPHOSQAChecker.h" diff --git a/PHOS/AliPHOSQAObjectCheckable.cxx b/PHOS/AliPHOSQAObjectCheckable.cxx index e61dedc4e36..5fc9aca635a 100644 --- a/PHOS/AliPHOSQAObjectCheckable.cxx +++ b/PHOS/AliPHOSQAObjectCheckable.cxx @@ -16,15 +16,15 @@ /* $Id$ */ //_________________________________________________________________________ -// Class for a QA checkable that is an Object -// To be used with AliPHOSChecker -// or any derived class -//.. +// Class for a QA checkable that is an Int +// //*-- Author : Yves Schutz (SUBATECH) ////////////////////////////////////////////////////////////////////////////// // --- ROOT system --- +#include "TClass.h" + // --- Standard library --- // --- AliRoot header files --- @@ -41,13 +41,6 @@ ClassImp(AliPHOSQAObjectCheckable) fObject = 0 ; } -//____________________________________________________________________________ - AliPHOSQAObjectCheckable::AliPHOSQAObjectCheckable(AliPHOSQAObjectCheckable & cho) : AliPHOSQAVirtualCheckable(cho.GetName()) -{ - fType = "O" ; - fObject = new TObject(cho) ; -} - //____________________________________________________________________________ AliPHOSQAObjectCheckable::~AliPHOSQAObjectCheckable() { diff --git a/PHOS/AliPHOSQAObjectCheckable.h b/PHOS/AliPHOSQAObjectCheckable.h index 8a859bdfd12..a6a07467628 100644 --- a/PHOS/AliPHOSQAObjectCheckable.h +++ b/PHOS/AliPHOSQAObjectCheckable.h @@ -27,7 +27,7 @@ public: fObject = 0; } // default ctor not to be used AliPHOSQAObjectCheckable(const char * name) ; // ctor - AliPHOSQAObjectCheckable(AliPHOSQAObjectCheckable & cho) ; // cpy ctor + AliPHOSQAObjectCheckable(AliPHOSQAObjectCheckable& obj) {assert(0==1);} virtual ~AliPHOSQAObjectCheckable() ; // dtor virtual TObject * GetObject() const { return fObject ; } @@ -37,11 +37,9 @@ public: virtual void Set(TObject * obj) {fObject = obj ;} virtual void Update(TObject * value) {} ; - AliPHOSQAObjectCheckable & operator = (AliPHOSQAObjectCheckable &cho) { return *this ; } - private: - TObject * fObject ; // the object of the checkable object + TObject * fObject ; ClassDef(AliPHOSQAObjectCheckable,1) // description diff --git a/PHOS/AliPHOSQAVirtualCheckable.cxx b/PHOS/AliPHOSQAVirtualCheckable.cxx index 21808b9e8e0..39842551b1b 100644 --- a/PHOS/AliPHOSQAVirtualCheckable.cxx +++ b/PHOS/AliPHOSQAVirtualCheckable.cxx @@ -23,9 +23,11 @@ // --- ROOT system --- +#include "TClass.h" #include "TFolder.h" #include "TROOT.h" -#include "TObjArray.h" +#include "TTree.h" + // --- Standard library --- @@ -34,7 +36,8 @@ #include "AliPHOSQAVirtualCheckable.h" #include "AliPHOSQAChecker.h" #include "AliPHOSQAAlarm.h" - //#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" +#include "AliPHOS.h" ClassImp(AliPHOSQAVirtualCheckable) @@ -45,8 +48,21 @@ ClassImp(AliPHOSQAVirtualCheckable) fType = "" ; fChange = kFALSE ; // create a new folder that will hold the list of alarms - // the folder that contains the alarms for PHOS - fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS"); + // the folder that con tains the alarms for PHOS + + TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron + TString phosqafn(AliConfig::Instance()->GetQAFolderName()); //get name of QAaut folder relative to top; skowron + phosqafn+="/PHOS"; //hard wired string!!! add the detector name to the pathname; skowron + fAlarms = (TFolder*)topfold->FindObjectAny(phosqafn); //get the folder +// 4 lines above substitute the one below +// fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS"); + + if(fAlarms == 0x0) //if there is no folder; skowron + { + Fatal("AliPHOSQAVirtualCheckable","Can not find folder with Alarms for PHOS"); //abort + return;//never reached + } + // make it the owner of the objects that it contains fAlarms->SetOwner() ; // add the alarms list to //Folders/Run/Conditions/QA/PHOS @@ -101,7 +117,7 @@ void AliPHOSQAVirtualCheckable::CheckMe() } //____________________________________________________________________________ -void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) const +void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) { // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS.. // Info("RaiseAlarm", "%s", message) ; diff --git a/PHOS/AliPHOSQAVirtualCheckable.h b/PHOS/AliPHOSQAVirtualCheckable.h index 8f4d4ee30ef..013be75ea19 100644 --- a/PHOS/AliPHOSQAVirtualCheckable.h +++ b/PHOS/AliPHOSQAVirtualCheckable.h @@ -15,9 +15,12 @@ #include "TFolder.h" #include "TNamed.h" +#include "TTask.h" // --- Standard library --- +#include + // --- AliRoot header files --- class AliPHOSQAChecker ; @@ -32,7 +35,7 @@ public: fAlarms = 0; } // default ctor not to be used AliPHOSQAVirtualCheckable(const char * name) ; // ctor - AliPHOSQAVirtualCheckable(AliPHOSQAVirtualCheckable& obj) {Fatal("AliPHOSQAVirtualCheckable", "CPY CTOR not implemented") ;} + AliPHOSQAVirtualCheckable(AliPHOSQAVirtualCheckable& obj) {assert(0==1);} virtual ~AliPHOSQAVirtualCheckable() ; // dtor void AddChecker(AliPHOSQAChecker * ch) ; @@ -43,7 +46,7 @@ public: virtual Float_t GetValue() const = 0 ; TString HasA() const { return fType ; } virtual void Print() const = 0 ; - void RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) const ; + void RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) ; void RemoveChecker(AliPHOSQAChecker *ch) ; virtual void Reset() = 0 ; void ResetAlarms() ; diff --git a/PHOS/AliPHOSRaw2Digits.cxx b/PHOS/AliPHOSRaw2Digits.cxx index a0c547769f5..b7dc922a675 100644 --- a/PHOS/AliPHOSRaw2Digits.cxx +++ b/PHOS/AliPHOSRaw2Digits.cxx @@ -86,7 +86,6 @@ ClassImp(AliPHOSRaw2Digits) fMK4 = 0x80618061 ; fCKW = 0x4640E400 ; fDebug = kFALSE; // Debug flag - fToSplit = kFALSE ; fIsInitialized = kFALSE ; fTarget[0] = 0 ; fTarget[1] = 0 ; @@ -100,20 +99,17 @@ ClassImp(AliPHOSRaw2Digits) fctdb = 0; } //____________________________________________________________________________ - AliPHOSRaw2Digits::AliPHOSRaw2Digits(const char * filename,Bool_t toSplit):TTask("Default","") + AliPHOSRaw2Digits::AliPHOSRaw2Digits(const char * filename):TTask("Default","") { - //this constructor should be normally used. Parameters: imput file and should we produce output in split mode. + //this constructor should be normally used. Parameters: imput file fInName=filename; - fToSplit = toSplit ; TString outname("") ; - if(fToSplit) - outname = "galice.root" ; - else{ - outname =fInName ; - outname.ToLower() ; - outname.ReplaceAll(".fz",".root") ; - outname.ReplaceAll(".gz","") ; - } + + outname =fInName ; + outname.ToLower() ; + outname.ReplaceAll(".fz",".root") ; + outname.ReplaceAll(".gz","") ; + SetTitle(outname) ; fMK1 = 0x0123CDEF ; @@ -138,7 +134,6 @@ ClassImp(AliPHOSRaw2Digits) AliPHOSRaw2Digits::AliPHOSRaw2Digits(AliPHOSRaw2Digits & r2d):TTask(r2d.GetName(), r2d.GetTitle()) { fInName=r2d.fInName ; - fToSplit = r2d.fToSplit ; fMK1 = r2d.fMK1 ; fMK2 = r2d.fMK2 ; @@ -198,73 +193,74 @@ Bool_t AliPHOSRaw2Digits::Init(void){ } //____________________________________________________________________________ Bool_t AliPHOSRaw2Digits::StartRootFiles(void ){ - //Create PHOS geometry, sets magnetic field to zero, - //create Generator - to store target position, - //opens out file, creates TreeE - - //create gAlice if nececcary - if(!gAlice) - new AliRun("gAlice","The ALICE Off-line Simulation Framework") ; - - //Create PHOS - if(!gAlice->GetModule("PHOS")) - new AliPHOSv1("PHOS","GPS2") ; - - //Set Magnetic field - gAlice->SetField(0,2); - - //Set positin of the virtex - AliGenerator * gener = gAlice->Generator() ; - if(!gener) - gener = new AliGenBox(1); - Float_t ox = fTarget[1]; - Float_t oy = fTarget[2]+460.; - Float_t oz = fTarget[0]; - gener->SetOrigin(ox, oy, oz); - - //make directory - Int_t nRootFile = (fEvent+1)/fMaxPerFile ; - if(nRootFile){ - char dname[20]; - sprintf(dname,"%d",nRootFile) ; - if(gSystem->AccessPathName(dname)) //strange return: 0 if exists - if(gSystem->MakeDirectory(dname)!=0) - Fatal("StartRootFiles","Can not make directory %s \n",dname) ; +// //Create PHOS geometry, sets magnetic field to zero, +// //create Generator - to store target position, +// //opens out file, creates TreeE + +// //create gAlice if nececcary +// if(!gAlice) +// new AliRun("gAlice","The ALICE Off-line Simulation Framework") ; + +// //Create PHOS +// if(!gAlice->GetModule("PHOS")) +// new AliPHOSv1("PHOS","GPS2") ; + +// //Set Magnetic field +// gAlice->SetField(0,2); + +// //Set positin of the virtex +// AliGenerator * gener = gAlice->Generator() ; +// if(!gener) +// gener = new AliGenBox(1); +// Float_t ox = fTarget[1]; +// Float_t oy = fTarget[2]+460.; +// Float_t oz = fTarget[0]; +// gener->SetOrigin(ox, oy, oz); + +// //make directory +// Int_t nRootFile = (fEvent+1)/fMaxPerFile ; +// if(nRootFile){ +// char dname[20]; +// sprintf(dname,"%d",nRootFile) ; +// if(gSystem->AccessPathName(dname)) //strange return: 0 if exists +// if(gSystem->MakeDirectory(dname)!=0) +// Fatal("StartRootFiles","Can not make directory %s \n",dname) ; - if(!gSystem->ChangeDirectory(dname)) - Fatal("StartRootFiles","Can not cd to %s\n",dname) ; - } - - // Create the output file - TString outname("") ; - if(strstr(GetTitle(),"root")){ - outname=GetTitle(); - } - else{ - outname = fInName ; - outname.ToLower() ; - outname.ReplaceAll(".fz",".root") ; - } - - fHeaderFile = new TFile(outname,"recreate"); - fHeaderFile->SetCompressionLevel(2); +// if(!gSystem->ChangeDirectory(dname)) +// Fatal("StartRootFiles","Can not cd to %s\n",dname) ; +// } + +// // Create the output file +// TString outname("") ; +// if(strstr(GetTitle(),"root")){ +// outname=GetTitle(); +// } +// else{ +// outname = fInName ; +// outname.ToLower() ; +// outname.ReplaceAll(".fz",".root") ; +// } + +// fHeaderFile = new TFile(outname,"recreate"); +// fHeaderFile->SetCompressionLevel(2); - // Create the Root Trees - gAlice->MakeTree("E") ; +// // Create the Root Trees - //Fill now TreeE - Int_t splitlevel = 0 ; - Int_t bufferSize = 32000 ; - TBranch * headerBranch = gAlice->TreeE()->Branch("AliPHOSBeamTestEvent", - "AliPHOSBeamTestEvent", - &fPHOSHeader,bufferSize,splitlevel); - headerBranch->SetName("AliPHOSBeamTestEvent") ; - - if(fToSplit){ - fDigitsFile = new TFile("PHOS.Digits.root","recreate") ; - fDigitsFile->SetCompressionLevel(2) ; - } - return kTRUE ; +// gime->MakeTree("E") ; + +// //Fill now TreeE +// Int_t splitlevel = 0 ; +// Int_t bufferSize = 32000 ; +// TBranch * headerBranch = gAlice->TreeE()->Branch("AliPHOSBeamTestEvent", +// "AliPHOSBeamTestEvent", +// &fPHOSHeader,bufferSize,splitlevel); +// headerBranch->SetName("AliPHOSBeamTestEvent") ; + +// // if(fToSplit){ +// // fDigitsFile = new TFile("PHOS.Digits.root","recreate") ; +// // fDigitsFile->SetCompressionLevel(2) ; +// // } + return kTRUE ; } //____________________________________________________________________________ Bool_t AliPHOSRaw2Digits::CloseRootFiles(void ){ diff --git a/PHOS/AliPHOSRaw2Digits.h b/PHOS/AliPHOSRaw2Digits.h index 6c20e6a96ab..7b05e69193c 100644 --- a/PHOS/AliPHOSRaw2Digits.h +++ b/PHOS/AliPHOSRaw2Digits.h @@ -27,7 +27,7 @@ class AliPHOSRaw2Digits : public TTask { public: AliPHOSRaw2Digits() ; // ctor - AliPHOSRaw2Digits(const char * inputFileName,Bool_t toSplit = kTRUE) ; + AliPHOSRaw2Digits(const char * inputFileName) ; AliPHOSRaw2Digits(AliPHOSRaw2Digits & r2d) ; // cpy ctor virtual ~AliPHOSRaw2Digits() ; // dtor @@ -71,7 +71,7 @@ private: TString fInName ; // FileName of the input file Bool_t fDebug ; //! Bool_t fIsInitialized ; //! - Bool_t fToSplit ; //To produce splitted output + UInt_t fMK1 ; //!ZEBRA markers UInt_t fMK2 ; //!ZEBRA markers UInt_t fMK3 ; //!ZEBRA markers diff --git a/PHOS/AliPHOSRecCpvManager.cxx b/PHOS/AliPHOSRecCpvManager.cxx index 642567ad1e3..27e615c3b22 100644 --- a/PHOS/AliPHOSRecCpvManager.cxx +++ b/PHOS/AliPHOSRecCpvManager.cxx @@ -118,8 +118,8 @@ void AliPHOSRecCpvManager::AG(Float_t ei, Float_t xi, Float_t yi, Float_t& ai, F //xi and yi are the distances along x and y from reference point // to the pad center. - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - const AliPHOSGeometry* geom = gime->PHOSGeometry(); + AliPHOSGeometry * geom = AliPHOSLoader::GetPHOSGeometry(); + Float_t celZ = geom->GetPadSizeZ(); Float_t celY = geom->GetPadSizePhi(); diff --git a/PHOS/AliPHOSRecParticle.cxx b/PHOS/AliPHOSRecParticle.cxx index 336ad0a0b29..bede29d1c65 100644 --- a/PHOS/AliPHOSRecParticle.cxx +++ b/PHOS/AliPHOSRecParticle.cxx @@ -29,7 +29,6 @@ // --- AliRoot header files --- -#include "AliHeader.h" #include "AliPHOSRecParticle.h" #include "AliPHOSGetter.h" #include "TParticle.h" @@ -71,51 +70,37 @@ ClassImp(AliPHOSRecParticle) //____________________________________________________________________________ const Int_t AliPHOSRecParticle::GetNPrimaries() const -{ - // retrieve the total number of primaries - AliHeader *h = gAlice->GetHeader(); - return h->GetNprimary(); - // return gAlice->GetNtrack(); +{ + return -1; } //____________________________________________________________________________ const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const { - // returns the number of primariies which contribute to the recparticle + Int_t rv = 0 ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); - ((AliPHOSEmcRecPoint*)gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + Int_t emcRPindex = dynamic_cast(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); + dynamic_cast(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ; return rv ; } //____________________________________________________________________________ const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const { - // retrieves the one of primaries which contribute to the recparticle if ( index > GetNPrimariesToRecParticles() ) { if (fDebug) - Warning("GetPrimary", "%d is larger that the number of primaries %d", index, GetNPrimaries()) ; - } else { - Int_t dummy ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); - Int_t *list = static_cast(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy) ; - Int_t primaryindex ; - if(index4999999){ - if (fDebug) - printf("No method to extract primaries from background!\n") ; - return 0 ; - } - return gime->Primary(primaryindex) ; + Warning("GetPrimary", "AliPHOSRecParticle::GetPrimary -> %d is larger that the number of primaries %d", + index, GetNPrimaries()) ; + return 0 ; } + else { + Int_t dummy ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + Int_t emcRPindex = dynamic_cast(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); + Int_t primaryindex = dynamic_cast(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy)[index] ; + return gime->Primary(primaryindex) ; + } return 0 ; } - diff --git a/PHOS/AliPHOSRecParticle.h b/PHOS/AliPHOSRecParticle.h index e2d5cca18a5..6f494f65f94 100644 --- a/PHOS/AliPHOSRecParticle.h +++ b/PHOS/AliPHOSRecParticle.h @@ -41,7 +41,7 @@ class AliPHOSRecParticle : public AliPHOSFastRecParticle { private: Int_t fPHOSTrackSegment ; // pointer to the associated track segment in PHOS - Bool_t fDebug ; // debug flug: silent of =0 + Bool_t fDebug ; ClassDef(AliPHOSRecParticle,2) // Reconstructed Particle }; diff --git a/PHOS/AliPHOSRecPoint.cxx b/PHOS/AliPHOSRecPoint.cxx index f2c64848905..2457ab6d98b 100644 --- a/PHOS/AliPHOSRecPoint.cxx +++ b/PHOS/AliPHOSRecPoint.cxx @@ -23,8 +23,6 @@ // --- ROOT system --- #include "TPad.h" #include "TClonesArray.h" -#include "TGraph.h" -#include "TPaveText.h" // --- Standard library --- @@ -44,8 +42,8 @@ AliPHOSRecPoint::AliPHOSRecPoint() { // ctor - fMaxTrack = 200 ; - fPHOSMod = 0; + fMaxTrack = 0 ; + fPHOSMod = 0 ; } @@ -55,17 +53,7 @@ AliPHOSRecPoint::AliPHOSRecPoint(const char * opt) : AliRecPoint(opt) // ctor fMaxTrack = 200 ; - fPHOSMod = 0; - -} - -//____________________________________________________________________________ -AliPHOSRecPoint::AliPHOSRecPoint(const AliPHOSRecPoint & rp ) : AliRecPoint(rp) -{ - // cpy ctor - - fMaxTrack = rp.fMaxTrack; - fPHOSMod = rp.fPHOSMod; + fPHOSMod = 0; } @@ -98,7 +86,7 @@ Int_t AliPHOSRecPoint::DistancetoPrimitive(Int_t px, Int_t py) } //______________________________________________________________________________ -void AliPHOSRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const +void AliPHOSRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) { // Execute action corresponding to one event // This member function is called when a AliPHOSRecPoint is clicked with the locator @@ -118,8 +106,13 @@ void AliPHOSRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const case kButton1Down:{ AliPHOSDigit * digit ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = const_cast(gime->PHOSGeometry()); + +// Accessing geometry this way is equivalent to getting from gAlice +// to have Detector in Folder one have to load gAlice anyway +// AliPHOSLoader * gime = AliPHOSLoader::GetInstance(); +// AliPHOSGeometry * phosgeom = const_cast(gime->PHOSGeometry()); + + AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); Int_t iDigit; Int_t relid[4] ; @@ -178,11 +171,13 @@ break; } } //____________________________________________________________________________ -void AliPHOSRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) { +void AliPHOSRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) +{ //evaluates (if necessary) all RecPoint data members EvalPrimaries(digits) ; } + //____________________________________________________________________________ void AliPHOSRecPoint::EvalPHOSMod(AliPHOSDigit * digit) { @@ -190,9 +185,8 @@ void AliPHOSRecPoint::EvalPHOSMod(AliPHOSDigit * digit) if( fPHOSMod == 0){ Int_t relid[4] ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - AliPHOSGeometry * phosgeom = const_cast(gime->PHOSGeometry()); + + AliPHOSGeometry * phosgeom = (AliPHOSGetter::Instance())->PHOSGeometry(); phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; fPHOSMod = relid[0]; @@ -203,71 +197,42 @@ void AliPHOSRecPoint::EvalPHOSMod(AliPHOSDigit * digit) void AliPHOSRecPoint::EvalPrimaries(TClonesArray * digits) { // Constructs the list of primary particles (tracks) which have contributed to this RecPoint - // First in the list - primary, made strongest contribution to the center - AliPHOSDigit * digit ; Int_t * tempo = new Int_t[fMaxTrack] ; - //Find digit in center - AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance("IHEP","") ; - if(!geom){ - Error("EvalPrimaries","Can not instantiate PHOS geometry") ; - return ; - } - TVector3 pos ; - TMatrix mat ; - GetGlobalPosition(pos,mat) ; - pos.SetZ(-pos.Z()) ; - Int_t module ; - Double_t x,z ; - geom->ImpactOnEmc(pos.Theta(),pos.Phi(),module,z,x); - Int_t absId ; - geom->RelPosToAbsId(module,x,z,absId) ; - //copy primaries Int_t index ; for ( index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits digit = dynamic_cast(digits->At( fDigitsList[index] )) ; - if(digit->GetId() == absId){ - fMulTrack = digit->GetNprimary() ; - for(Int_t ii = 0 ; ii < fMulTrack ; ii++) - tempo[ii] = digit->GetPrimary(ii+1) ; - } - } - - for ( index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits - digit = dynamic_cast(digits->At( fDigitsList[index] )) ; - if(digit->GetId()!=absId){ //already done - Int_t nprimaries = digit->GetNprimary() ; - if(nprimaries){ - Int_t * newprimaryarray = new Int_t[nprimaries] ; - Int_t ii ; - for ( ii = 0 ; ii < nprimaries ; ii++) - newprimaryarray[ii] = digit->GetPrimary(ii+1) ; - - Int_t jndex ; - for ( jndex = 0 ; jndex < nprimaries ; jndex++ ) { // all primaries in digit - if ( fMulTrack > fMaxTrack ) { - fMulTrack = - 1 ; - Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ; + Int_t nprimaries = digit->GetNprimary() ; + if(nprimaries){ + Int_t * newprimaryarray = new Int_t[nprimaries] ; + Int_t ii ; + for ( ii = 0 ; ii < nprimaries ; ii++) + newprimaryarray[ii] = digit->GetPrimary(ii+1) ; + + Int_t jndex ; + for ( jndex = 0 ; jndex < nprimaries ; jndex++ ) { // all primaries in digit + if ( fMulTrack > fMaxTrack ) { + fMulTrack = - 1 ; + Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ; + break ; + } + Int_t newprimary = newprimaryarray[jndex] ; + Int_t kndex ; + Bool_t already = kFALSE ; + for ( kndex = 0 ; kndex < fMulTrack ; kndex++ ) { //check if not already stored + if ( newprimary == tempo[kndex] ){ + already = kTRUE ; break ; } - Int_t newprimary = newprimaryarray[jndex] ; - Int_t kndex ; - Bool_t already = kFALSE ; - for ( kndex = 0 ; kndex < fMulTrack ; kndex++ ) { //check if not already stored - if ( newprimary == tempo[kndex] ){ - already = kTRUE ; - break ; - } - } // end of check - if ( !already) { // store it - tempo[fMulTrack] = newprimary ; - fMulTrack++ ; - } // store it - } // all primaries in digit - delete [] newprimaryarray ; - } + } // end of check + if ( !already) { // store it + tempo[fMulTrack] = newprimary ; + fMulTrack++ ; + } // store it + } // all primaries in digit + delete [] newprimaryarray ; } } // all digits @@ -284,10 +249,7 @@ void AliPHOSRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const { // returns the position of the cluster in the global reference system of ALICE // and the uncertainty on this position - - - AliPHOSGetter::GetInstance()->PHOSGeometry()->GetGlobal(this, gpos, gmat) ; - + (AliPHOSGetter::Instance())->PHOSGeometry()->GetGlobal(this, gpos, gmat); } @@ -312,3 +274,5 @@ void AliPHOSRecPoint::Paint(Option_t *) gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; gPad->PaintPolyMarker(1,&x,&y,"") ; } +//______________________________________________________________________________ + diff --git a/PHOS/AliPHOSRecPoint.h b/PHOS/AliPHOSRecPoint.h index abf8627ac01..4d47c9fee78 100644 --- a/PHOS/AliPHOSRecPoint.h +++ b/PHOS/AliPHOSRecPoint.h @@ -7,19 +7,20 @@ // A recpoint being equivalent to a cluster in encal terminology //*-- Author: Gines Martinez (SUBATECH) +#include // --- ROOT system --- -//#include "TMarker.h" -//#include "TGraph.h" -//#include "TPaveText.h" +#include "TMarker.h" +#include "TGraph.h" +#include "TPaveText.h" // --- Standard library --- // --- AliRoot header files --- #include "AliRecPoint.h" - class AliPHOSDigit ; +#include "AliPHOSDigit.h" class AliPHOSRecPoint : public AliRecPoint { @@ -29,20 +30,24 @@ class AliPHOSRecPoint : public AliRecPoint { AliPHOSRecPoint() ; // ctor AliPHOSRecPoint(const char * opt) ; // ctor - AliPHOSRecPoint(const AliPHOSRecPoint & rp) ; //cpy ctor + AliPHOSRecPoint(const AliPHOSRecPoint & rp) { + // cpy ctor requested by Coding Convention + // but not yet needed + assert(0==1) ; + } virtual ~AliPHOSRecPoint(){ // dtor } virtual void AddDigit(AliDigitNew &){ // do not use this definition but the one below - Fatal("AddDigit", "use AddDigit(AliPHOSDigit & digit, Float_t Energy)") ; + assert(0==1) ; } virtual void AddDigit(AliPHOSDigit & digit, Float_t Energy) = 0 ; virtual Int_t Compare(const TObject * obj) const = 0 ; virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); virtual void Draw(Option_t * option="") ; - virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)const ; + virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) ; virtual void EvalAll(Float_t logWeight,TClonesArray * digits) ; virtual void EvalPHOSMod(AliPHOSDigit * digit) ; virtual void EvalPrimaries(TClonesArray * digits) ; @@ -60,8 +65,11 @@ class AliPHOSRecPoint : public AliRecPoint { // Print prototype } - AliPHOSRecPoint & operator = (const AliPHOSRecPoint & ) { return *this ; } - + AliPHOSRecPoint & operator = (const AliPHOSRecPoint & ) { + // assignement operator requested by coding convention but not needed + assert(0==1) ; + return *this ; + } protected: Int_t fPHOSMod ; // PHOS Module number in which the RecPoint is found diff --git a/PHOS/AliPHOSReconstructioner.cxx b/PHOS/AliPHOSReconstructioner.cxx index 02f1b146865..86855cd6084 100644 --- a/PHOS/AliPHOSReconstructioner.cxx +++ b/PHOS/AliPHOSReconstructioner.cxx @@ -59,16 +59,25 @@ // --- ROOT system --- +#include "TClonesArray.h" +#include "TROOT.h" +#include "TTree.h" +#include "TFile.h" + // --- Standard library --- // --- AliRoot header files --- +#include "AliRun.h" +#include "AliRunLoader.h" #include "AliPHOSReconstructioner.h" #include "AliPHOSClusterizerv1.h" #include "AliPHOSDigitizer.h" #include "AliPHOSSDigitizer.h" #include "AliPHOSTrackSegmentMakerv1.h" #include "AliPHOSPIDv1.h" - +#include "AliPHOSFastRecParticle.h" +#include "AliPHOSCpvRecPoint.h" +#include "AliPHOSLoader.h" ClassImp(AliPHOSReconstructioner) @@ -76,51 +85,85 @@ ClassImp(AliPHOSReconstructioner) AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","") { // ctor - fToSplit = kFALSE ; fDigitizer = 0 ; fClusterizer = 0 ; fTSMaker = 0 ; fPID = 0 ; fSDigitizer = 0 ; - fHeaderFileName = "galice.root" ; fIsInitialized = kFALSE ; } //____________________________________________________________________________ -AliPHOSReconstructioner::AliPHOSReconstructioner(const char* headerFile,const char * branchName,Bool_t toSplit): -TTask("AliPHOSReconstructioner","") +AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName): +TTask("AliPHOSReconstructioner",evFoldName) { // ctor + AliRunLoader* rl = AliRunLoader::GetRunLoader(evFoldName); + if (rl == 0x0) + { + Fatal("AliPHOSReconstructioner","Can not get Run Loader from folder %s.",evFoldName); + } + if (rl->GetAliRun() == 0x0) + { + delete gAlice; + gAlice = 0x0; + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + } + + AliPHOSLoader* gime = dynamic_cast(rl->GetLoader("PHOSLoader")); + if (gime == 0x0) + { + Error("AliPHOSReconstructioner","Can not get PHOS Loader"); + return; + } + + TString galicefn = rl->GetFileName(); + TString method("AliPHOSReconstructioner::AliPHOSReconstructioner("); + method = (((method + evFoldName)+",")+branchName)+"): "; - fHeaderFileName = headerFile ; - fToSplit = toSplit ; fSDigitsBranch= branchName; - fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),toSplit) ; - Add(fSDigitizer) ; - - fDigitsBranch=branchName ; - fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),toSplit) ; + + //P.Skowronski remark + // Tasks has default fixed names + // other tasks can be added, even runtime + // with arbitrary name. See AliDataLoader:: + cout<<"\n\n\n"; + cout<PostSDigitizer(fSDigitizer); + + fDigitsBranch=branchName ; + cout<<"\n\n\n"; + cout<PostDigitizer(fDigitizer); fRecPointBranch=branchName ; - fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),toSplit) ; - Add(fClusterizer) ; + cout<<"\n\n\n"; + cout<PostReconstructioner(fClusterizer); - fTSBranch=branchName ; - fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),toSplit) ; + fTSMaker = new AliPHOSTrackSegmentMakerv1(galicefn,GetTitle()); Add(fTSMaker) ; - + gime->PostTracker(fTSMaker); + fRecPartBranch=branchName ; - fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),toSplit) ; - Add(fPID) ; + cout<<"\n\n\n"; + cout<GetEvent(0) ; - -// if(fSDigitizer->IsActive()&& gAlice->TreeS()){ //Will produce SDigits -// TBranch * sdigitsBranch = 0; -// TBranch * sdigitizerBranch = 0; - -// TObjArray * branches = gAlice->TreeS()->GetListOfBranches() ; -// Int_t ibranch; -// Bool_t phosNotFound = kTRUE ; -// Bool_t sdigitizerNotFound = kTRUE ; - -// for(ibranch = 0;ibranch GetEntries();ibranch++){ -// if(phosNotFound){ -// sdigitsBranch=(TBranch *) branches->At(ibranch) ; -// if(( strcmp("PHOS",sdigitsBranch->GetName())==0 ) && -// (fSDigitsBranch.CompareTo(sdigitsBranch->GetTitle())== 0 )) -// phosNotFound = kFALSE ; -// } -// if(sdigitizerNotFound){ -// sdigitizerBranch = (TBranch *) branches->At(ibranch) ; -// if(( strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0) && -// (fSDigitsBranch.CompareTo(sdigitizerBranch->GetTitle())== 0 ) ) -// sdigitizerNotFound = kFALSE ; -// } -// } - -// if(!(sdigitizerNotFound && phosNotFound)){ -// message = " Branches PHOS or AliPHOSSDigitizer with title %s\n" ; -// message += " already exist in TreeS. ROOT does not allow updating/overwriting.\n" ; -// message += " Specify another title for branches or use StartFrom() method\n" ; -// Error("Exec", message.Data(), fSDigitsBranch.Data() ) ; -// //mark all tasks as inactive -// TIter next(fTasks); -// TTask *task; -// while((task=(TTask*)next())) -// task->SetActive(kFALSE) ; - -// return ; -// } -// } - -// if(fDigitizer->IsActive() && gAlice->TreeD()){ //Will produce Digits -// TBranch * digitsBranch = 0; -// TBranch * digitizerBranch = 0; - -// TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ; -// Int_t ibranch; -// Bool_t phosNotFound = kTRUE ; -// Bool_t digitizerNotFound = kTRUE ; - -// for(ibranch = 0;ibranch GetEntries();ibranch++){ -// if(phosNotFound){ -// digitsBranch=(TBranch *) branches->At(ibranch) ; -// if(( strcmp("PHOS",digitsBranch->GetName())==0 ) && -// (fDigitsBranch.CompareTo(digitsBranch->GetTitle())== 0 )) -// phosNotFound = kFALSE ; -// } -// if(digitizerNotFound){ -// digitizerBranch = (TBranch *) branches->At(ibranch) ; -// if(( strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) && -// (fDigitsBranch.CompareTo(digitizerBranch->GetTitle())== 0 ) ) -// digitizerNotFound = kFALSE ; -// } -// } - -// if(!(digitizerNotFound && phosNotFound)){ -// message = " Branches PHOS or AliPHOSDigitizer with title %s\n" ; -// message += " already exist in TreeD. ROOT does not allow updating/overwriting.\n" ; -// message += " Specify another title for branches or use StartFrom() method" ; -// Error("Exec", message>Data(), fDigitsBranch.Data() ) ; -// //mark all tasks as inactive -// TIter next(fTasks); -// TTask *task; -// while((task=(TTask*)next())) -// task->SetActive(kFALSE) ; - -// return ; -// } -// } - -// if(fClusterizer->IsActive() && gAlice->TreeR()){ //Will produce RecPoints -// TBranch * emcBranch = 0; -// TBranch * cpvBranch = 0; -// TBranch * clusterizerBranch = 0; - -// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ; -// Int_t ibranch; -// Bool_t emcNotFound = kTRUE ; -// Bool_t cpvNotFound = kTRUE ; -// Bool_t clusterizerNotFound = kTRUE ; - -// for(ibranch = 0;ibranch GetEntries();ibranch++){ - -// if(emcNotFound){ -// emcBranch=(TBranch *) branches->At(ibranch) ; -// if(fRecPointBranch.CompareTo(emcBranch->GetTitle())==0 ) -// if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0) -// emcNotFound = kFALSE ; -// } -// if(cpvNotFound){ -// cpvBranch=(TBranch *) branches->At(ibranch) ; -// if(fRecPointBranch.CompareTo(cpvBranch->GetTitle())==0 ) -// if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0) -// cpvNotFound = kFALSE ; -// } -// if(clusterizerNotFound){ -// clusterizerBranch = (TBranch *) branches->At(ibranch) ; -// if( fRecPointBranch.CompareTo(clusterizerBranch->GetTitle()) == 0) -// if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0) -// clusterizerNotFound = kFALSE ; -// } -// } - -// if(!(clusterizerNotFound && emcNotFound && cpvNotFound)){ -// message = " Branches PHOSEmcRP, PHOSCpvRP or AliPHOSClusterizer with title %s\n" ; -// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ; -// message += " Specify another title for branches or use StartFrom() method\n" ; -// Error("Exec", message.Data(),fRecPointBranch.Data() ) ; -// //mark all tasks as inactive -// TIter next(fTasks); -// TTask *task; -// while((task=(TTask*)next())) -// task->SetActive(kFALSE) ; -// return ; -// } -// } - -// if(fTSMaker->IsActive() && gAlice->TreeR()){ //Produce TrackSegments -// TBranch * tsMakerBranch = 0; -// TBranch * tsBranch = 0; - -// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ; -// Int_t ibranch; -// Bool_t tsMakerNotFound = kTRUE ; -// Bool_t tsNotFound = kTRUE ; - -// for(ibranch = 0;(ibranch GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){ -// if(tsMakerNotFound){ -// tsMakerBranch=(TBranch *) branches->At(ibranch) ; -// if( fTSBranch.CompareTo(tsMakerBranch->GetTitle())==0 ) -// if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0) -// tsMakerNotFound = kFALSE ; -// } -// if(tsNotFound){ -// tsBranch=(TBranch *) branches->At(ibranch) ; -// if( fTSBranch.CompareTo(tsBranch->GetTitle())==0 ) -// if( strcmp(tsBranch->GetName(),"PHOSTS") == 0) -// tsNotFound = kFALSE ; -// } -// } - -// if(!(tsMakerNotFound &&tsNotFound) ){ -// message = " Branches PHOSTS or AliPHOSTrackSegmentMaker with title %s\n" ; -// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ; -// message += " Specify another title for branches or use StartFrom() method\n" ; -// Error("Exec", message.Data(),fTSBranch.Data() ) ; -// //mark all tasks as inactive -// TIter next(fTasks); -// TTask *task; -// while((task=(TTask*)next())) -// task->SetActive(kFALSE) ; -// return ; - -// } - -// } - -// if(fPID->IsActive() && gAlice->TreeR()){ //Produce RecParticles -// TBranch * pidBranch = 0; -// TBranch * rpBranch = 0; - -// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ; -// Int_t ibranch; -// Bool_t pidNotFound = kTRUE ; -// Bool_t rpNotFound = kTRUE ; - -// for(ibranch = 0;(ibranch GetEntries()) && pidNotFound && rpNotFound ;ibranch++){ -// if(pidNotFound){ -// pidBranch=(TBranch *) branches->At(ibranch) ; -// if( (strcmp(fRecPartBranch,pidBranch->GetTitle())==0 ) && -// (strcmp(pidBranch->GetName(),"AliPHOSPID") == 0) ) -// pidNotFound = kFALSE ; -// } -// if(rpNotFound){ -// rpBranch=(TBranch *) branches->At(ibranch) ; -// if( (strcmp(fRecPartBranch,rpBranch->GetTitle())==0 ) && -// (strcmp(rpBranch->GetName(),"PHOSRP") == 0) ) -// rpNotFound = kFALSE ; -// } -// } - -// if(!pidNotFound || !rpNotFound ){ -// message = " Branches PHOSRP or AliPHOSPID with title %s\n" ; -// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ; -// message += " Specify another title for branches.\n" ; -// Error("Exec", message.Data(), fRecPartBranch.Data() ) ; -// //mark all tasks as inactive -// TIter next(fTasks); -// TTask *task; -// while((task=(TTask*)next())) -// task->SetActive(kFALSE) ; -// return ; -// } - -// } } //____________________________________________________________________________ void AliPHOSReconstructioner::Init() @@ -346,179 +182,35 @@ void AliPHOSReconstructioner::Exec(Option_t *option) // Initialisation fSDigitsBranch="Default" ; - fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),fToSplit) ; + fSDigitizer = new AliPHOSSDigitizer(GetTitle(),fSDigitsBranch.Data()) ; Add(fSDigitizer) ; fDigitsBranch="Default" ; - fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),fToSplit) ; + fDigitizer = new AliPHOSDigitizer(GetTitle(),fDigitsBranch.Data()); Add(fDigitizer) ; fRecPointBranch="Default" ; - fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),fToSplit) ; + fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data()); Add(fClusterizer) ; fTSBranch="Default" ; - fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),fToSplit) ; + fTSMaker = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data()); Add(fTSMaker) ; - fRecPartBranch="Default" ; - fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),fToSplit) ; + fRecPartBranch="Default"; + fPID = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ; Add(fPID) ; fIsInitialized = kTRUE ; + } } //____________________________________________________________________________ AliPHOSReconstructioner::~AliPHOSReconstructioner() { // Delete data members if any - -// if(fSDigitizer) -// delete fSDigitizer ; - -// if(fDigitizer) -// delete fDigitizer ; - -// if(fClusterizer) -// delete fClusterizer ; - -// if(fTSMaker) -// delete fTSMaker ; - -// if(fPID) -// delete fPID ; - -// TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data()) ; - -// if(file != 0) { -// file->Close(); -// delete file; -// printf("File %s is closed\n",fHeaderFileName.Data()); -// } - } -// //____________________________________________________________________________ -// void AliPHOSReconstructioner::SetBranchTitle(const char* branch, const char * title) -// { -// //Diverge correcpoinding branch to the file "title" - -// if(strcmp(branch,"SDigits") == 0){ -// fSDigitizer->SetSDigitsBranch(title) ; -// fDigitizer->SetSDigitsBranch(title) ; -// fSDigitsBranch = title ; -// return ; -// } - -// if(strcmp(branch,"Digits") == 0){ -// fDigitizer->SetName(title) ; -// fClusterizer->SetName(title) ; -// fDigitsBranch = title ; -// return ; -// } - -// if(strcmp(branch,"RecPoints") == 0){ -// fClusterizer->SetRecPointsBranch(title) ; -// fTSMaker->SetRecPointsBranch(title) ; -// fRecPointBranch = title ; -// return ; -// } - -// if(strcmp(branch,"TrackSegments") == 0){ -// fTSMaker->SetTrackSegmentsBranch(title) ; -// fPID->SetTrackSegmentsBranch(title) ; -// fTSBranch = title ; -// return ; -// } - -// if(strcmp(branch,"RecParticles") == 0){ -// fPID->SetRecParticlesBranch(title) ; -// fRecPartBranch = title ; -// return ; -// } - -// -// TString message ; -// message = "There is no branch %s !\n" ; -// message += "Available branches `SDigits', `Digits', `RecPoints', `TrackSegments' and `RecParticles'\n" ; -// Warning("SetBranchTitle", message.Data(), branch ) ; -// } -// //____________________________________________________________________________ -// void AliPHOSReconstructioner::StartFrom(char * module,char* title) -// { -// // in the next pass of reconstruction (call ExecuteTask()) reconstruction will -// // start from the module "module", and in the case of non zero title all -// // pruduced branches will have title "title". The following "modules" are recognized -// // "SD" - AliPHOSSDigitizer, -// // "D" - AliPHOSDigitizer -// // "C" - AliPHOSClusterizer -// // "TS" - AliPHOSTrackSegmentMaker -// // "RP" - AliPHOSPID - -// if(!fIsInitialized) -// Init() ; - -// char * moduleName = new char[30]; -// if(strstr(module,"SD")) -// sprintf(moduleName,"AliPHOSSDigitizer") ; -// else -// if(strstr(module,"D") ) -// sprintf(moduleName,"AliPHOSDigitizer") ; -// else -// if(strstr(module,"C") || strstr(module,"RecPoint") ) -// sprintf(moduleName,"AliPHOSClusterizer") ; -// else -// if(strstr(module,"TS") || strstr(module,"Track") ) -// sprintf(moduleName,"AliPHOSTrackSegmentMaker") ; -// else -// if(strstr(module,"PID") || strstr(module,"Particle") || strstr(module,"RP") ) -// sprintf(moduleName,"AliPHOSPID") ; -// else{ -// Warning("StartFrom", "Do not know such a module / Rec Object ") ; -// return ; -// } - -// TIter next(fTasks); -// TTask *task; -// Bool_t active = kFALSE ; -// while((task=(TTask*)next())){ -// if (strcmp(moduleName,task->GetName())==0) -// active = kTRUE; -// task->SetActive(active) ; -// if(active && title){ // set title to branches -// switch(strlen(task->GetName()) ) { -// case 17: // "AliPHOSSDigitizer" -// fSDigitizer->SetSDigitsBranch(title) ; -// fDigitizer->SetSDigitsBranch(title) ; -// fSDigitsBranch = title ; -// break ; -// case 16: //"AliPHOSDigitizer" -// fDigitizer->SetName(title) ; -// fClusterizer->SetName(title) ; -// fDigitsBranch = title ; -// break ; -// case 18: //"AliPHOSClusterizer" -// fClusterizer->SetRecPointsBranch(title) ; -// fTSMaker->SetRecPointsBranch(title) ; -// fRecPointBranch = title ; -// break ; -// case 24: //"AliPHOSTrackSegmentMaker" -// fTSMaker->SetTrackSegmentsBranch(title) ; -// fPID->SetTrackSegmentsBranch(title) ; -// fTSBranch = title ; -// break ; -// case 10: // "AliPHOSPID" -// fPID->SetRecParticlesBranch(title) ; -// fRecPartBranch = title ; -// break ; -// } - -// } -// } - -// delete [] moduleName; -// } -//____________________________________________________________________________ void AliPHOSReconstructioner::Print(Option_t * option)const { // Print reconstructioner data @@ -547,7 +239,7 @@ void AliPHOSReconstructioner::Print(Option_t * option)const { message += " (+) %s to branch %s\n" ; } Info("Print", message.Data(), - fHeaderFileName.Data(), + GetTitle(), fSDigitizer->GetName(), fSDigitsBranch.Data(), fDigitizer->GetName(), fDigitsBranch.Data() , fClusterizer->GetName(), fRecPointBranch.Data(), diff --git a/PHOS/AliPHOSReconstructioner.h b/PHOS/AliPHOSReconstructioner.h index 7fbf5f38852..30951b2627b 100644 --- a/PHOS/AliPHOSReconstructioner.h +++ b/PHOS/AliPHOSReconstructioner.h @@ -11,7 +11,7 @@ //*-- Author: Gines Martinez & Yves Schutz (SUBATECH) //*-- Dmitri Peressounko (SUBATECH & Kurchatov Institute) - //#include +#include // --- ROOT system --- @@ -31,7 +31,7 @@ class AliPHOSReconstructioner : public TTask { public: AliPHOSReconstructioner() ; //ctor - AliPHOSReconstructioner(const char * headreFile, const char * branchName = "Default",Bool_t toSplit = kFALSE) ; + AliPHOSReconstructioner(const char * headreFile, const char * branchName = "Default"); AliPHOSReconstructioner(const AliPHOSReconstructioner & rec) { // cpy ctor: // requested by the Coding Convention @@ -69,8 +69,6 @@ private: private: - Bool_t fToSplit ; // To tell if we are in split mode or not - TString fHeaderFileName ; // File with headers and gAlice TString fDigitsBranch ; // Title of digits branch TString fRecPointBranch ; // Title of RecPoints branch TString fTSBranch ; // Title of TrackSegments branch diff --git a/PHOS/AliPHOSSDigitizer.cxx b/PHOS/AliPHOSSDigitizer.cxx index 79caf80d700..a5c2d580abc 100644 --- a/PHOS/AliPHOSSDigitizer.cxx +++ b/PHOS/AliPHOSSDigitizer.cxx @@ -68,7 +68,7 @@ ClassImp(AliPHOSSDigitizer) //____________________________________________________________________________ - AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","") + AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","") { // ctor InitParameters() ; @@ -76,12 +76,13 @@ ClassImp(AliPHOSSDigitizer) } //____________________________________________________________________________ -AliPHOSSDigitizer::AliPHOSSDigitizer(const char * headerFile, const char * sDigitsTitle, const Bool_t toSplit): -TTask(sDigitsTitle, headerFile) +AliPHOSSDigitizer::AliPHOSSDigitizer(const char * alirunFileName, const char * eventFolderName): + TTask("PHOS"+AliConfig::fgkSDigitizerTaskName, alirunFileName), + fEventFolderName(eventFolderName) { + // ctor InitParameters() ; - fToSplit = toSplit ; Init(); fDefaultInit = kFALSE ; } @@ -94,119 +95,85 @@ AliPHOSSDigitizer::AliPHOSSDigitizer(const AliPHOSSDigitizer & sd) { fB = sd.fB ; fPrimThreshold = sd.fPrimThreshold ; fSDigitsInRun = sd.fSDigitsInRun ; - fSplitFile = new TFile( (sd.fSplitFile)->GetName(), "new") ; - fToSplit = sd.fToSplit ; + SetName(sd.GetName()) ; + SetTitle(sd.GetTitle()) ; + fEventFolderName = sd.fEventFolderName; } -//____________________________________________________________________________ -AliPHOSSDigitizer::~AliPHOSSDigitizer() -{ - // dtor - - fSplitFile = 0 ; -} //____________________________________________________________________________ void AliPHOSSDigitizer::Init() { - // Initialization: open root-file, allocate arrays for hits and sdigits, - // attach task SDigitizer to the list of PHOS tasks - // - // Initialization can not be done in the default constructor - //============================================================= YS - // The initialisation is now done by AliPHOSGetter + // Uses the getter to access the required files - if( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName(),fToSplit) ; + fInit = kTRUE ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()); if ( gime == 0 ) { - Error("Init" ,"Could not obtain the Getter object !") ; + Fatal("Init" ,"Could not obtain the Getter object for file %s and event %s !", GetTitle(), fEventFolderName.Data()) ; return ; } - gime->PostSDigits( GetName(), GetTitle() ) ; - - fSplitFile = 0 ; - if(fToSplit){ - // construct the name of the file as /path/PHOS.SDigits.root - // First - extract full path if necessary - TString sDigitsFileName(GetTitle()) ; - Ssiz_t islash = sDigitsFileName.Last('/') ; - if(islash(gROOT->GetFile(sDigitsFileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(sDigitsFileName.Data(),"update") ; + TString opt("SDigits") ; + if(gime->VersionExists(opt) ) { + Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ; + fInit = kFALSE ; } - TString sdname(GetName() ); - sdname.Append(":") ; - sdname.Append(GetTitle() ) ; - SetName(sdname) ; - gime->PostSDigitizer(this) ; + gime->PostSDigitizer(this); + gime->PhosLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + } //____________________________________________________________________________ void AliPHOSSDigitizer::InitParameters() { - // initializes the parameters for difitization + // initializes the parameters for digitization fA = 0; fB = 10000000.; fPrimThreshold = 0.01 ; fSDigitsInRun = 0 ; - fSplitFile = 0 ; - fToSplit = kFALSE ; } //____________________________________________________________________________ void AliPHOSSDigitizer::Exec(Option_t *option) { // Collects all hits in the same active volume into digit - - if( strcmp(GetName(), "") == 0 ) - Init() ; if (strstr(option, "print") ) { - Print("") ; + Print() ; return ; } if(strstr(option,"tim")) gBenchmark->Start("PHOSSDigitizer"); - //Check, if this branch already exits - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - if(gime->BranchExists("SDigits") ) - return; - - TString sdname(GetName()) ; - sdname.Remove(sdname.Index(GetTitle())-1) ; - + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + //switch off reloading of this task while getting event + if (!fInit) { // to prevent overwrite existing file + Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ; + return ; + } + + Int_t nevents = gime->MaxEvent() ; Int_t ievent ; for(ievent = 0; ievent < nevents; ievent++){ + gime->Event(ievent,"H") ; - const TClonesArray * hits = gime->Hits() ; - TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; + + TTree * treeS = gime->TreeS(); + TClonesArray * hits = gime->Hits() ; + TClonesArray * sdigits = gime->SDigits() ; sdigits->Clear(); Int_t nSdigits = 0 ; - //Now make SDigits from hits, for PHOS it is the same, so just copy - Int_t nPrim = static_cast((gAlice->TreeH())->GetEntries()) ; + Int_t nPrim = static_cast((gime->TreeH())->GetEntries()) ; // Attention nPrim is the number of primaries tracked by Geant // and this number could be different to the number of Primaries in TreeK; Int_t iprim ; + for (iprim = 0 ; iprim < nPrim ; iprim ++) { //=========== Get the PHOS branch from Hits Tree for the Primary iprim gime->Track(iprim) ; @@ -224,15 +191,16 @@ void AliPHOSSDigitizer::Exec(Option_t *option) nSdigits++ ; } - + } // loop over iprim - + sdigits->Sort() ; - + nSdigits = sdigits->GetEntriesFast() ; + fSDigitsInRun += nSdigits ; sdigits->Expand(nSdigits) ; - + Int_t i ; for (i = 0 ; i < nSdigits ; i++) { AliPHOSDigit * digit = dynamic_cast(sdigits->At(i)) ; @@ -240,34 +208,29 @@ void AliPHOSSDigitizer::Exec(Option_t *option) } //Now write SDigits - - if((gAlice->TreeS() == 0)|| (fSplitFile)) - gAlice->MakeTree("S", fSplitFile); - - if(fSplitFile) - fSplitFile->cd() ; + //First list of sdigits + Int_t bufferSize = 32000 ; - TBranch * sdigitsBranch = gAlice->TreeS()->Branch("PHOS",&sdigits,bufferSize); - sdigitsBranch->SetTitle(sdname); - - //Next - SDigitizer - Int_t splitlevel = 0 ; - AliPHOSSDigitizer * sd = this ; - TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliPHOSSDigitizer","AliPHOSSDigitizer", - &sd,bufferSize,splitlevel); - sdigitizerBranch->SetTitle(sdname); - + TBranch * sdigitsBranch = treeS->Branch("PHOS",&sdigits,bufferSize); + sdigitsBranch->Fill() ; - sdigitizerBranch->Fill() ; - gAlice->TreeS()->AutoSave() ; - + gime->WriteSDigits("OVERWRITE"); + + //Next - SDigitizer + + gime->WriteSDigitizer("OVERWRITE"); + if(strstr(option,"deb")) PrintSDigits(option) ; } + Unload(); + + gime->PhosLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); + if(strstr(option,"tim")){ gBenchmark->Stop("PHOSSDigitizer"); Info("Exec"," took %f seconds for SDigitizing %f seconds per event", @@ -276,46 +239,15 @@ void AliPHOSSDigitizer::Exec(Option_t *option) } //__________________________________________________________________ -void AliPHOSSDigitizer::SetSDigitsBranch(const char * title ) -{ - // Setting title to branch SDigits - - TString stitle(title) ; - - // check if branch with title already exists - TBranch * sdigitsBranch = - static_cast(gAlice->TreeS()->GetListOfBranches()->FindObject("PHOS")) ; - TBranch * sdigitizerBranch = - static_cast(gAlice->TreeS()->GetListOfBranches()->FindObject("AliPHOSSDigitizer")) ; - const char * sdigitsTitle = sdigitsBranch ->GetTitle() ; - const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ; - if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){ - Error("SetSDigitsBranch", "Cannot overwrite existing branch with title %s", title) ; - return ; - } - - Info("SetSDigitsBranch", "-> Changing SDigits file from %s to %s", GetName(), title) ; - - SetName(title) ; - - // Post to the WhiteBoard - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - gime->PostSDigits( title, GetTitle()) ; -} - - -//__________________________________________________________________ -void AliPHOSSDigitizer::Print(Option_t* option)const +void AliPHOSSDigitizer::Print()const { // Prints parameters of SDigitizer - TString message ; - message = "\n------------------- %s -------------\n" ; - message += " Writing SDigits to branch with title %s\n" ; - message += " with digitization parameters A = %f\n" ; - message += " B = %f\n" ; - message += " Threshold for Primary assignment= %f\n" ; - message += "---------------------------------------------------\n" ; - Info("Print", message.Data(), GetName(), GetName(), fA, fB, fPrimThreshold ) ; + Info("Print", "\n------------------- %s -------------", GetName() ) ; + printf(" Writing SDigits to branch with title %s\n", fEventFolderName.Data()) ; + printf(" with digitization parameters A = %f\n", fA) ; + printf(" B = %f\n", fB) ; + printf(" Threshold for Primary assignment= %f\n", fPrimThreshold) ; + printf("---------------------------------------------------\n") ; } @@ -337,10 +269,8 @@ void AliPHOSSDigitizer::PrintSDigits(Option_t * option) // Prints list of digits produced in the current pass of AliPHOSDigitizer - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - TString sdname(GetName()) ; - sdname.Remove(sdname.Index(GetTitle())-1) ; - const TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + const TClonesArray * sdigits = gime->SDigits() ; TString message ; message = "\nAliPHOSSDigitiser: event " ; @@ -396,13 +326,15 @@ void AliPHOSSDigitizer::PrintSDigits(Option_t * option) } } } - delete tempo ; + delete []tempo ; Info("PrintSDigits", message.Data() ) ; } //____________________________________________________________________________ -void AliPHOSSDigitizer::UseHitsFrom(const char * filename) +void AliPHOSSDigitizer::Unload() const { - SetTitle(filename) ; - Init() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + AliPHOSLoader * loader = gime->PhosLoader() ; + loader->UnloadHits() ; + loader->UnloadSDigits() ; } diff --git a/PHOS/AliPHOSSDigitizer.h b/PHOS/AliPHOSSDigitizer.h index 37678893ecc..0b7798bf161 100644 --- a/PHOS/AliPHOSSDigitizer.h +++ b/PHOS/AliPHOSSDigitizer.h @@ -3,6 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ + /* $Id$ */ //_________________________________________________________________________ @@ -20,41 +21,43 @@ class TFile ; // --- Standard library --- // --- AliRoot header files --- +#include "AliConfig.h" class AliPHOSSDigitizer: public TTask { public: AliPHOSSDigitizer() ; // ctor - AliPHOSSDigitizer(const char* headerFile, const char *sdigitsTitle = "Default", const Bool_t toSplit = kFALSE) ; + AliPHOSSDigitizer(const char * alirunFileName, const char * eventFolderName = AliConfig::fgkDefaultEventFolderName) ; AliPHOSSDigitizer(const AliPHOSSDigitizer & sd) ; // cpy ctor - virtual ~AliPHOSSDigitizer() ; // dtor + virtual ~AliPHOSSDigitizer() {;} // dtor - Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; } - Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); } + Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; } + Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); } virtual void Exec(Option_t *option); - const char * GetSDigitsBranch()const{return GetName();} const Int_t GetSDigitsInRun() const {return fSDigitsInRun ;} - virtual void Print(Option_t* option) const ; - void SetSDigitsBranch(const char * title ) ; - void UseHitsFrom(const char * filename) ; + virtual void Print() const ; + void SetEventFolderName(TString name) { fEventFolderName = name ; } + Bool_t operator == (const AliPHOSSDigitizer & sd) const ; - AliPHOSSDigitizer & operator = (const AliPHOSSDigitizer & sd) {return *this ; } + AliPHOSSDigitizer & operator = (const AliPHOSSDigitizer & sd) {return *this ;} private: void Init() ; void InitParameters() ; void PrintSDigits(Option_t * option) ; + void Unload() const ; + private: Float_t fA ; // Pedestal parameter Float_t fB ; // Slope Digitizition parameters Float_t fPrimThreshold ; // To store primari if Elos > threshold Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) + TString fEventFolderName; // event folder name + Bool_t fInit ; //! tells if initialisation wennt OK, will revent exec if not Int_t fSDigitsInRun ; //! Total number of sdigits in one run - TFile * fSplitFile ; //! file in which SDigits will eventually be stored - Bool_t fToSplit ; //! Says that sigits should be written into splip file - ClassDef(AliPHOSSDigitizer,1) // description + ClassDef(AliPHOSSDigitizer,2) // description }; diff --git a/PHOS/AliPHOSSupportGeometry.h b/PHOS/AliPHOSSupportGeometry.h index a4e3cc6e981..fbff6ba2d83 100644 --- a/PHOS/AliPHOSSupportGeometry.h +++ b/PHOS/AliPHOSSupportGeometry.h @@ -12,9 +12,11 @@ // Author: Yuri Kharlov (IHEP, Protvino) // 13 November 2000 +#include // --- ROOT system --- -#include "TObject.h" + +#include "TObjArray.h" // --- AliRoot header files --- @@ -22,13 +24,18 @@ class AliPHOSSupportGeometry : public TObject { public: - AliPHOSSupportGeometry(); - AliPHOSSupportGeometry(const AliPHOSSupportGeometry & cpv) { - Fatal("AliPHOSSupportGeometry", "CPY CTOR not implemented") ;} + AliPHOSSupportGeometry(); + AliPHOSSupportGeometry(const AliPHOSSupportGeometry & cpv) { + // cpy ctor requested by Coding Convention but not yet needed + assert(0==1) ; + } virtual ~AliPHOSSupportGeometry(void) {} - AliPHOSSupportGeometry & operator = (const AliPHOSSupportGeometry & rvalue) { return *this ; } - + AliPHOSSupportGeometry & operator = (const AliPHOSSupportGeometry & rvalue) { + // assignement operator requested by coding convention but not needed + assert(0==1) ; + return *this ; + } Float_t GetRailOuterSize(Int_t index) const { return fRailOuterSize[index]; } Float_t GetRailPart1 (Int_t index) const { return fRailPart1[index]; } Float_t GetRailPart2 (Int_t index) const { return fRailPart2[index]; } diff --git a/PHOS/AliPHOSTick.cxx b/PHOS/AliPHOSTick.cxx index 475c452600f..fe36a2c5c98 100644 --- a/PHOS/AliPHOSTick.cxx +++ b/PHOS/AliPHOSTick.cxx @@ -18,8 +18,7 @@ //_________________________________________________________________________ // Auxiliary class to help calculate the time of crossing // of the threshold by the front edge of the time signal -//.. -//.. +// //*-- Author : Dmitri Peressounko (SUBATECH) ////////////////////////////////////////////////////////////////////////////// @@ -36,7 +35,6 @@ ClassImp(AliPHOSTick) //____________________________________________________________________________ AliPHOSTick::AliPHOSTick():TObject() { - // default ctor fTime = 0; fA = 0; fB = 0 ; @@ -45,19 +43,12 @@ ClassImp(AliPHOSTick) //____________________________________________________________________________ AliPHOSTick::AliPHOSTick(Float_t time, Float_t a, Float_t slope):TObject() { - //ctor fTime = time; fA = a; fB = slope ; } //____________________________________________________________________________ -Int_t AliPHOSTick::Compare(const TObject * obj) const -{ - // compare the times of two tick objects - // return = -1 if smaller - // 0 if equal - // 1 id larger - +Int_t AliPHOSTick::Compare(const TObject * obj) const { if(obj->InheritsFrom("AliPHOSTick")){ AliPHOSTick * tick = (AliPHOSTick *) obj ; if(fTime < tick->fTime) diff --git a/PHOS/AliPHOSTick.h b/PHOS/AliPHOSTick.h index 5e3d1f05483..bc771119bed 100644 --- a/PHOS/AliPHOSTick.h +++ b/PHOS/AliPHOSTick.h @@ -32,7 +32,7 @@ public: {if(fB) return fTime + (threshold - fA)/fB ; else return 1. ;} //return very big time - Float_t GetTime(void) const {return fTime ;} + Float_t GetTime(void){return fTime ;} void operator+=(AliPHOSTick const &rValue) ; diff --git a/PHOS/AliPHOSTrackSegment.cxx b/PHOS/AliPHOSTrackSegment.cxx index 18fa13ac45d..dcc0ca5588c 100644 --- a/PHOS/AliPHOSTrackSegment.cxx +++ b/PHOS/AliPHOSTrackSegment.cxx @@ -29,7 +29,6 @@ // --- AliRoot header files --- #include "AliPHOSTrackSegment.h" -#include "AliPHOSEmcRecPoint.h" ClassImp(AliPHOSTrackSegment) diff --git a/PHOS/AliPHOSTrackSegment.h b/PHOS/AliPHOSTrackSegment.h index 5d69e180cda..2f6e55c5666 100644 --- a/PHOS/AliPHOSTrackSegment.h +++ b/PHOS/AliPHOSTrackSegment.h @@ -16,14 +16,13 @@ // --- ROOT system --- #include "TObject.h" -class TClonesArray ; // --- Standard library --- // --- AliRoot header files --- -class AliPHOSEmcRecPoint ; -class AliPHOSRecPoint ; +#include "AliPHOSEmcRecPoint.h" +#include "AliPHOSRecPoint.h" class AliPHOSTrackSegment : public TObject { diff --git a/PHOS/AliPHOSTrackSegmentMaker.cxx b/PHOS/AliPHOSTrackSegmentMaker.cxx index 38d2655fb30..a442780048d 100644 --- a/PHOS/AliPHOSTrackSegmentMaker.cxx +++ b/PHOS/AliPHOSTrackSegmentMaker.cxx @@ -22,12 +22,15 @@ // --- ROOT system --- +#include "TGeometry.h" #include "TFile.h" +#include "TTree.h" // --- Standard library --- // --- AliRoot header files --- #include "AliPHOSTrackSegmentMaker.h" +#include "AliHeader.h" ClassImp( AliPHOSTrackSegmentMaker) @@ -36,31 +39,18 @@ ClassImp( AliPHOSTrackSegmentMaker) AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : TTask("","") { // ctor - fSplitFile= 0 ; - -} - -//____________________________________________________________________________ -AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name, const Bool_t toSplit): TTask(name, headerFile) -{ - // ctor - fSplitFile= 0 ; - fToSplit = toSplit ; + fEventFolderName = "" ; } //____________________________________________________________________________ - AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker& ts) : - TTask(ts.GetName(), ts.GetTitle()) +AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName): + TTask("PHOS"+AliConfig::fgkTrackerTaskName, alirunFileName), fEventFolderName(eventFolderName) { // ctor - fSplitFile = new TFile( (ts.fSplitFile)->GetName(), "new") ; - fToSplit = ts.fToSplit ; } //____________________________________________________________________________ AliPHOSTrackSegmentMaker::~AliPHOSTrackSegmentMaker() { - - fSplitFile = 0 ; } diff --git a/PHOS/AliPHOSTrackSegmentMaker.h b/PHOS/AliPHOSTrackSegmentMaker.h index 704f8acd2aa..74e7a891284 100644 --- a/PHOS/AliPHOSTrackSegmentMaker.h +++ b/PHOS/AliPHOSTrackSegmentMaker.h @@ -14,9 +14,11 @@ // --- ROOT system --- #include "TTask.h" -class TFile ; +#include "AliConfig.h" +class TFile ; // --- Standard library --- +#include // --- AliRoot header files --- @@ -28,36 +30,24 @@ class AliPHOSTrackSegmentMaker : public TTask { public: - AliPHOSTrackSegmentMaker() ; - AliPHOSTrackSegmentMaker(const char* headerFile, const char* name, const Bool_t toSplit) ; - AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & ts) ; - - + AliPHOSTrackSegmentMaker(); + AliPHOSTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName) ; + AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & tsmaker) { ; } virtual ~ AliPHOSTrackSegmentMaker() ; virtual void Exec(Option_t * option){Warning("Exec", "Not Defined" ) ; } - // virtual char* GetRecPointsBranch ()const{Warning("GetRecPointsBranch", "Not Defined" ) ; return 0 ; } - // virtual char* GetTrackSegmentsBranch ()const{Warning(" GetTrackSegmentsBranch", "Not Defined" ) ; return 0 ; } + virtual const Int_t GetTrackSegmentsInRun() const {Warning("GetTrackSegmentsInRun", "Not Defined" ) ; return 0 ; } - virtual void Print(Option_t * option)const {Warning("Print", "Not Defined" ) ; } - // virtual void Set... // method to choose recPoints: along z only, along x ...??? - // virtual void SetChoosingAlgirithm(){Warning("SetChoosingAlgirithm", "Not Defined" ) ; return 0 ; } - // virtual void SetMaxEmcCpvDistance(Float_t r) {Warning("SetMaxEmcCpvDistance", "Not Defined" ) ; return 0 ; } - // virtual void SetRecPointsBranch(const char * title){Warning("SetRecPointsBranch", "Not Defined" ) ; } - // virtual void SetTrackSegmentsBranch(const char * title){Warning("SetTrackSegmentsBranch", "Not Defined" ) ; } - // virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ; - virtual const char * Version() const {Warning("Version", "Not Defined" ) ; return 0 ; } - virtual void WriteTrackSegments(Int_t event){Warning("WriteTrackSegments", "Not Defined" ) ; } - AliPHOSTrackSegmentMaker & operator = (const AliPHOSTrackSegmentMaker &ts) {return *this ; } + virtual void Print()const {Warning("Print", "Not Defined" ) ; } + void SetEventFolderName(TString name) { fEventFolderName = name ; } -protected: + virtual void WriteTrackSegments(Int_t event){Warning("WriteTrackSegments", "Not Defined" ) ; } - TFile * fSplitFile ; //! file in which TrackSegments will eventually be stored - Bool_t fToSplit ; //! Do we work in the split mode - - ClassDef( AliPHOSTrackSegmentMaker,1) // Algorithm class to make PHOS track segments (Base Class) +protected: + TString fEventFolderName ; // event folder name + ClassDef( AliPHOSTrackSegmentMaker,3) // Algorithm class to make PHOS track segments (Base Class) }; #endif // ALIPHOSTRACKSEGMENTMAKER_H diff --git a/PHOS/AliPHOSTrackSegmentMakerv1.cxx b/PHOS/AliPHOSTrackSegmentMakerv1.cxx index e2b2be43b5b..996a309d753 100644 --- a/PHOS/AliPHOSTrackSegmentMakerv1.cxx +++ b/PHOS/AliPHOSTrackSegmentMakerv1.cxx @@ -46,9 +46,9 @@ // --- ROOT system --- #include "TROOT.h" #include "TFile.h" - //#include "TFolder.h" +#include "TFolder.h" #include "TTree.h" - //#include "TSystem.h" +#include "TSystem.h" #include "TBenchmark.h" // --- Standard library --- @@ -56,13 +56,12 @@ // --- AliRoot header files --- #include "AliPHOSTrackSegmentMakerv1.h" - //#include "AliPHOSClusterizerv1.h" +#include "AliPHOSClusterizerv1.h" #include "AliPHOSTrackSegment.h" - //#include "AliPHOSCpvRecPoint.h" +#include "AliPHOSCpvRecPoint.h" #include "AliPHOSLink.h" #include "AliPHOSGetter.h" - //#include "AliPHOS.h" -#include "AliRun.h" +#include "AliPHOS.h" ClassImp( AliPHOSTrackSegmentMakerv1) @@ -73,25 +72,18 @@ ClassImp( AliPHOSTrackSegmentMakerv1) // default ctor (to be used mainly by Streamer) InitParameters() ; - - fTrackSegmentsInRun = 0 ; - fDefaultInit = kTRUE ; } //____________________________________________________________________________ - AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char * headerFile, const char * name, const Bool_t toSplit) : AliPHOSTrackSegmentMaker(headerFile, name, toSplit) + AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const TString alirunFileName, const TString eventFolderName) + :AliPHOSTrackSegmentMaker(alirunFileName, eventFolderName) { // ctor InitParameters() ; - - fTrackSegmentsInRun = 0 ; - Init() ; - fDefaultInit = kFALSE ; - } //____________________________________________________________________________ @@ -99,22 +91,16 @@ ClassImp( AliPHOSTrackSegmentMakerv1) { // dtor // fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters) - - if (!fDefaultInit) { - delete fLinkUpArray ; - - fSplitFile = 0 ; - } + if (!fDefaultInit) + delete fLinkUpArray ; } //____________________________________________________________________________ const TString AliPHOSTrackSegmentMakerv1::BranchName() const { - // retrieves the branch name - TString branchName(GetName() ) ; - branchName.Remove(branchName.Index(Version())-1) ; - return branchName ; + + return GetName() ; } //____________________________________________________________________________ @@ -122,8 +108,9 @@ void AliPHOSTrackSegmentMakerv1::FillOneModule() { // Finds first and last indexes between which // clusters from one PHOS module are + + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; @@ -137,8 +124,8 @@ void AliPHOSTrackSegmentMakerv1::FillOneModule() Int_t totalCpv = cpvRecPoints->GetEntriesFast() ; for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) && - ((dynamic_cast(cpvRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule ); - fCpvLast ++) ; + ((dynamic_cast(cpvRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule ); + fCpvLast ++) ; } @@ -183,61 +170,24 @@ void AliPHOSTrackSegmentMakerv1::Init() { // Make all memory allocations that are not possible in default constructor - if ( strcmp(GetTitle(), "") == 0 ) - SetTitle("galice.root") ; - - TString branchname = GetName() ; - branchname.Remove(branchname.Index(Version())-1) ; - AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(), fToSplit ) ; - if ( gime == 0 ) { - Error("Init", "Could not obtain the Getter object !") ; - return ; - } - - fSplitFile = 0 ; - if(fToSplit){ - //First - extract full path if necessary - TString fileName(GetTitle()) ; - Ssiz_t islash = fileName.Last('/') ; - if(islash(gROOT->GetFile(fileName.Data())); - if(!fSplitFile) - fSplitFile = TFile::Open(fileName.Data(),"update") ; - } + AliPHOSGetter* gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()); fLinkUpArray = new TClonesArray("AliPHOSLink", 1000); - - - gime->PostTrackSegmentMaker(this) ; - gime->PostTrackSegments(BranchName()) ; - + if ( !gime->TrackSegmentMaker() ) { + gime->PostTrackSegmentMaker(this); + } } //____________________________________________________________________________ void AliPHOSTrackSegmentMakerv1::InitParameters() { - // initializes parameters used for the construction of the tacksegments fRcpv = 10. ; fEmcFirst = 0 ; fEmcLast = 0 ; fCpvFirst = 0 ; fCpvLast = 0 ; fLinkUpArray = 0 ; - TString tsmName( GetName()) ; - if (tsmName.IsNull() ) - tsmName = "Default" ; - tsmName.Append(":") ; - tsmName.Append(Version()) ; - SetName(tsmName) ; + fTrackSegmentsInRun = 0 ; } @@ -248,7 +198,7 @@ void AliPHOSTrackSegmentMakerv1::MakeLinks()const // which are not further apart from each other than fRcpv // and sort them in accordance with this distance - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; @@ -271,9 +221,9 @@ void AliPHOSTrackSegmentMakerv1::MakeLinks()const Float_t r = GetDistanceInPHOSPlane(emcclu, cpv, toofar) ; if(toofar) - break ; + break ; if(r < fRcpv) { - new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iCpv) ; + new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iCpv) ; } } } @@ -288,11 +238,12 @@ void AliPHOSTrackSegmentMakerv1::MakePairs() // link with the least distance between EMC and CPV and pointing to still // unassigned RecParticles. We assign these RecPoints to TrackSegment and // remove them from the list of "unassigned". - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + TObjArray * emcRecPoints = gime->EmcRecPoints() ; TObjArray * cpvRecPoints = gime->CpvRecPoints() ; - TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ; + TClonesArray * trackSegments = gime->TrackSegments(); //Make arrays to mark clusters already chosen Int_t * emcExist = 0; @@ -322,30 +273,30 @@ void AliPHOSTrackSegmentMakerv1::MakePairs() if(emcExist[linkUp->GetEmc()-fEmcFirst] != -1){ //without ppsd Up yet if(cpvExist[linkUp->GetPpsd()-fCpvFirst]){ //CPV still exist - - new ((* trackSegments)[fNTrackSegments]) - AliPHOSTrackSegment(dynamic_cast(emcRecPoints->At(linkUp->GetEmc())) , - dynamic_cast(cpvRecPoints->At(linkUp->GetPpsd()))) ; - (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); - fNTrackSegments++ ; - - emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found - //mark CPV recpoint as already used - cpvExist[linkUp->GetPpsd()-fCpvFirst] = kFALSE ; + + new ((* trackSegments)[fNTrackSegments]) + AliPHOSTrackSegment(dynamic_cast(emcRecPoints->At(linkUp->GetEmc())) , + dynamic_cast(cpvRecPoints->At(linkUp->GetPpsd()))) ; + (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); + fNTrackSegments++ ; + + emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found + //mark CPV recpoint as already used + cpvExist[linkUp->GetPpsd()-fCpvFirst] = kFALSE ; } //if ppsdUp still exist } - } + } //look through emc recPoints left without CPV/PPSD if(emcExist){ //if there is emc rec point Int_t iEmcRP ; for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){ if(emcExist[iEmcRP] > 0 ){ - new ((*trackSegments)[fNTrackSegments]) - AliPHOSTrackSegment(dynamic_cast(emcRecPoints->At(iEmcRP+fEmcFirst)), - nullpointer) ; - (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); - fNTrackSegments++; + new ((*trackSegments)[fNTrackSegments]) + AliPHOSTrackSegment(dynamic_cast(emcRecPoints->At(iEmcRP+fEmcFirst)), + nullpointer) ; + (dynamic_cast(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); + fNTrackSegments++; } } } @@ -357,27 +308,23 @@ void AliPHOSTrackSegmentMakerv1::MakePairs() void AliPHOSTrackSegmentMakerv1::Exec(Option_t * option) { // STEERing method - - if( strcmp(GetName(), "")== 0 ) - Init() ; - + if(strstr(option,"tim")) gBenchmark->Start("PHOSTSMaker"); if(strstr(option,"print")) { - Print("") ; + Print() ; return ; } - - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - if(gime->BranchExists("TrackSegments") ) - return ; + + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + const AliPHOSGeometry * geom = gime->PHOSGeometry() ; - Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ; - Int_t ievent ; - for(ievent = 0; ievent < nevents; ievent++){ + Int_t nevents = gime->MaxEvent() ; + Int_t ievent ; + for(ievent = 0; ievent < nevents; ievent++) { gime->Event(ievent,"R") ; //Make some initializations fNTrackSegments = 0 ; @@ -385,40 +332,46 @@ void AliPHOSTrackSegmentMakerv1::Exec(Option_t * option) fEmcLast = 0 ; fCpvFirst = 0 ; fCpvLast = 0 ; - gime->TrackSegments(BranchName())->Clear() ; + + gime->TrackSegments()->Clear(); // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent - for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ){ - + for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ) { FillOneModule() ; - MakeLinks() ; - MakePairs() ; - } WriteTrackSegments(ievent) ; if(strstr(option,"deb")) - PrintTrackSegments(option) ; + PrintTrackSegments(option); //increment the total number of track segments per run - fTrackSegmentsInRun += gime->TrackSegments(BranchName())->GetEntriesFast() ; + fTrackSegmentsInRun += gime->TrackSegments()->GetEntriesFast() ; } - + if(strstr(option,"tim")){ gBenchmark->Stop("PHOSTSMaker"); Info("Exec", "took %f seconds for making TS %f seconds per event", - gBenchmark->GetCpuTime("PHOSTSMaker"), gBenchmark->GetCpuTime("PHOSTSMaker")/nevents) ; - } - + gBenchmark->GetCpuTime("PHOSTSMaker"), + gBenchmark->GetCpuTime("PHOSTSMaker")/nevents) ; + } + Unload(); +} + +//____________________________________________________________________________ +void AliPHOSTrackSegmentMakerv1::Unload() +{ + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + gime->PhosLoader()->UnloadRecPoints() ; + gime->PhosLoader()->UnloadTracks() ; } //____________________________________________________________________________ -void AliPHOSTrackSegmentMakerv1::Print(Option_t * option)const +void AliPHOSTrackSegmentMakerv1::Print()const { // Print TrackSegmentMaker parameters @@ -445,48 +398,21 @@ void AliPHOSTrackSegmentMakerv1::WriteTrackSegments(Int_t event) // ROOT does not allow overwriting existing branches, therefore // first we check, if branches with the same title already exist. // If yes - exits without writing. - - AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; + + AliPHOSGetter *gime = AliPHOSGetter::Instance() ; TClonesArray * trackSegments = gime->TrackSegments() ; trackSegments->Expand(trackSegments->GetEntriesFast()) ; - TTree * treeR ; - - if(fToSplit){ - if(!fSplitFile) - return ; - fSplitFile->cd() ; - char name[10] ; - sprintf(name,"%s%d", "TreeR",event) ; - treeR = dynamic_cast(fSplitFile->Get(name)); - } - else{ - treeR = gAlice->TreeR(); - } - - if(!treeR){ - gAlice->MakeTree("R", fSplitFile); - treeR = gAlice->TreeR() ; - } - - //First TS - Int_t bufferSize = 32000 ; - TBranch * tsBranch = treeR->Branch("PHOSTS",&trackSegments,bufferSize); - tsBranch->SetTitle(BranchName()); - - //Second -TSMaker - Int_t splitlevel = 0 ; - AliPHOSTrackSegmentMakerv1 * ts = this ; - TBranch * tsMakerBranch = treeR->Branch("AliPHOSTrackSegmentMaker","AliPHOSTrackSegmentMakerv1", - &ts,bufferSize,splitlevel); - tsMakerBranch->SetTitle(BranchName()); + TTree * treeT = gime->TreeT(); + + //First TS + Int_t bufferSize = 32000 ; + TBranch * tsBranch = treeT->Branch("PHOSTS",&trackSegments,bufferSize); tsBranch->Fill() ; - tsMakerBranch->Fill() ; - treeR->AutoSave() ; //Write(0,kOverwrite) ; - if(gAlice->TreeR()!=treeR) - treeR->Delete(); + gime->WriteTracks("OVERWRITE"); + gime->WriteTrackSegmentMaker("OVERWRITE"); } @@ -495,30 +421,19 @@ void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option) { // option deb - prints # of found TrackSegments // option deb all - prints as well indexed of found RecParticles assigned to the TS - TString taskName(GetName()) ; - taskName.Remove(taskName.Index(Version())-1) ; - - TClonesArray * trackSegments = AliPHOSGetter::GetInstance()->TrackSegments(taskName) ; - TString message ; - message = "\nevent " ; - message += gAlice->GetEvNumber() ; - message += "\n Found " ; - message += trackSegments->GetEntriesFast() ; - message += " TrackSegments\n" ; + TClonesArray * trackSegments = AliPHOSGetter::Instance()->TrackSegments() ; + Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ; + printf("nevent: %d\n", gAlice->GetEvNumber()) ; + printf(" Found %d TrackSegments\n", trackSegments->GetEntriesFast() ); + if(strstr(option,"all")) { // printing found TS - message += "TrackSegment # EMC RP# CPV RP#\n" ; + printf("TrackSegment # EMC RP# CPV RP#\n") ; Int_t index; for (index = 0 ; index GetEntriesFast() ; index++) { AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )trackSegments->At(index) ; - message += "\n" ; - message += ts->GetIndexInList() ; - message += " " ; - message += ts->GetEmcIndex() ; - message += " " ; - message += ts->GetCpvIndex() ; + printf(" %d %d %d \n", ts->GetIndexInList(), ts->GetEmcIndex(), ts->GetCpvIndex() ) ; } } - Info("Print", message.Data() ) ; } diff --git a/PHOS/AliPHOSTrackSegmentMakerv1.h b/PHOS/AliPHOSTrackSegmentMakerv1.h index 4db5038b0e0..e26e17a2be7 100644 --- a/PHOS/AliPHOSTrackSegmentMakerv1.h +++ b/PHOS/AliPHOSTrackSegmentMakerv1.h @@ -28,13 +28,12 @@ class AliPHOSTrackSegmentMakerv1 : public AliPHOSTrackSegmentMaker { public: AliPHOSTrackSegmentMakerv1() ; - AliPHOSTrackSegmentMakerv1(const char* headerFile, const char* name = "Default", const Bool_t toSplit = kFALSE) ; + AliPHOSTrackSegmentMakerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::fgkDefaultEventFolderName); AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) { // cpy ctor: no implementation yet // requested by the Coding Convention Fatal("cpy ctor", "not implemented") ; -} - + } virtual ~ AliPHOSTrackSegmentMakerv1() ; // dtor // virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;} @@ -46,7 +45,7 @@ public: void MakeLinks() const; //Evaluates distances(links) between EMC and PPSD void MakePairs() ; //Finds pairs(triplets) with smallest link - virtual void Print(Option_t * option) const ; + virtual void Print() const ; virtual void SetMaxEmcCPVDistance(Float_t r){ fRcpv = r ;} //Maximal distance (in PHOS plane) //between EMCrp and CPVrp virtual void SetMaxEmcTPCDistance(Float_t r){ fRtpc = r ;} //Maximal distance (in PHOS plane) @@ -60,7 +59,7 @@ public: Fatal("operator =", "not implemented") ; return *this ; } - + void Unload() ; private: @@ -74,12 +73,9 @@ private: private: Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) - // TString fFrom ; // name of Recpoints - // TString fHeaderFileName ; // name of the file which contains gAlice, Tree headers etc. - // TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored - // TString fTrackSegmentsBranchTitle ; // name of the file, where TrackSegment branchs is stored Int_t fNTrackSegments ; // number of track segments found + Float_t fRcpv ; // Maximum distance between a EMC RecPoint and a CPV RecPoint Float_t fRtpc ; // Maximum distance between a EMC RecPoint and extrapolation of a TPC track @@ -91,8 +87,8 @@ private: Int_t fModule ; //! number of module being processed Int_t fTrackSegmentsInRun ; //! Total number of track segments in one run - ClassDef( AliPHOSTrackSegmentMakerv1,2) // Implementation version 1 of algorithm class to make PHOS track segments + ClassDef( AliPHOSTrackSegmentMakerv1,3) // Implementation version 1 of algorithm class to make PHOS track segments -}; + }; #endif // AliPHOSTRACKSEGMENTMAKERV1_H diff --git a/PHOS/AliPHOSv0.cxx b/PHOS/AliPHOSv0.cxx index db7bdfebd41..5b2ac627048 100644 --- a/PHOS/AliPHOSv0.cxx +++ b/PHOS/AliPHOSv0.cxx @@ -14,32 +14,38 @@ **************************************************************************/ /* $Id$ */ - //_________________________________________________________________________ // Implementation version v0 of PHOS Manager class // An object of this class does not produce hits nor digits // It is the one to use if you do not want to produce outputs in TREEH or TREED -//... +// //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) // --- ROOT system --- -#include "TBRIK.h" -#include "TTRD1.h" -#include "TNode.h" -#include "TArrayI.h" -#include "TRandom.h" -#include "TGeometry.h" -#include "TROOT.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include // --- Standard library --- +#include +#include + // --- AliRoot header files --- +#include "AliConst.h" +#include "AliPHOSGeometry.h" +#include "AliPHOSLoader.h" #include "AliPHOSv0.h" #include "AliRun.h" -#include "AliPHOSGeometry.h" ClassImp(AliPHOSv0) diff --git a/PHOS/AliPHOSv1.cxx b/PHOS/AliPHOSv1.cxx index a9bb43a4f26..aa8fb410cd2 100644 --- a/PHOS/AliPHOSv1.cxx +++ b/PHOS/AliPHOSv1.cxx @@ -31,22 +31,30 @@ // --- ROOT system --- -#include "TRandom.h" -#include "TParticle.h" -#include "TClonesArray.h" + +#include +#include +#include +#include +#include +#include // --- Standard library --- +#include +#include + // --- AliRoot header files --- -#include "AliPHOSv1.h" -#include "AliPHOSHit.h" +#include "AliConst.h" #include "AliPHOSCPVDigit.h" -#include "AliRun.h" #include "AliPHOSGeometry.h" -#include "AliPHOSQAIntCheckable.h" +#include "AliPHOSHit.h" #include "AliPHOSQAFloatCheckable.h" +#include "AliPHOSQAIntCheckable.h" #include "AliPHOSQAMeanChecker.h" +#include "AliPHOSv1.h" +#include "AliRun.h" ClassImp(AliPHOSv1) @@ -154,8 +162,7 @@ AliPHOSv1::AliPHOSv1(const char *name, const char *title): AliPHOSv1::~AliPHOSv1() { // dtor - - if ( fHits) { + if ( fHits) { fHits->Delete() ; delete fHits ; fHits = 0 ; @@ -230,6 +237,7 @@ void AliPHOSv1::FinishEvent() // called at the end of each event by AliRun // accumulate the hit-multiplicity and total energy per block // if the values have been updated check it + if ( fQATotEner ) { if ( fQATotEner->HasChanged() ) { @@ -262,6 +270,8 @@ void AliPHOSv1::FinishEvent() fQAHitsMul->Reset() ; } } + + AliDetector::FinishEvent(); } //____________________________________________________________________________ void AliPHOSv1::StepManager(void) diff --git a/PHOS/AliPHOSv3.cxx b/PHOS/AliPHOSv3.cxx index bbf896470cf..369783bfb17 100644 --- a/PHOS/AliPHOSv3.cxx +++ b/PHOS/AliPHOSv3.cxx @@ -43,6 +43,7 @@ #include "AliPHOSCPVDigit.h" #include "AliRun.h" #include "AliConst.h" +#include "AliMC.h" #include "AliPHOSGeometry.h" ClassImp(AliPHOSv3) diff --git a/PHOS/AliPHOSv4.cxx b/PHOS/AliPHOSv4.cxx index 3dd448e058b..37cec26febc 100644 --- a/PHOS/AliPHOSv4.cxx +++ b/PHOS/AliPHOSv4.cxx @@ -39,9 +39,10 @@ #include "AliPHOSFastRecParticle.h" #include "AliPHOSGeometry.h" #include "AliPHOSv4.h" -#include "AliPHOSGetter.h" +#include "AliPHOSLoader.h" #include "AliRun.h" #include "AliConst.h" +#include "AliMC.h" ClassImp(AliPHOSv4) @@ -75,7 +76,7 @@ AliPHOSv4::AliPHOSv4(const char *name, const char *title): // create the geometry parameters object // and post it to a folder (Post retrieves the correct geometry) - AliPHOSGetter::GetInstance(gDirectory->GetName(), 0)->PostGeometry() ; + AliPHOSLoader::GetInstance(gDirectory->GetName(), name)->PostGeometry() ; //skowron SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ; SetBigBox(1, GetGeometry()->GetOuterBoxSize(1) + GetGeometry()->GetCPVBoxSize(1) ) ; diff --git a/PHOS/AliPHOSv4.h b/PHOS/AliPHOSv4.h index 484678534a5..e2905fc1a4b 100644 --- a/PHOS/AliPHOSv4.h +++ b/PHOS/AliPHOSv4.h @@ -35,13 +35,13 @@ public: AliPHOSv4(const AliPHOSv4 & fast) { // cpy ctor: no implementation yet // requested by the Coding Convention - Fatal("cpy ctor", "not implemented") ; + assert(0==1) ; } virtual ~AliPHOSv4(void) ; virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) { // useless since there are no hits - Fatal("AliPHOSv1", "no AddHit is needed") ; + assert(0==1) ; } void AddRecParticle(const AliPHOSFastRecParticle & rp) ; // adds primary particle to the RecParticles list virtual void BuildGeometry(void) ; // creates the geometry for the ROOT display @@ -74,7 +74,7 @@ public: AliPHOSv4 & operator = (const AliPHOSv4 & ) { // assignement operator requested by coding convention but not needed - Fatal("operator =", "not implemented") ; return *this ; + assert(0==1) ; return *this ; } diff --git a/PHOS/AliPHOSvFast.cxx b/PHOS/AliPHOSvFast.cxx index 1609a946979..763cc3f64cb 100644 --- a/PHOS/AliPHOSvFast.cxx +++ b/PHOS/AliPHOSvFast.cxx @@ -1,4 +1,4 @@ -/************************************************************************** + /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * @@ -26,17 +26,22 @@ // --- ROOT system --- -#include "TBRIK.h" -#include "TNode.h" -#include "TParticle.h" -#include "TGeometry.h" +#include +#include +#include +#include +#include +#include +#include // --- Standard library --- // --- AliRoot header files --- +#include "AliConst.h" #include "AliPHOSFastRecParticle.h" +#include "AliPHOSGeometry.h" +#include "AliPHOSLoader.h" #include "AliPHOSvFast.h" -#include "AliPHOSGetter.h" #include "AliRun.h" ClassImp(AliPHOSvFast) @@ -69,8 +74,7 @@ AliPHOSvFast::AliPHOSvFast(const char *name, const char *title): // ctor - // create the Getter - AliPHOSGetter::GetInstance(gDirectory->GetName(), 0) ; + // create the Loader SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ; SetBigBox(1, GetGeometry()->GetOuterBoxSize(3) + GetGeometry()->GetCPVBoxSize(1) ) ; @@ -90,34 +94,6 @@ AliPHOSvFast::AliPHOSvFast(const char *name, const char *title): fPosParaB2 = 0.00619 ; } -//____________________________________________________________________________ -AliPHOSvFast::AliPHOSvFast(const AliPHOSvFast & pv): - AliPHOS(pv.GetName(), pv.GetTitle()) -{ - // cpy ctor - - - // create the Getter - AliPHOSGetter::GetInstance(gDirectory->GetName(), 0) ; - - SetBigBox(0, pv.fBigBoxX) ; - SetBigBox(1, pv.fBigBoxY) ; - SetBigBox(2, pv.fBigBoxZ) ; - - fNRecParticles = pv.fNRecParticles; - fFastRecParticles = new TClonesArray( *(pv.fFastRecParticles) ) ; - - fResPara1 = pv.fResPara1 ; - fResPara2 = pv.fResPara2 ; - fResPara3 = pv.fResPara3 ; - - fPosParaA0 = pv.fPosParaA0 ; - fPosParaA1 = pv.fPosParaA1 ; - fPosParaB0 = pv.fPosParaB0 ; - fPosParaB1 = pv.fPosParaB1 ; - fPosParaB2 = pv.fPosParaB2 ; -} - //____________________________________________________________________________ AliPHOSvFast::~AliPHOSvFast() { @@ -280,25 +256,20 @@ Float_t AliPHOSvFast::GetBigBox(Int_t index) const } return rv ; } - //___________________________________________________________________________ -void AliPHOSvFast::MakeBranch(Option_t* opt, const char *file) + +void AliPHOSvFast::MakeBranch(Option_t* opt) { // Create new branch in the current reconstructed Root Tree - - AliDetector::MakeBranch(opt,file) ; - - char branchname[10]; - sprintf(branchname,"%s",GetName()); + AliDetector::MakeBranch(opt); const char *cd = strstr(opt,"R"); - if (fFastRecParticles && gAlice->TreeR() && cd) { - MakeBranchInTree(gAlice->TreeR(), - branchname, &fFastRecParticles, fBufferSize, file); + if (fFastRecParticles && fLoader->TreeR() && cd) { + MakeBranchInTree(fLoader->TreeR(), GetName(), &fFastRecParticles, fBufferSize, 0); } } - //____________________________________________________________________________ + Double_t AliPHOSvFast::MakeEnergy(const Double_t energy) { // Smears the energy according to the energy dependent energy resolution. @@ -307,8 +278,8 @@ Double_t AliPHOSvFast::MakeEnergy(const Double_t energy) Double_t sigma = SigmaE(energy) ; return fRan.Gaus(energy, sigma) ; } - //____________________________________________________________________________ + TVector3 AliPHOSvFast::MakePosition(const Double_t energy, const TVector3 pos, const Double_t theta, const Double_t phi) { // Smears the impact position according to the energy dependent position resolution @@ -378,8 +349,8 @@ Int_t AliPHOSvFast::MakeType(AliPHOSFastRecParticle & rp ) else test = rp.GetPdgCode() ; - Fatal("MakeType", "SHOULD NOT BE USED until values of probabilities are properly set ") ; - + Info("MakeType", "SHOULD NOT BE USED until values of probabilities are properly set ") ; + assert(1==0) ; // NB: ALL VALUES SHOULD BE CHECKED !!!! switch (test) { case 22: // it's a photon // NB: ALL VALUES SHOLD BE CHECKED !!!! diff --git a/PHOS/AliPHOSvFast.h b/PHOS/AliPHOSvFast.h index 840a0cd67ec..0988923b806 100644 --- a/PHOS/AliPHOSvFast.h +++ b/PHOS/AliPHOSvFast.h @@ -32,13 +32,16 @@ public: AliPHOSvFast() ; AliPHOSvFast(const char *name, const char *title="") ; - AliPHOSvFast(const AliPHOSvFast & fast) ; - + AliPHOSvFast(const AliPHOSvFast & fast) { + // cpy ctor: no implementation yet + // requested by the Coding Convention + assert(0==1) ; + } virtual ~AliPHOSvFast(void) ; virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) { // useless since there are no hits - Error("AddHit", "Not callable !") ; + assert(0==1) ; } void AddRecParticle(const AliPHOSFastRecParticle & rp) ; // adds primary particle to the RecParticles list virtual void BuildGeometry(void) ; // creates the geometry for the ROOT display @@ -50,7 +53,7 @@ public: return 99 ; } - void MakeBranch(Option_t* opt, const char *file=0) ; + void MakeBranch(Option_t* opt); Double_t MakeEnergy(const Double_t energy) ; // makes the detected energy TVector3 MakePosition(const Double_t energy, const TVector3 pos, const Double_t th, const Double_t ph) ; // makes the detected position @@ -69,7 +72,11 @@ public: return TString("vFast") ; } - AliPHOSvFast & operator = (const AliPHOSvFast & ) { return *this ; } + AliPHOSvFast & operator = (const AliPHOSvFast & ) { + // assignement operator requested by coding convention but not needed + assert(0==1) ; + return *this ; + } private: diff --git a/PHOS/AliPHOSvImpacts.cxx b/PHOS/AliPHOSvImpacts.cxx index 2acbe5e4b87..3cae449e928 100644 --- a/PHOS/AliPHOSvImpacts.cxx +++ b/PHOS/AliPHOSvImpacts.cxx @@ -13,6 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ //_________________________________________________________________________ @@ -28,17 +29,17 @@ // --- ROOT system --- -#include "TTree.h" -#include "TClonesArray.h" +#include +#include // --- Standard library --- // --- AliRoot header files --- -#include "AliRun.h" -#include "AliPHOSvImpacts.h" #include "AliPHOSGeometry.h" #include "AliPHOSImpact.h" +#include "AliPHOSvImpacts.h" +#include "AliRun.h" ClassImp(AliPHOSvImpacts) @@ -143,17 +144,17 @@ void AliPHOSvImpacts::AddImpact( char* det, Int_t shunt, Int_t primary, Int_t tr } //____________________________________________________________________________ -void AliPHOSvImpacts::MakeBranch(Option_t *opt, const char *file) +void AliPHOSvImpacts::MakeBranch(Option_t *opt) { // Create new branch in the current Hits Root Tree containing // a list of PHOS impacts (exact values of track coming to detector) - AliDetector::MakeBranch(opt,file); + AliDetector::MakeBranch(opt); Int_t bufferSize = 32000 ; Int_t splitlevel = 0 ; - gAlice->TreeH()->Branch("PHOSEmcImpacts" , "TList", &fEMCImpacts , bufferSize, splitlevel); - gAlice->TreeH()->Branch("PHOSCpvImpacts" , "TList", &fCPVImpacts , bufferSize, splitlevel); + TreeH()->Branch("PHOSEmcImpacts" , "TList", &fEMCImpacts , bufferSize, splitlevel); + TreeH()->Branch("PHOSCpvImpacts" , "TList", &fCPVImpacts , bufferSize, splitlevel); } diff --git a/PHOS/AliPHOSvImpacts.h b/PHOS/AliPHOSvImpacts.h index 099ff5672c1..6a0cc827a2e 100644 --- a/PHOS/AliPHOSvImpacts.h +++ b/PHOS/AliPHOSvImpacts.h @@ -36,7 +36,7 @@ public: virtual void AddImpact(char* detector, Int_t shunt, Int_t primary, Int_t track, Int_t module, Int_t pid, TLorentzVector p, Float_t *xyz) ; - virtual void MakeBranch(Option_t *opt=" ", const char *file=0) ; + virtual void MakeBranch(Option_t *opt=" "); virtual void ResetHits(); virtual Int_t IsVersion(void) const { // Gives the version number diff --git a/PHOS/AnaPhotons_v1.C b/PHOS/AnaPhotons_v1.C index 1f82c39ea7d..e69de29bb2d 100644 --- a/PHOS/AnaPhotons_v1.C +++ b/PHOS/AnaPhotons_v1.C @@ -1,305 +0,0 @@ -//=============================================================== -// In this Macro (which can (must) be compilated), you will find all the -// analysis functions to build photon spectrum, invariant mass -// spectrum of photon pairs and combinatorial background calculations -// in ALICE electromagnetic calorimeter -// Author: Gines MARTINEZ, Subatech, 15 june 2001 -//============================================================== -#include "TH2.h" -#include "TH1.h" -#include "TClonesArray.h" -#include "TFile.h" -#include "TTree.h" -#include "TRandom.h" -#include "TObjectTable.h" -#include "AliRun.h" -#include "AliPHOSGetter.h" -#include "AliPHOSRecParticle.h" -#include "TLorentzVector.h" -#include "TGraphErrors.h" -#include "TF1.h" - -TObjectTable * gObjectTable; -TRandom * gRandom; -AliRun * gAlice; - - -Bool_t PhotonId(AliPHOSRecParticle * RecParticle, char *opt) -{ - Bool_t PhotonId = kTRUE ; - if (strstr(opt,"narrow")) - { - if ( RecParticle->GetType() & 1) PhotonId= kFALSE ; - } - if (strstr(opt,"cpv")) - { - if ( (RecParticle->GetType() & 1<<2) >>2 ) PhotonId= kFALSE ; - } - if (strstr(opt,"time")) - { - - } - - return PhotonId; -} - -void AnaMinv(char * filename,char * opt) -{ - TH2F * h_Minv_lowpT = new TH2F("h_Minv_lowpT","Minv vs pT low",500,0.0,1.0,40,0.,10.); - TH2F * h_Minv_highpT = new TH2F("h_Minv_highpT","Minv vs pT high",500,0.0,1.0,50,0.,100.); - TH2F * h_Minv_lowpT_back = new TH2F("h_Minv_lowpT_back","Minv vs pT low back",500,0.0,1.0,40,0.,10.); - TH2F * h_Minv_highpT_back = new TH2F("h_Minv_highpT_back","Minv vs pT high back",500,0.0,1.0,50,0.,100.); - - - TH1F * h_Pseudoeta = new TH1F("h_Pseudoeta","Pseudoeta photons",500,-1.0,1.0); - TH1F * h_Pt = new TH1F("h_Pt","Pt photons",400,0.,10.); - TH2F * h_Peta_Pt = new TH2F("h_Peta_Pt","Pseudo vs pT",40,0.,10.,50,-1.0,1.0); - TH1F * h_Phi = new TH1F("h_Phi","Phi photons",400,-4.,4.); - TH2F * h_Peta_Phi = new TH2F("h_Peta_Phi","Pseudo vs Phi",200,-4,4,200,-1.0,1.0); - TH1F * h_Dispersion= new TH1F("h_Dispersion","Dispersion",50,0.,10.); - TH1F * h_Type = new TH1F("h_Type","Particle Type",9,-1.5,7.5); - - TH1F * h_DeltaR = new TH1F("h_DeltaR","Delta R",400,0.,2.); - TH1F * h_Asymmetry= new TH1F("h_Asymmetry","Asymmetry",400, -2., 2.); - - AliPHOSGetter * RecData = AliPHOSGetter::GetInstance(filename,"Gines") ; - - AliPHOSRecParticle * RecParticle1; - AliPHOSRecParticle * RecParticle2; - - Float_t RelativeRCut = 0.00001 ; - Float_t AsymmetryCut = 0.7 ; - Float_t Asymmetry; - Float_t Type; - - Int_t iEvent, iRecParticle1, iRecParticle2; - Int_t nRecParticle; - Float_t invariant_mass, invariant_mass_mixed; - TClonesArray * RecParticles; - - Float_t average_multiplicity = 0.; - - for(iEvent=0; iEventTreeE()->GetEntries(); iEvent++) - { - TLorentzVector P_photon1, P_photon2, P_photonMixed1, P_photonMixed2 ; - - RecData->Event(iEvent,"R"); - printf(">>> Event %d \n",iEvent); - RecParticles = RecData->RecParticles(); - nRecParticle = RecParticles->GetEntries(); - printf(">>> >> Recparticle multilicity is %d \n",nRecParticle); - average_multiplicity += ((Float_t) (nRecParticle) ) / ( (Float_t)gAlice->TreeE()->GetEntries() ) ; - // Construction de la masse invariante des pairs - if (nRecParticle > 1) - { - for(iRecParticle1=0; iRecParticle1At(iRecParticle1); - RecParticle1->Momentum(P_photon1); - printf(">>> >> Photon momentum is %f \n", P_photon1.Pt() ); - Type = RecParticle1->GetType(); - h_Type->Fill(Type); - // Photon Id check - if ( PhotonId(RecParticle1, opt) ) - { - - h_Pseudoeta->Fill(P_photon1.PseudoRapidity()); - h_Pt->Fill(P_photon1.Pt()); - h_Phi->Fill(P_photon1.Phi()); - h_Peta_Pt->Fill(P_photon1.Pt(), P_photon1.PseudoRapidity()); - h_Peta_Phi->Fill(P_photon1.Phi(), P_photon1.PseudoRapidity() ); - - for(iRecParticle2=iRecParticle1+1; iRecParticle2At(iRecParticle2); - RecParticle2->Momentum(P_photon2); - Asymmetry = TMath::Abs((P_photon1.E()-P_photon2.E())/(P_photon1.E()+P_photon2.E())); - //Photon Id Check - if ( PhotonId(RecParticle2, opt) ) - { - if ( (P_photon1 != P_photon2) && - (P_photon1.DeltaR(P_photon2) > RelativeRCut) && - (Asymmetry < AsymmetryCut) ) - { - h_DeltaR->Fill(P_photon1.DeltaR(P_photon2)); - h_Asymmetry->Fill( Asymmetry ); - - // printf("A. p1 es %f \n",P_photon1->E()); - invariant_mass = (P_photon1 + P_photon2).M(); - // printf("B. p1 es %f \n",P_photon1->E()); - h_Minv_lowpT->Fill(invariant_mass, (P_photon1 + P_photon2).Pt() ); - h_Minv_highpT->Fill(invariant_mass,(P_photon1 + P_photon2).Pt() ); - } - } - } - } - } - } - } - printf(">>> Average Multiplicity is %f \n",average_multiplicity); - Int_t Background = (Int_t) (gAlice->TreeE()->GetEntries() * average_multiplicity * (average_multiplicity-1.)/2.) ; - printf(">>> Background is %d \n",Background); - - Double_t Pt_Mixed1, Pt_Mixed2; - Double_t Y_Mixed1, Y_Mixed2; - Double_t Phi_Mixed1, Phi_Mixed2; - - for(iEvent=0; iEvent>> Background Event %d \n",iEvent); - Pt_Mixed1 = h_Pt->GetRandom(); - Pt_Mixed2 = h_Pt->GetRandom(); - h_Peta_Phi->GetRandom2(Phi_Mixed1, Y_Mixed1); - h_Peta_Phi->GetRandom2(Phi_Mixed2, Y_Mixed2); - P_photonMixed1.SetPtEtaPhiM( Pt_Mixed1, Y_Mixed1, Phi_Mixed1, 0.0); - P_photonMixed2.SetPtEtaPhiM( Pt_Mixed2, Y_Mixed2, Phi_Mixed2, 0.0); - Asymmetry = TMath::Abs((P_photonMixed1.E()-P_photonMixed2.E())/(P_photonMixed1.E()+P_photonMixed2.E())); - - if ( (P_photonMixed1.DeltaR(P_photonMixed2) > RelativeRCut) && - (Asymmetry < AsymmetryCut ) ) - { - invariant_mass_mixed = (P_photonMixed1 + P_photonMixed2).M(); - h_Minv_lowpT_back->Fill(invariant_mass_mixed, (P_photonMixed1 + P_photonMixed2).Pt() ); - h_Minv_highpT_back->Fill(invariant_mass_mixed,(P_photonMixed1 + P_photonMixed2).Pt() ); - } - } - printf (">>> Background calculation finished ! \n"); - - char outputname[80]; - sprintf(outputname,"%s.Minv%s",filename,opt); - TFile output(outputname,"recreate"); - h_Minv_lowpT->Write(); - h_Minv_highpT->Write(); - h_Minv_lowpT_back->Write(); - h_Minv_highpT_back->Write(); - h_Pseudoeta->Write(); - h_Pt->Write(); - h_Peta_Pt->Write(); - h_Phi->Write(); - h_Peta_Phi->Write(); - h_Dispersion->Write(); - h_Type->Write(); - h_Asymmetry->Write(); - h_DeltaR->Write(); - - output.Close(); -} - - -void AnaPtSpectrum(char * filename, Int_t NumberPerPtBin, Option_t * particle, Option_t * opt) -{ - - Int_t NumberOfPtBins = NumberPerPtBin; - Float_t PtCalibration = 0.250; - - TFile * in = new TFile(filename); - - TH2F * h_Minv_pT = 0; - TH2F * h_Minv_pT_back = 0; - TH2F * frame = 0 ; - - if (strstr(opt,"low")) - { - h_Minv_pT = (TH2F *) in->Get("h_Minv_lowpT"); ; - h_Minv_pT_back = (TH2F *) in->Get("h_Minv_lowpT_back"); - PtCalibration = 0.250; - frame = new TH2F("PtSpectrumlow","Pt Spectrum low",10, 0.,10.,10,0.1,10000); - } - if (strstr(opt,"high")) - { - h_Minv_pT = (TH2F *) in->Get("h_Minv_highpT"); ; - h_Minv_pT_back = (TH2F *) in->Get("h_Minv_highpT_back"); - PtCalibration = 2.5; - frame = new TH2F("PtSpectrumhigh","Pt Spectrum high",10, 0.,100.,10,0.1,10000); - } - - if ( h_Minv_pT == 0 ) - { - printf(">>> Bad Option! \n"); - return; - } - Int_t Norma_1 = 100; Float_t Norma_minv_1 = 0.2; - Int_t Norma_2 = 200; Float_t Norma_minv_2 = 0.4; - - Int_t Minv_1 = 46; - Int_t Minv_2 = 76; - if (strstr(particle,"eta")) - { - Minv_1 = 214; - Minv_2 = 314; - } - - if (strstr(particle,"norma")) - { - Minv_1 = 100; - Minv_2 = 200; - } - - Int_t NHistos = 40/NumberOfPtBins; - Int_t iHistos; - - TH1D * signal = 0; - TH1D * background = 0; - TH1D * ratio = 0; - TH1D * difference = 0; - - Float_t Pt[NHistos]; - Float_t PtError[NHistos]; - Float_t Nmesons[NHistos]; - Float_t NmesonsError[NHistos]; - - Float_t Ntota, Nback, Norma, NormaError, Renorma; - - for(iHistos=0; iHistosProjectionX("signal", NumberOfPtBins*iHistos+1,NumberOfPtBins*(iHistos+1)); - background = h_Minv_pT_back->ProjectionX("background",NumberOfPtBins*iHistos+1,NumberOfPtBins*(iHistos+1)); - - ratio = new TH1D(*signal); - ratio->Sumw2(); - ratio->Add(background,-1.0); - ratio->Divide(background); - difference = new TH1D(*signal); - difference->Sumw2(); - ratio->Fit("pol0","","",Norma_minv_1,Norma_minv_2); - if (background->Integral(Norma_1,Norma_2) == 0) - Renorma = 0.; - else - Renorma = signal->Integral(Norma_1,Norma_2)/background->Integral(Norma_1,Norma_2); - difference->Add(background,(-1.)*Renorma); - - - Ntota = signal->Integral(Minv_1,Minv_2); - Nback = background->Integral(Minv_1,Minv_2); - Norma = ratio->GetFunction("pol0")->GetParameter(0); - if (Renorma == 0.) - NormaError = 0.; - else - NormaError = ratio->GetFunction("pol0")->GetParError(0); - printf("Ntotal %f Nback %f Norma %f and NormaError %f \n",Ntota, Nback, Norma, NormaError); - printf("differencia is %f \n",difference->Integral(Minv_1,Minv_2)); - Nmesons[iHistos] = Ntota - Renorma * Nback; - NmesonsError[iHistos] = TMath::Sqrt( Ntota + Nback*Renorma*Renorma + Nback*Nback*NormaError*NormaError ); - Pt[iHistos] = (iHistos+0.5)*NumberOfPtBins*PtCalibration; - PtError[iHistos] = NumberOfPtBins*PtCalibration/2.; - - } - - char filenameout[80]; - sprintf(filenameout,"%s.PtSpectrum_%d_%s_%s",filename, NumberPerPtBin, particle, opt); - TFile out(filenameout,"recreate"); - TGraphErrors * PtSpectrum = new TGraphErrors(NHistos, Pt, Nmesons, PtError, NmesonsError); - PtSpectrum->SetName("PtSpectrum"); - PtSpectrum->Write(); - out.Close(); - - frame->Draw(); - frame->SetStats(0); - frame->SetXTitle("Neutral meson pT (GeV/c)"); - frame->SetYTitle("Number of neutral mesons per pT bin"); - PtSpectrum->SetMarkerStyle(27); - PtSpectrum->Draw("P"); - - -} diff --git a/PHOS/ConfigTestSuite.C b/PHOS/ConfigTestSuite.C new file mode 100644 index 00000000000..1b9d5788384 --- /dev/null +++ b/PHOS/ConfigTestSuite.C @@ -0,0 +1,413 @@ +static Int_t eventsPerRun = 100; +enum PprGeo_t +{ + kHoles, kNoHoles +}; +static PprGeo_t geo = kHoles; + +void Config() +{ + // 7-DEC-2000 09:00 + // Switch on Transition Radiation simulation. 6/12/00 18:00 + // iZDC=1 7/12/00 09:00 + // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00 + // Theta range given through pseudorapidity limits 22/6/2001 + + // Set Random Number seed + // AliLoader::SetDebug(5) ; + gRandom->SetSeed(12345); + + + // libraries required by geant321 + gSystem->Load("libgeant321"); + + new TGeant3("C++ Interface to Geant3"); + + if (!gSystem->Getenv("CONFIG_FILE")) + { + cout<<"Config.C: Creating Run Loader ..."<Fatal("Config.C","Can not instatiate the Run Loader"); + return; + } + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(1000); + gAlice->SetRunLoader(rl); + } + + TGeant3 *geant3 = (TGeant3 *) gMC; + + // + // Set External decayer + TVirtualMCDecayer *decayer = new AliDecayerPythia(); + + decayer->SetForceDecay(kAll); + decayer->Init(); + gMC->SetExternalDecayer(decayer); + // + // + //======================================================================= + // ******* GEANT STEERING parameters FOR ALICE SIMULATION ******* + geant3->SetTRIG(1); //Number of events to be processed + geant3->SetSWIT(4, 10); + geant3->SetDEBU(0, 0, 1); + //geant3->SetSWIT(2,2); + geant3->SetDCAY(1); + geant3->SetPAIR(1); + geant3->SetCOMP(1); + geant3->SetPHOT(1); + geant3->SetPFIS(0); + geant3->SetDRAY(0); + geant3->SetANNI(1); + geant3->SetBREM(1); + geant3->SetMUNU(1); + geant3->SetCKOV(1); + geant3->SetHADR(1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3) + geant3->SetLOSS(2); + geant3->SetMULS(1); + geant3->SetRAYL(1); + geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0) + geant3->SetABAN(0); //Restore 3.16 behaviour for abandoned tracks + geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2) + geant3->SetERAN(5.e-7); + + Float_t cut = 1.e-3; // 1MeV cut by default + Float_t tofmax = 1.e10; + + // GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX + geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, cut, + tofmax); + // + //======================================================================= + // ************* STEERING parameters FOR ALICE SIMULATION ************** + // --- Specify event type to be tracked through the ALICE setup + // --- All positions are in cm, angles in degrees, and P and E in GeV + if (gSystem->Getenv("CONFIG_NPARTICLES")) + { + int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES")); + } else + { + int nParticles = 10; + } + // AliGenCocktail *gener = new AliGenCocktail(); +// gener->SetPhiRange(220, 320); +// // Set pseudorapidity range from -8 to 8. +// Float_t thmin = EtaToTheta(0.12); // theta min. <---> eta max +// Float_t thmax = EtaToTheta(-0.12); // theta max. <---> eta min +// gener->SetThetaRange(thmin,thmax); +// gener->SetOrigin(0, 0, 0); //vertex position +// gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position + +// AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles); +// hijingparam->SetMomentumRange(0.2, 999); +// gener->AddGenerator(hijingparam,"HIJING PARAM",1); + +// AliGenBox *genbox = new AliGenBox(nParticles); +// genbox->SetPart(22); +// genbox->SetPtRange(0.3, 10.00); +// gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1); +// gener->Init(); + + AliGenBox *gener = new AliGenBox(1); + gener->SetMomentumRange(10,11.); + gener->SetPhiRange(270.5,270.7); + gener->SetThetaRange(90.5,90.7); + + gener->SetOrigin(0,0,0); //vertex position + gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position + gener->SetPart(22); + gener->Init(); + + // + // Activate this line if you want the vertex smearing to happen + // track by track + // + //gener->SetVertexSmear(perTrack); + // Field (L3 0.4 T) + AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1); + gAlice->SetField(field); + + + Int_t iABSO = 0; + Int_t iDIPO = 0; + Int_t iFMD = 0; + Int_t iFRAME = 0; + Int_t iHALL = 0; + Int_t iITS = 0; + Int_t iMAG = 0; + Int_t iMUON = 0; + Int_t iPHOS = 1; + Int_t iPIPE = 0; + Int_t iPMD = 0; + Int_t iRICH = 0; + Int_t iSHIL = 0; + Int_t iSTART = 0; + Int_t iTOF = 0; + Int_t iTPC = 0; + Int_t iTRD = 0; + Int_t iZDC = 0; + Int_t iEMCAL = 0; + Int_t iCRT = 0; + Int_t iVZERO = 0; + rl->CdGAFile(); + //=================== Alice BODY parameters ============================= + AliBODY *BODY = new AliBODY("BODY", "Alice envelop"); + + if (iMAG) + { + //=================== MAG parameters ============================ + // --- Start with Magnet since detector layouts may be depending --- + // --- on the selected Magnet dimensions --- + AliMAG *MAG = new AliMAG("MAG", "Magnet"); + } + + + if (iABSO) + { + //=================== ABSO parameters ============================ + AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber"); + } + + if (iDIPO) + { + //=================== DIPO parameters ============================ + + AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2"); + } + + if (iHALL) + { + //=================== HALL parameters ============================ + + AliHALL *HALL = new AliHALL("HALL", "Alice Hall"); + } + + + if (iFRAME) + { + //=================== FRAME parameters ============================ + + AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame"); + if (geo == kHoles) { + FRAME->SetHoles(1); + } else { + FRAME->SetHoles(0); + } + } + + if (iSHIL) + { + //=================== SHIL parameters ============================ + + AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2"); + } + + + if (iPIPE) + { + //=================== PIPE parameters ============================ + + AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe"); + } + + if(iITS) { + + //=================== ITS parameters ============================ + // + // As the innermost detector in ALICE, the Inner Tracking System "impacts" on + // almost all other detectors. This involves the fact that the ITS geometry + // still has several options to be followed in parallel in order to determine + // the best set-up which minimizes the induced background. All the geometries + // available to date are described in the following. Read carefully the comments + // and use the default version (the only one uncommented) unless you are making + // comparisons and you know what you are doing. In this case just uncomment the + // ITS geometry you want to use and run Aliroot. + // + // Detailed geometries: + // + // + //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services"); + // + //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services"); + // + AliITSvPPRasymm *ITS = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services"); + ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer + ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer + // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer + ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300] + ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300] + ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300] + ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300] + ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out + ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon + // + //AliITSvPPRsymm *ITS = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services"); + //ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer + //ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer + //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer + //ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300] + //ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300] + //ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300] + //ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300] + //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out + //ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon + // + // + // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful + // for reconstruction !): + // + // + //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services"); + //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out + //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon + // + //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services"); + //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out + //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon + // + // + // + // Geant3 <-> EUCLID conversion + // ============================ + // + // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and + // media to two ASCII files (called by default ITSgeometry.euc and + // ITSgeometry.tme) in a format understandable to the CAD system EUCLID. + // The default (=0) means that you dont want to use this facility. + // + ITS->SetEUCLID(0); + } + + if (iTPC) + { + //============================ TPC parameters ================================ + // --- This allows the user to specify sectors for the SLOW (TPC geometry 2) + // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper) + // --- sectors are specified, any value other than that requires at least one + // --- sector (lower or upper)to be specified! + // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0) + // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0) + // --- SecLows - number of lower sectors specified (up to 6) + // --- SecUps - number of upper sectors specified (up to 12) + // --- Sens - sensitive strips for the Slow Simulator !!! + // --- This does NOT work if all S or L-sectors are specified, i.e. + // --- if SecAL or SecAU < 0 + // + // + //----------------------------------------------------------------------------- + + // gROOT->LoadMacro("SetTPCParam.C"); + // AliTPCParam *param = SetTPCParam(); + AliTPC *TPC = new AliTPCv2("TPC", "Default"); + + // All sectors included + TPC->SetSecAU(-1); + TPC->SetSecAL(-1); + } + + + if (iTOF) { + if (geo == kHoles) { + //=================== TOF parameters ============================ + AliTOF *TOF = new AliTOFv2FHoles("TOF", "TOF with Holes"); + } else { + AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF"); + } + } + + + if (iRICH) + { + //=================== RICH parameters =========================== + AliRICH *RICH = new AliRICHv3("RICH", "normal RICH"); + + } + + + if (iZDC) + { + //=================== ZDC parameters ============================ + + AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC"); + } + + if (iTRD) + { + //=================== TRD parameters ============================ + + AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator"); + + // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2) + TRD->SetGasMix(1); + if (geo == kHoles) { + // With hole in front of PHOS + TRD->SetPHOShole(); + // With hole in front of RICH + TRD->SetRICHhole(); + } + // Switch on TR + AliTRDsim *TRDsim = TRD->CreateTR(); + } + + if (iFMD) + { + //=================== FMD parameters ============================ + AliFMD *FMD = new AliFMDv1("FMD", "normal FMD"); + FMD->SetRingsSi1(256); + FMD->SetRingsSi2(128); + FMD->SetSectorsSi1(20); + FMD->SetSectorsSi2(40); + } + + if (iMUON) + { + //=================== MUON parameters =========================== + + AliMUON *MUON = new AliMUONv1("MUON", "default"); + } + //=================== PHOS parameters =========================== + + if (iPHOS) + { + AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP"); + } + + + if (iPMD) + { + //=================== PMD parameters ============================ + AliPMD *PMD = new AliPMDv1("PMD", "normal PMD"); + } + + if (iSTART) + { + //=================== START parameters ============================ + AliSTART *START = new AliSTARTv1("START", "START Detector"); + } + + if (iEMCAL) + { + //=================== EMCAL parameters ============================ + AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a"); + } + + if (iCRT) + { + //=================== CRT parameters ============================ + AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE"); + } + + if (iVZERO) + { + //=================== CRT parameters ============================ + AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO"); + } + +} + +Float_t EtaToTheta(Float_t arg){ + return (180./TMath::Pi())*2.*atan(exp(-arg)); +} diff --git a/PHOS/ConvertPHOSToNewIO.C b/PHOS/ConvertPHOSToNewIO.C new file mode 100644 index 00000000000..9487b8265dd --- /dev/null +++ b/PHOS/ConvertPHOSToNewIO.C @@ -0,0 +1,1168 @@ +#ifndef __MAKECINT__ + #ifndef __CINT__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "AliMC.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "AliModule.h" +#include "AliRunLoader.h" +#include "AliHeader.h" +#include "AliDetector.h" +#include "AliConfig.h" +#include "AliRun.h" +#include "AliRunLoader.h" +#include +#include "TBranchClones.h" +#include "TBranchElement.h" + +#include "PHOS/AliPHOSClusterizerv1.h" +#include "PHOS/AliPHOSDigitizer.h" +#include "PHOS/AliPHOSSDigitizer.h" +#include "PHOS/AliPHOSTrackSegmentMakerv1.h" +#include "PHOS/AliPHOSPIDv1.h" + + #endif +#endif + +void ConvertPHOSToNewIO(const char* name = "galice.root", TString branch ="Event" ) +{ +// AliLoader::SetDebug(); + AliConfig* conf = AliConfig::Instance(); + TClass* detclass = AliDetector::Class(); + void * pbuf[100]; + TBranch* branches[100]; + Int_t nbranches = 0; +// AliLoader::SetDebug(5); + AliRunLoader* rl = AliRunLoader::Open("galiceNewIO.root",branch,"recreate"); + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(1000); + + AliRun* outAliRun; + + if (gAlice == 0x0) + { + outAliRun = new AliRun("OutgAlice","Output gAlice"); + } + else + { + outAliRun = gAlice; + } + gAlice = 0x0; + + outAliRun->SetRunLoader(rl); + TString fSdig = "PHOS.SDigits."+branch+".root"; + TString fDig = "PHOS.Digits."+branch+".root"; + TString fRec = "PHOS.RecData."+branch+".root"; + + TFile* insdfile = TFile::Open(fSdig); + TFile* indigfile = TFile::Open(fDig); + TFile* inrecfile = TFile::Open(fRec); + TFile* infile = TFile::Open(name); + + if (infile == 0x0) + { + ::Error("ConvertToNewIO.C","Can not open input file %s",name); + return; + } + + AliRun* inAliRun = (AliRun*)infile->Get("gAlice"); + + if(inAliRun == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find gAlice in input file"); + return; + } + gAlice = inAliRun; + + TObjArray* modules = inAliRun->Modules(); + if (modules == 0x0) + { + ::Error("ConvertToNewIO.C","Can not get array with modules from AliRun"); + return; + } + TIter next(modules); + AliModule* module; + while ((module = (AliModule*)next())) + { + outAliRun->AddModule(module); + + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + if (det) + { + ////::Info("ConvertToNewIO.C"," Adding %s to RL.",det->GetName()); + conf->Add(det,branch); + rl->AddLoader(det); + } + } + + TParticle* particleBuffer = new TParticle(); + /***************************************************/ + /**** Event to Event **************/ + /***************************************************/ + + TTree* treeE = (TTree*)infile->Get("TE"); + + if (treeE == 0x0) + { + ::Error("ConvertToNewIO.C","Can not get TreeE from AliRun"); + return; + } + rl->MakeTree("E"); + + AliHeader* inheader = new AliHeader(); + treeE->SetBranchAddress("Header",&inheader); + + Int_t nevents = (Int_t)treeE->GetEntries(); + for (Int_t i = 0; iSetEventNumber(i); + treeE->GetEvent(i); + /*****************************************/ + /* H E A D E R */ + /*****************************************/ + + ////::Info("ConvertToNewIO.C","Copying Header"); + AliHeader* outheader = rl->GetHeader(); + + outheader->SetEvent(inheader->GetEvent()); + outheader->SetNvertex(inheader->GetNvertex()); + outheader->SetNprimary(inheader->GetNprimary()); + outheader->SetNtrack(inheader->GetNtrack()); + outheader->SetRun(inheader->GetRun()); + outheader->SetEventNrInRun(inheader->GetEventNrInRun()); + outheader->SetStack(inheader->Stack()); + outheader->SetGenEventHeader(inheader->GenEventHeader()); + rl->TreeE()->Fill(); + rl->SetNumberOfEventsPerFile(1000); + /*****************************************/ + /* K I N E M A T I C S */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying Kinematics."); + TString treeKname("TreeK"); + treeKname+=i; + TTree* treeK = (TTree*)infile->Get(treeKname); + if (treeK) + { + if (treeK->GetEntries() > 0) + { + //I do this gimnastics to set directory correctly, without changing NewIO code + //only for this purpose + rl->SetNumberOfEventsPerFile(1000); + rl->LoadKinematics("update"); + rl->MakeTree("K"); + rl->GetEventFolder()->Remove(rl->TreeK()); + delete rl->TreeK(); + + treeK->SetBranchAddress("Particles",&particleBuffer); + ////::Info("ConvertToNewIO.C","Cloning TreeK ..."); + TTree* tk = treeK->CloneTree(); + ////::Info("ConvertToNewIO.C","Cloning TreeK ... Done"); + tk->SetName(AliRunLoader::fgkKineContainerName); + rl->GetEventFolder()->Add(tk); + rl->WriteKinematics("OVERWRITE"); + rl->UnloadKinematics(); + } + else + { + Info("ConvertToNewIO.C","Kinematics Tree is Empty"); + } + } + else + { + Error("ConvertToNewIO.C","Could not find Kinematics tree named %s",treeKname.Data()); + } + delete treeK; + /*****************************************/ + /* T R A C K R E F E R E N C E S */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying Track Refs."); + TString treeTRname("TreeTR"); + treeTRname+=i; + TTree* treeTR = (TTree*)infile->Get(treeTRname); + if (treeTR) + { + if (treeTR->GetEntries() > 0) + { + next.Reset(); + while ((module = (AliModule*)next())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + if (det) + { + TClonesArray* trbuffer = new TClonesArray("AliTrackReference", 100); + treeTR->SetBranchAddress(det->GetName(),&trbuffer); + } + } + + //I do this gimnastics to set directory correctly, without changing NewIO code + //only for this purpose + rl->SetNumberOfEventsPerFile(1000); + rl->LoadTrackRefs("update"); + rl->MakeTrackRefsContainer(); + rl->GetEventFolder()->Remove(rl->TreeTR()); + delete rl->TreeTR(); + + ////::Info("ConvertToNewIO.C","Cloning TreeTR ..."); + TTree* tr = treeTR->CloneTree(); + ////::Info("ConvertToNewIO.C","Cloning TreeTR ... Done"); + + tr->SetName(AliRunLoader::fgkTrackRefsContainerName); + rl->GetEventFolder()->Add(tr); + rl->WriteTrackRefs("OVERWRITE"); + rl->UnloadTrackRefs(); + } + else + { + Info("ConvertToNewIO.C","Track References Tree is Empty"); + } + } + else + { + Error("ConvertToNewIO.C","Could not find Track Refs tree named %s",treeTRname.Data()); + } + delete treeTR; + + /*****************************************/ + /* H I T S */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying Hits."); + TString treeHname("TreeH"); + treeHname+=i; + TTree* treeH = (TTree*)infile->Get(treeHname); + + if (treeH) + { + if (treeH->GetEntries() > 0) + { + TObjArray* lob = treeH->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + //TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadHits("update"); + loader->MakeTree("H"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + //::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray *ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + //::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + //::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeH()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + //::Info("ConvertToNewIO.C","Class Nmme is %s",branch->GetClassName()); + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + if (bcl == 0x0) + { + ::Error("ConvertToNewIO.C","Can not get TClass object of class named %s",branch->GetClassName()); + continue; + } + pbuf[nbranches] = bcl->New(); + //::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + //::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + //::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeH()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + Int_t nentr = (Int_t)treeH->GetEntries(); + //::Info("ConvertToNewIO.C","Copying Hits . Number of entries %d ... ",nentr); + + + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + //printf("%d\n",e); + treeH->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { + //printf("Branch %d addr %#x\n",l,pbuf[l]); + //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + //printf("Filling %s\n",loader->GetName()); + loader->TreeH()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + ////::Info("ConvertToNewIO.C","Copying Hits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteHits("OVERWRITE"); + loader->UnloadHits(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + } + else //tree has any entries + { + Info("ConvertToNewIO.C","Hits Tree is Empty"); + } + } + else //treeH + { + ::Warning("ConvertToNewIO.C","Could not get TreeH from in AliRun."); + } + delete treeH; + + /*****************************************/ + /* S D i g i t s */ + /*****************************************/ + //::Info("ConvertToNewIO.C","Copying S Digits.\n\n\n"); + TString treeSname("TreeS"); + treeSname+=i; + + TTree* treeS = (TTree*)insdfile->Get(treeSname); + if (treeS) + { + TObjArray* lob = treeS->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + //TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadSDigits("update"); + loader->MakeTree("S"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + //::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray * ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + //::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + //::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeS()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + //::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + //::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + //::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeS()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + TBranch* bbb = treeS->GetBranch("PHOS"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying SDigits. Number of entries in PHSO branch %d ... ",nentr); + + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + ////printf("%d\r",e); +// treeS->GetEntry(e); + bbb->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// //printf("Filling %s\n",loader->GetName()); + loader->TreeS()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + ////::Info("ConvertToNewIO.C","Copying SDigits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteSDigits("OVERWRITE"); + loader->UnloadSDigits(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + + } + else //treeS + { + ::Warning("ConvertToNewIO.C","Could not get TreeS from in AliRun."); + } + delete treeS; + + /*****************************************/ + /* D i g i t s */ + /*****************************************/ + //::Info("ConvertToNewIO.C","Copying Digits.\n\n\n"); + TString treeDname("TreeD"); + treeDname+=i; + + TTree* treeD = (TTree*)indigfile->Get(treeDname); + if (treeD) + { + TObjArray* lob = treeD->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + //TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadDigits("update"); + loader->MakeTree("D"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray * ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeD()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ////::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + ////::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeD()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + TBranch* bbb = treeD->GetBranch("PHOS"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying Digits. Number of entries %d ... ",nentr); + + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + ////printf("%d\r",e); + //treeD->GetEntry(e); + bbb->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// //printf("Filling %s\n",loader->GetName()); + loader->TreeD()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + ////::Info("ConvertToNewIO.C","Copying Digits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteDigits("OVERWRITE"); + loader->UnloadDigits(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + } + else //treeD + { + ::Warning("ConvertToNewIO.C","Could not get TreeD from in AliRun."); + } + delete treeD; + + + /*****************************************/ + /* R e c P o i n t s */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying RecPoints."); + TString treeRname("TreeR"); + treeRname+=i; + + TTree* treeR = (TTree*)inrecfile->Get(treeRname); + if (treeR) + { + TObjArray* lob = treeR->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadRecPoints("update"); + loader->MakeTree("R"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + + TString bname(branch->GetName());// + if ( bname.Contains(det->GetName()) ) + { + if(bname.Contains("Emc")||bname.Contains("Cpv")) + { + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray * ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeR()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ////::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + ////::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeR()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + TBranch* bbb = treeR->GetBranch("PHOSEmcRP"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying RecPoints. Number of entries %d ... ",nentr); + + + //Int_t nl = loaders->GetEntries(); + // //printf(">>>>>>>>>>>>>>>>>>>>%d\n",nl); + bbb->SetAddress(&(pbuf[0])); + + for (Int_t e = 0; e < nentr; e++) + { + ////printf("%d\r",e); + + bbb->GetEntry(e); + AliLoader* loader = (AliLoader*)loaders->At(0); + + TBranch* bbb = treeR->GetBranch("PHOSCpvRP"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying RecPoints. Number of entries %d ... ",nentr); + + bbb->SetAddress(&(pbuf[1])); + + for (Int_t e = 0; e < nentr; e++) + { + // //printf("%d\r",e); + bbb->GetEntry(e); + // AliLoader* loader = (AliLoader*)loaders->At(0); + } + ////printf("Filling %s\n",loader->GetName()); + loader->TreeR()->Fill(); + + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + + ////::Info("ConvertToNewIO.C","Copying RecPoints ... Done"); + Int_t nl = loaders->GetEntries(); + for (Int_t l = 0; l < nl; l++) + { + + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteRecPoints("OVERWRITE"); + loader->UnloadRecPoints(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l];//delete branches buffers + } + nbranches = 0; + + } + else //treeR + { + ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun."); + } + delete treeR; + + /*****************************************/ + /* Track Segments */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying Tracks."); + TString treeTname("TreeR"); + treeTname+=i; + + TTree* treeT = (TTree*)inrecfile->Get(treeTname); + if (treeT) + { + TObjArray* lob = treeT->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + //TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadTracks("update"); + loader->MakeTree("T"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + + TString bname(branch->GetName());// + if ( bname.Contains(det->GetName()) ) + { + if(bname.Contains("TS")) + { + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray * ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeT()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ////::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + ////::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeT()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + TBranch* bbb = treeT->GetBranch("PHOSTS"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying Tracks. Number of entries %d ... ",nentr); + + + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + // //printf("%d\r",e); + //bbb->GetEntry(e); + //treeR->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { + // //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + bbb->GetEntry(e); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + ////printf("Filling %s\n",loader->GetName()); + loader->TreeT()->Fill(); + } + + + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + ////::Info("ConvertToNewIO.C","Copying Tracks ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteTracks("OVERWRITE"); + loader->UnloadTracks(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l];//delete branches buffers + } + nbranches = 0; + + } + else //treeT + { + ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun."); + } + delete treeT; + + + + + + /*****************************************/ + /* Rec Particles */ + /*****************************************/ + ////::Info("ConvertToNewIO.C","Copying RecParticles."); + TString treePname("TreeR"); + treePname+=i; + + TTree* treeP = (TTree*)inrecfile->Get(treeTname); + if (treeP) + { + TObjArray* lob = treeP->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + //TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadRecParticles("update"); + loader->MakeTree("P"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + + TString bname(branch->GetName());// + if ( bname.Contains(det->GetName()) ) + { + if(bname.Contains("PHOSRP")) + { + ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + TClonesArray * ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeP()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ////::Info("ConvertToNewIO.C","Dumping buffer:"); + //((TObject*)pbuf[nbranches])->Dump(); + ////::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeP()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + TBranch* bbb = treeP->GetBranch("PHOSRP"); + Int_t nentr = (Int_t)bbb->GetEntries(); + ////::Info("ConvertToNewIO.C","Copying RecParticles. Number of entries %d ... ",nentr); + + + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + ////printf("%d\r",e); + bbb->GetEntry(e); + //treeR->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { + // //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + ////printf("Filling %s\n",loader->GetName()); + loader->TreeP()->Fill(); + } + + + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + ////printf("\n"); + + ////::Info("ConvertToNewIO.C","Copying RecParticles ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteRecParticles("OVERWRITE"); + loader->UnloadRecParticles(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l];//delete branches buffers + } + nbranches = 0; + + } + else //treeP + { + ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun."); + } + delete treeP; + + + + }//end of loop over events + /***************************************************/ + /**** Write Tasks *************/ + /***************************************************/ + + AliLoader * loader = rl->GetLoader("PHOSLoader"); + /**** S Digits *************/ + TTree * s = (TTree*)insdfile->Get("TreeS0"); + TBranch * bsd = s->GetBranch("AliPHOSSDigitizer"); + AliPHOSSDigitizer * sdig = 0; + bsd->SetAddress(&sdig); + bsd->GetEntry(0) ; + sdig->SetEventFolderName(sdig->GetName()) ; + sdig->SetName("PHOSSDigitizer"); + sdig->Print() ; + TFile fsd(loader->GetSDigitsFileName(), "update") ; + sdig->Write() ; + fsd.Print() ; + fsd.Close() ; + delete s ; + + /**** Digits *************/ + TTree * d = (TTree*)indigfile->Get("TreeD0"); + TBranch * bd = d->GetBranch("AliPHOSDigitizer"); + AliPHOSDigitizer * dig = 0 ; + bd->SetAddress(&dig) ; + bd->GetEntry(0) ; + dig->SetEventFolderName(dig->GetName()) ; + dig->SetName("PHOSDigitizer"); + dig->Print() ; + //dig->Dump() ; + ////::Info("Digitizer","Print done"); + TFile fd(loader->GetDigitsFileName(), "update") ; + dig->Write() ; + fd.Print() ; + fd.Close() ; + delete d; + /**** Rec Data *************/ + TTree * t = (TTree*)inrecfile->Get("TreeR0"); + /**** Clusterizer *************/ + TBranch * bclu = t->GetBranch("AliPHOSClusterizer"); + AliPHOSClusterizerv1 * clu = 0; + bclu->SetAddress(&clu); + bclu->GetEntry(0) ; + clu->SetEventFolderName(clu->GetName()) ; + clu->SetName("PHOSReconstructioner"); + clu->Print() ; + TFile fclu(loader->GetRecPointsFileName(), "update") ; + clu->Write() ; + fclu.Print() ; + fclu.Close() ; + /**** TrackSegmentMaker *************/ + TBranch * btr = t->GetBranch("AliPHOSTrackSegmentMaker"); + AliPHOSTrackSegmentMakerv1 * tra = 0 ; + btr->SetAddress(&tra); + btr->GetEntry(0) ; + tra->SetEventFolderName(tra->GetName()) ; + tra->SetName("PHOSTracker"); + tra->Print() ; + TFile ftr(loader->GetTracksFileName(), "update") ; + tra->Write() ; + ftr.Print() ; + ftr.Close() ; + + /**** PID *************/ + + TBranch * bpid = t->GetBranch("AliPHOSPID"); + AliPHOSPIDv1 * pid = 0 ; + bpid->SetAddress(&pid); + bpid->GetEntry(0) ; + pid->SetEventFolderName(pid->GetName()) ; + pid->SetName("PHOSPIDTask"); + pid->Print() ; + TFile fpid(loader->GetRecParticlesFileName(), "update") ; + pid->Write() ; + fpid.Print() ; + fpid.Close() ; + delete t; + + + + /***************************************************/ + /**** Run to Run *************/ + /***************************************************/ + + rl->WriteHeader("OVERWRITE"); + + infile->cd(); + TGeometry* geo = inAliRun->GetGeometry(); + rl->CdGAFile(); + geo->Write(); + + rl->WriteAliRun(); + rl->WriteRunLoader(); + + ////::Info("ConvertToNewIO.C","Done"); + +} + diff --git a/PHOS/PHOSLinkDef.h b/PHOS/PHOSLinkDef.h index c156a7a6a4e..d9888ad58e0 100644 --- a/PHOS/PHOSLinkDef.h +++ b/PHOS/PHOSLinkDef.h @@ -5,6 +5,7 @@ #pragma link off all functions; #pragma link C++ class AliPHOSEMCAGeometry+; +#pragma link C++ class AliPHOSCPVBaseGeometry+; #pragma link C++ class AliPHOSCPVGeometry+; #pragma link C++ class AliPHOSSupportGeometry+; #pragma link C++ class AliPHOSGeometry+; @@ -32,8 +33,8 @@ #pragma link C++ class AliPHOSTrackSegmentMakerv1+; #pragma link C++ class AliPHOSRecParticle+; #pragma link C++ class AliPHOSPID+; +#pragma link C++ class AliPHOSLoader+; #pragma link C++ class AliPHOSPIDv0+; -#pragma link C++ class AliPHOSGetter+; #pragma link C++ class AliPHOSAnalyze+; #pragma link C++ class AliPHOSCPVDigit+; #pragma link C++ class AliPHOSQAVirtualCheckable+; @@ -51,14 +52,17 @@ #pragma link C++ class AliPHOSClusterizerv2+; #pragma link C++ class AliPHOSEvalRecPoint+; #pragma link C++ class AliPHOSPIDv1+; +#pragma link C++ class AliPHOSMemoryWatcher+; #pragma link C++ class AliPHOSRaw2Digits+; #pragma link C++ class AliPHOSBeamTestEvent+; +#pragma link C++ class AliPHOSCalibrationDB+; +#pragma link C++ class AliPHOSCalibrationData+; #pragma link C++ class AliPHOSCalibrManager+; -#pragma link C++ class AliPHOSConTableDB+; #pragma link C++ class AliPHOSCalibrator+; -#pragma link C++ class AliPHOSCalibrationData+; -#pragma link C++ class AliPHOSJetFinder+; -#pragma link C++ class AliPHOSJet+; +#pragma link C++ class AliPHOSConTableDB+; +#pragma link C++ class AliPHOSGetter+; #pragma link C++ class AliPHOSFastGlobalReconstruction+; +#pragma link C++ class AliPHOSJet+; +#pragma link C++ class AliPHOSJetFinder+; #endif diff --git a/PHOS/TestSuite.csh b/PHOS/TestSuite.csh new file mode 100755 index 00000000000..6669fabd5cb --- /dev/null +++ b/PHOS/TestSuite.csh @@ -0,0 +1,140 @@ +#! /bin/tcsh -f +# +# Prepare the environment +# +mkdir $HOME/PHOSTestSuite ; cd $HOME/PHOSTestSuite +cp $ALICE_ROOT/PHOS/grunTestSuite.C . +cp $ALICE_ROOT/PHOS/ConfigTestSuite.C . +# +#begin data +set MINHITS=68 +set MAXHITS=72 +set MINSDIGITS=68 +set MAXSDIGITS=72 +set MINDIGITS=44 +set MAXDIGITS=47 +set MINEMCRECPOINTS=1 +set MAXEMCRECPOINTS=2 +set MINCPVRECPOINTS=0 +set MAXCPVRECPOINTS=2 +set MINTRACKSEGMENTS=1 +set MAXTRACKSEGMENTS=2 +set MINRECPARTICLES=1 +set MAXRECPARTICLES=2 +#end data +# +echo PHOS Test Suite run on `date` > TestSuite.log +echo "=======================================================================" >> TestSuite.log +echo AliROOT version `which aliroot` >> TestSuite.log +echo Root version `which root` >> TestSuite.log +echo "=======================================================================" >> TestSuite.log +# +# SIMULATION +# +echo " **** SIMULATION **** " >> TestSuite.log +aliroot -b -q grunTestSuite.C\(100\) >>& TestSuite.log +echo '{ ' > tempo.C +echo " Int_t minhits = $MINHITS ;" >> tempo.C +echo " Int_t maxhits = $MAXHITS ;" >> tempo.C +echo ' AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;' >> tempo.C +echo ' TH1F * hitmul = new TH1F("hitmul", "PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' Int_t max = gime->MaxEvent() ; ' >> tempo.C +echo ' Int_t evt = 0 ; ' >> tempo.C +echo ' for ( evt = 0 ; evt < max ; evt++ ) { ' >> tempo.C +echo ' gime->Event(evt,"H") ; ' >> tempo.C +echo ' hitmul->Fill(gime->Hits()->GetEntries()) ; ' >> tempo.C +echo ' } ' >> tempo.C +echo ' TF1 * gaus = new TF1("gaus", "gaus", 0., 200.) ; ' >> tempo.C +echo ' hitmul->Fit(gaus,"", "", 40, 100) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxhits || gaus->GetParameter(1) < minhits ) ' >> tempo.C +echo ' printf("ERRORSIM 1") ; ' >> tempo.C +echo ' else ' >> tempo.C +echo ' printf("ERRORSIM 0") ; ' >> tempo.C +echo '} ' >> tempo.C +aliroot -b -q tempo.C >>& TestSuite.log +set ERRORSIM = `cat TestSuite.log | grep ERRORSIM | awk '{print $2}'` +if($ERRORSIM) then + echo ERROR + uuencode TestSuite.log TestSuite.log | mail -s 'PHOS INSTALLATION ERROR' yves.schutz@cern.ch + exit(0) +endif +rm tempo.C +# +# RECONSTRUCTION +# +echo " **** RECONSTRUCTION **** " >> TestSuite.log +aliroot -b >>& TestSuite.log < tempo.C +echo " Int_t minsdig = $MINSDIGITS ;" >> tempo.C +echo " Int_t maxsdig = $MAXSDIGITS ;" >> tempo.C +echo " Int_t mindig = $MINDIGITS ;" >> tempo.C +echo " Int_t maxdig = $MAXDIGITS ;" >> tempo.C +echo " Int_t minemcrp = $MINEMCRECPOINTS ;" >> tempo.C +echo " Int_t maxemcrp = $MAXEMCRECPOINTS ;" >> tempo.C +echo " Int_t mincpvrp = $MINCPVRECPOINTS ;" >> tempo.C +echo " Int_t maxcpvrp = $MAXCPVRECPOINTS ;" >> tempo.C +echo " Int_t mints = $MINTRACKSEGMENTS ;" >> tempo.C +echo " Int_t maxts = $MAXTRACKSEGMENTS ;" >> tempo.C +echo " Int_t minpa = $MINRECPARTICLES ;" >> tempo.C +echo " Int_t maxpa = $MAXRECPARTICLES ;" >> tempo.C +echo ' AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;' >> tempo.C +echo ' TH1F * sdigmul = new TH1F("sdigmul", " SDigits PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' TH1F * digmul = new TH1F("digmul", " Digits PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' TH1F * emcrpmul= new TH1F("emcrpmul", " EMCRecPoints PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' TH1F * cpvrpmul= new TH1F("cpvrpmul", " CPVRecPoints PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' TH1F * tsmul = new TH1F("tsmul", " TrackSegments PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' TH1F * pamul = new TH1F("pamul", " RecParticles PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C +echo ' Int_t max = gime->MaxEvent() ; ' >> tempo.C +echo ' Int_t evt = 0 ; ' >> tempo.C +echo ' for ( evt = 0 ; evt < max ; evt++ ) { ' >> tempo.C +echo ' gime->Event(evt,"SDRTP") ; ' >> tempo.C +echo ' sdigmul->Fill(gime->SDigits()->GetEntries()) ; ' >> tempo.C +echo ' digmul->Fill(gime->Digits()->GetEntries()) ; ' >> tempo.C +echo ' emcrpmul->Fill(gime->EmcRecPoints()->GetEntries()) ; ' >> tempo.C +echo ' cpvrpmul->Fill(gime->CpvRecPoints()->GetEntries()) ; ' >> tempo.C +echo ' tsmul->Fill(gime->TrackSegments()->GetEntries()) ; ' >> tempo.C +echo ' pamul->Fill(gime->RecParticles()->GetEntries()) ; ' >> tempo.C +echo ' } ' >> tempo.C +echo ' TF1 * gaus = new TF1("gaus", "gaus", 0., 200.) ; ' >> tempo.C +echo ' sdigmul->Fit(gaus, "", "", 40., 100.) ; ' >> tempo.C +echo ' sdigmul->Draw() ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxsdig || gaus->GetParameter(1) < minsdig ) ' >> tempo.C +echo ' printf("ERRORREC 1 sdigits\n") ; ' >> tempo.C +echo ' digmul->Fit(gaus, "", "", 20., 80.) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxdig || gaus->GetParameter(1) < mindig ) ' >> tempo.C +echo ' printf("ERRORREC 1 digits\n") ; ' >> tempo.C +echo ' emcrpmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxemcrp || gaus->GetParameter(1) < minemcrp ) ' >> tempo.C +echo ' printf("ERRORREC 1 emc recpoints\n") ; ' >> tempo.C +echo ' cpvrpmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxcpvrp || gaus->GetParameter(1) < mincpvrp ) ' >> tempo.C +echo ' printf("ERRORREC 1 cpv recpoints\n") ; ' >> tempo.C +echo ' tsmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxts || gaus->GetParameter(1) < mints ) ' >> tempo.C +echo ' printf("ERRORREC 1 track segments\n") ; ' >> tempo.C +echo ' pamul->Fit(gaus, "", "", 0., 4. ) ; ' >> tempo.C +echo ' if( gaus->GetParameter(1) > maxpa || gaus->GetParameter(1) < minpa ) ' >> tempo.C +echo ' printf("ERRORREC 1 recparticles\n") ; ' >> tempo.C +echo '} ' >> tempo.C +aliroot -b -q tempo.C >>& TestSuite.log +set ERRORREC = `cat TestSuite.log | grep ERRORREC | awk '{print $2}'` +if($ERRORREC) then + echo ERROR + uuencode TestSuite.log TestSuite.log | mail -s 'PHOS INSTALLATION ERROR' yves.schutz@cern.ch + exit(0) +endif +#rm tempo.C +#/cd $HOME +#rm -fr $HOME/PHOSTestSuite diff --git a/PHOS/grunTestSuite.C b/PHOS/grunTestSuite.C new file mode 100644 index 00000000000..cb5ee3ca9c3 --- /dev/null +++ b/PHOS/grunTestSuite.C @@ -0,0 +1,18 @@ +void grunTestSuite (Int_t nevent=3, const char *config="ConfigTestSuite.C") +{ + // + // Simple macro to run aliroot in a batch mode + // + gAlice->Init(config); + TStopwatch timer; + timer.Start(); +// +// If nevent is negative it is assumed that in config the +// global variable eventsPerRun has been set. +// + if (nevent < 0) + nevent = eventsPerRun; + gAlice->Run(nevent); + timer.Stop(); + timer.Print(); +} diff --git a/PHOS/libPHOS.pkg b/PHOS/libPHOS.pkg index edec4acadf8..411af774dbb 100644 --- a/PHOS/libPHOS.pkg +++ b/PHOS/libPHOS.pkg @@ -3,30 +3,27 @@ SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx \ AliPHOSImpact.cxx \ AliPHOSHit.cxx \ AliPHOSGeometry.cxx \ - AliPHOSEMCAGeometry.cxx \ - AliPHOSCPVGeometry.cxx \ - AliPHOSSupportGeometry.cxx \ - AliPHOSCPVDigit.cxx AliPHOSDigit.cxx \ + AliPHOSEMCAGeometry.cxx \ + AliPHOSCPVGeometry.cxx AliPHOSCPVBaseGeometry.cxx \ + AliPHOSSupportGeometry.cxx \ + AliPHOSCPVDigit.cxx AliPHOSDigit.cxx \ AliPHOSRecPoint.cxx AliPHOSEmcRecPoint.cxx \ - AliPHOSCpvRecPoint.cxx \ - AliPHOSClusterizer.cxx AliPHOSClusterizerv1.cxx \ + AliPHOSCpvRecPoint.cxx \ + AliPHOSClusterizer.cxx AliPHOSClusterizerv1.cxx \ AliPHOSLink.cxx AliPHOSSDigitizer.cxx AliPHOSDigitizer.cxx\ - AliPHOSReconstructioner.cxx AliPHOSTrackSegment.cxx \ + AliPHOSReconstructioner.cxx AliPHOSTrackSegment.cxx \ AliPHOSTrackSegmentMaker.cxx AliPHOSTrackSegmentMakerv1.cxx \ AliPHOSRecParticle.cxx AliPHOSPID.cxx AliPHOSPIDv0.cxx \ AliPHOSAnalyze.cxx AliPHOSFastRecParticle.cxx \ - AliPHOSGetter.cxx AliPHOSTick.cxx \ - AliPHOSQAVirtualCheckable.cxx AliPHOSQAIntCheckable.cxx \ + AliPHOSTick.cxx \ + AliPHOSQAVirtualCheckable.cxx AliPHOSQAIntCheckable.cxx \ AliPHOSQAFloatCheckable.cxx\ AliPHOSQAObjectCheckable.cxx AliPHOSQAChecker.cxx AliPHOSQAMeanChecker.cxx AliPHOSQAAlarm.cxx \ AliPHOSIhepAnalyze.cxx AliPHOSEvalRecPoint.cxx \ AliPHOSRecManager.cxx AliPHOSRecCpvManager.cxx AliPHOSRecEmcManager.cxx \ - AliPHOSClusterizerv2.cxx AliPHOSPIDv1.cxx \ - AliPHOSRaw2Digits.cxx AliPHOSBeamTestEvent.cxx \ - AliPHOSCalibrManager.cxx \ - AliPHOSConTableDB.cxx AliPHOSCalibrator.cxx\ - AliPHOSCalibrationData.cxx AliPHOSJet.cxx AliPHOSJetFinder.cxx \ - AliPHOSFastGlobalReconstruction.cxx + AliPHOSClusterizerv2.cxx AliPHOSPIDv1.cxx AliPHOSMemoryWatcher.cxx AliPHOSJet.cxx AliPHOSJetFinder.cxx\ + AliPHOSLoader.cxx AliPHOSRaw2Digits.cxx AliPHOSBeamTestEvent.cxx AliPHOSCalibrationDB.cxx AliPHOSCalibrationData.cxx\ + AliPHOSCalibrator.cxx AliPHOSCalibrManager.cxx AliPHOSConTableDB.cxx AliPHOSFastGlobalReconstruction.cxx AliPHOSGetter.cxx HDRS:= $(SRCS:.cxx=.h) @@ -36,3 +33,4 @@ DHDR= PHOSLinkDef.h + diff --git a/PHOS/test.C b/PHOS/test.C index 2b443835150..cf2038e1824 100644 --- a/PHOS/test.C +++ b/PHOS/test.C @@ -1,6 +1,6 @@ void test (Int_t nevent=1) { gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I."); - gROOT->ProcessLine(".x $ALICE_ROOT/PHOS/testsim.C(nevent)") ; - gROOT->ProcessLine(".x $ALICE_ROOT/PHOS/testsimglobal.C++") ; + gROOT->ProcessLine(".x testsim.C(nevent)") ; + gROOT->ProcessLine(".x testsimglobal.C++") ; } diff --git a/PHOS/testconfig.C b/PHOS/testconfig.C index befc147a5c2..208dc677d04 100644 --- a/PHOS/testconfig.C +++ b/PHOS/testconfig.C @@ -11,11 +11,23 @@ void Config() TDatime dat ; gRandom->SetSeed(dat.GetTime()); - gSystem->Load("libgeant321.so") ; - new TGeant3("C++ Interface to Geant3"); + new AliGeant3("C++ Interface to Geant3"); + AliRunLoader* rl; + if (!gSystem->Getenv("CONFIG_FILE")) + { + cout<<"Config.C: Creating Run Loader ..."<Fatal("Config.C","Can not instatiate the Run Loader"); + return; + } + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(2); + gAlice->SetRunLoader(rl); + } - TFile *rootfile = new TFile("testPHOS.root", "recreate"); - rootfile->SetCompressionLevel(2); TGeant3 *geant3 = (TGeant3 *) gMC; @@ -67,7 +79,6 @@ void Config() int nParticles = 1; AliGenBox *gener = new AliGenBox(nParticles); - gener->SetPart(22) ; gener->SetPtRange(9.99, 10.00); gener->SetPhiRange(220, 320); @@ -92,18 +103,25 @@ void Config() AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP"); - AliPHOSGetter * gime = AliPHOSGetter::GetInstance("aliroot") ; - AliPHOSQAMeanChecker * hm = static_castgime->QATasks("HitsMul"); - AliPHOSQAMeanChecker * te = static_castgime->QATasks("TotEner"); - AliPHOSQAMeanChecker * hmB = static_castgime->QATasks("HitsMulB"); - AliPHOSQAMeanChecker * teB = static_castgime->QATasks("TotEnerB"); + + AliPHOSLoader* gim = 0x0; + + cout<<"0: "<MakeLoader(rl->GetEventFolder()->GetName()); + + cout<<"1: "<gim->QAtask("HitsMul"); + AliPHOSQAMeanChecker * te = static_castgim->QAtask("TotEner"); + AliPHOSQAMeanChecker * hmB = static_castgim->QAtask("HitsMulB"); + AliPHOSQAMeanChecker * teB = static_castgim->QAtask("TotEnerB"); hm->Set(62.18, 23.81) ; hm->Print() ; te->Set(8.092, 3.06) ; hmB->Set(63.498, 24.348) ; teB->Set(8.363, 3.44) ; - hm->Print("") ; - delete gime; + } Float_t EtaToTheta(Float_t arg){ diff --git a/PHOS/testsim.C b/PHOS/testsim.C index 29ecc21e157..e4dd5dddd4a 100644 --- a/PHOS/testsim.C +++ b/PHOS/testsim.C @@ -1,4 +1,4 @@ -void testsim (Int_t nevent=100, const char *config="$ALICE_ROOT/PHOS/testconfig.C") +void testsim (Int_t nevent=1, const char *config="testconfig.C") { // // Simple macro to run aliroot in a batch mode @@ -18,8 +18,11 @@ void testsim (Int_t nevent=100, const char *config="$ALICE_ROOT/PHOS/testconfig. gAlice->Run(nevent); timer.Stop(); timer.Print(); - cerr<<" ___________________________________________________________________ "< Simulation ended successfully. " << endl ; cerr<<" ___________________________________________________________________ "<MaxEvent() ; - gime->Event(0,"Q") ; + + AliRunLoader* rl = AliRunLoader::Open("testPHOS.root"); + + AliPHOSLoader* gim = (AliPHOSLoader*)rl->GetLoader("PHOSLoader"); + + Int_t maxevent = rl->GetNumberOfEvents() ; + // Examine the alarms - TObjArray * alahm = dynamic_cast(dynamic_cast(gime->Alarms())->FindObject("HitsM")) ; + TObjArray * alahm = dynamic_cast(gime->Alarms()->FindObject("HitsM")) ; Float_t ratiohm = 100.0*static_cast(alahm->GetEntries())/static_cast(maxevent) ; TObjArray * alaet = dynamic_cast(gime->Alarms()->FindObject("TotEn")) ; @@ -179,19 +183,13 @@ Bool_t sim_exam() if (ratiohm > maxAlaHitsM){ error = kTRUE ; - mess = "Examination detected an error in HitsM: "; - mess += ratiohm ; - mess += " > " ; - mess += maxAlaHitsM ; + mess = "Examination detected an error in HitsM." ; write_info(mess) ; } if (ratioet>maxAlaTotEn){ error = kTRUE ; - mess = "Examination detected an error in TotEn: "; - mess += ratioet; - mess += " > "; - mess += maxAlaTotEn; + mess = "Examination detected an error in TotEn." ; write_info(mess) ; } @@ -289,7 +287,7 @@ Bool_t sim_exam() Bool_t sdigit() { //SDigits process - AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ; + const Float_t maxSDigits = 62.89 ; const Float_t widSDigits = TMath::Sqrt(maxSDigits) ; @@ -297,10 +295,11 @@ Bool_t sdigit() TString reconame = "test suite" ; AliPHOSSDigitizer *sd = new AliPHOSSDigitizer("testPHOS.root",reconame.Data()) ; + AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; sd->ExecuteTask("deb") ; - Float_t nSDigits = static_cast((dynamic_cast(gime->SDigitizer()))->GetSDigitsInRun()) / static_cast(gime->MaxEvent()) ; + Float_t nSDigits = static_cast(gime->SDigitizer()->GetSDigitsInRun()) / static_cast(gime->MaxEvent()) ; if ( nSDigits < maxSDigits-widSDigits || nSDigits > maxSDigits+widSDigits ) { mess = "Error detected in the SDigits process. Sending error file to PHOS director." ; @@ -321,7 +320,7 @@ Bool_t digit() //Digits process AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ; TString reconame = "test suite" ; - const Float_t maxDigits = 40. ; + const Float_t maxDigits = 2860. ; const Float_t widDigits = TMath::Sqrt(maxDigits) ; TString mess("") ; @@ -330,7 +329,7 @@ Bool_t digit() d->ExecuteTask("deb") ; - Float_t nDigits = static_cast((dynamic_cast(gime->Digitizer()))->GetDigitsInRun()) / static_cast(gime->MaxEvent()) ; + Float_t nDigits = static_cast(gime->Digitizer()->GetDigitsInRun()) / static_cast(gime->MaxEvent()) ; if ( nDigits < maxDigits-widDigits || nDigits > maxDigits+widDigits ) { cout << "digit() : nDigits = " << nDigits diff --git a/PMD/AliPMD.cxx b/PMD/AliPMD.cxx index 000c07ec7da..bbced5f45e9 100644 --- a/PMD/AliPMD.cxx +++ b/PMD/AliPMD.cxx @@ -13,48 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2002/11/21 22:57:02 alibrary -Removing AliMC and AliMCProcess - -Revision 1.16 2002/01/23 09:36:52 morsch -Don't use shunting if you don't want it ! - -Revision 1.15 2001/05/16 14:57:19 alibrary -New files for folders and Stack - -Revision 1.14 2001/03/12 17:46:22 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.13 2001/01/26 20:02:43 hristov -Major upgrade of AliRoot code - -Revision 1.12 2000/12/04 08:48:18 alibrary -Fixing problems in the HEAD - -Revision 1.11 2000/11/17 10:15:24 morsch -Call to AliDetector::ResetHits() added to method AliPMD::ResetHits() - -Revision 1.10 2000/11/06 09:07:13 morsch -Set fRecPoints to zero in default constructor. - -Revision 1.9 2000/10/30 09:03:59 morsch -Prototype for PMD reconstructed hits (AliPMDRecPoint) added. - -Revision 1.8 2000/10/20 06:24:40 fca -Put the PMD at the right position in the event display - -Revision 1.7 2000/10/02 21:28:12 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/01/19 17:17:06 fca -Introducing a list of lists of hits -- more hits allowed for detector now - -Revision 1.5 1999/09/29 09:24:27 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -80,16 +39,18 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// #include -#include -#include -#include #include #include +#include +#include +#include +#include -#include "AliPMD.h" -#include "AliRun.h" #include "AliConst.h" +#include "AliLoader.h" +#include "AliPMD.h" #include "AliPMDRecPoint.h" +#include "AliRun.h" ClassImp(AliPMD) @@ -275,25 +236,28 @@ void AliPMD::AddRecPoint(const AliPMDRecPoint &p) new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p); } -void AliPMD::MakeBranch(Option_t* option, const char *file) +void AliPMD::MakeBranch(Option_t* option) { // Create Tree branches for the PMD const char *cR = strstr(option,"R"); + const char *cH = strstr(option,"H"); + if (cH && fLoader->TreeH() && (fHits == 0x0)) + fHits = new TClonesArray("AliPMDhit", 405); - AliDetector::MakeBranch(option,file); + AliDetector::MakeBranch(option); - if (cR) { - printf("Make Branch - TreeR address %p\n",gAlice->TreeR()); + if (cR && fLoader->TreeR()) { + printf("Make Branch - TreeR address %p\n",fLoader->TreeR()); const Int_t kBufferSize = 4000; char branchname[30]; sprintf(branchname,"%sRecPoints",GetName()); - if (fRecPoints && gAlice->TreeR()) { - MakeBranchInTree(gAlice->TreeR(), - branchname, &fRecPoints, kBufferSize, file); + if (fRecPoints == 0x0) { + fRecPoints = new TClonesArray("AliPMDRecPoint",10000); } + MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0); } } @@ -302,15 +266,25 @@ void AliPMD::SetTreeAddress() { // Set branch address for the TreeR char branchname[30]; + + if (fLoader->TreeH()) + fHits = new TClonesArray("AliPMDhit", 405); + AliDetector::SetTreeAddress(); TBranch *branch; - TTree *treeR = gAlice->TreeR(); + TTree *treeR = fLoader->TreeR(); sprintf(branchname,"%s",GetName()); - if (treeR && fRecPoints) { - branch = treeR->GetBranch(branchname); - if (branch) branch->SetAddress(&fRecPoints); + if (treeR) { + branch = treeR->GetBranch(branchname); + if (branch) + { + if (fRecPoints == 0x0) { + fRecPoints = new TClonesArray("AliPMDRecPoint",10000); + } + branch->SetAddress(&fRecPoints); + } } } diff --git a/PMD/AliPMD.h b/PMD/AliPMD.h index 198c86ec708..45aa9f74aae 100644 --- a/PMD/AliPMD.h +++ b/PMD/AliPMD.h @@ -40,15 +40,15 @@ public: virtual void SetPadSize(Float_t, Float_t, Float_t, Float_t); virtual void StepManager(); virtual void AddRecPoint(const AliPMDRecPoint &p); - virtual void MakeBranch(Option_t* option, const char *file=0); + virtual void MakeBranch(Option_t* option); virtual void SetTreeAddress(); virtual void ResetHits(); private: - TClonesArray* fRecPoints; // List of reconstructed hits + TClonesArray* fRecPoints; //! List of reconstructed hits Int_t fNRecPoints; // Number of reconstructed hits - ClassDef(AliPMD,1) // Base Class for Photon Multiplicity Detector + ClassDef(AliPMD,2) // Base Class for Photon Multiplicity Detector }; diff --git a/PMD/AliPMDv0.cxx b/PMD/AliPMDv0.cxx index 8ff422d39a6..e5925e26451 100644 --- a/PMD/AliPMDv0.cxx +++ b/PMD/AliPMDv0.cxx @@ -12,26 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.16 2002/11/21 22:57:02 alibrary -Removing AliMC and AliMCProcess - -Revision 1.15 2002/10/23 07:36:35 alibrary -Introducing Riostream.h - -Revision 1.14 2001/05/21 17:44:04 hristov -Backslash to continue strings - -Revision 1.13 2001/05/21 10:59:09 morsch -Printouts in debug mode only. -Revision 1.12 2001/05/21 09:39:28 morsch -Minor modifications on the geometry. (Tapan Nayak) - -Revision 1.11 2001/05/14 14:01:04 morsch -AliPMDv0 coarse geometry and AliPMDv1 detailed simulation, completely revised versions by Tapan Nayak. -*/ +/* $Id$ */ // /////////////////////////////////////////////////////////////////////////////// @@ -47,11 +29,14 @@ AliPMDv0 coarse geometry and AliPMDv1 detailed simulation, completely revised ve /////////////////////////////////////////////////////////////////////////////// //// -#include "AliPMDv0.h" -#include "AliRun.h" +#include "Riostream.h" + +#include + #include "AliConst.h" #include "AliMagF.h" -#include "Riostream.h" +#include "AliPMDv0.h" +#include "AliRun.h" static Int_t kdet, ncell_sm, ncell_hole; static Float_t zdist, zdist1; diff --git a/PMD/AliPMDv1.cxx b/PMD/AliPMDv1.cxx index 75b53ebfba3..801615eb3f4 100644 --- a/PMD/AliPMDv1.cxx +++ b/PMD/AliPMDv1.cxx @@ -12,30 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2002/11/21 22:57:02 alibrary -Removing AliMC and AliMCProcess - -Revision 1.17 2002/10/23 07:36:35 alibrary -Introducing Riostream.h - -Revision 1.16 2001/05/21 17:44:04 hristov -Backslash to continue strings - -Revision 1.15 2001/05/21 10:59:49 morsch -Lost changes from revision 1.13 recovered. -Revision 1.14 2001/05/21 09:39:28 morsch -Minor modifications on the geometry. (Tapan Nayak) +/* $Id$ */ -Revision 1.13 2001/05/16 14:57:19 alibrary -New files for folders and Stack - -Revision 1.12 2001/05/14 14:01:04 morsch -AliPMDv0 coarse geometry and AliPMDv1 detailed simulation, completely revised versions by Tapan Nayak. - -*/ // /////////////////////////////////////////////////////////////////////////////// // // @@ -50,11 +29,14 @@ AliPMDv0 coarse geometry and AliPMDv1 detailed simulation, completely revised ve /////////////////////////////////////////////////////////////////////////////// //// -#include "AliPMDv1.h" -#include "AliRun.h" +#include "Riostream.h" + +#include + #include "AliConst.h" #include "AliMagF.h" -#include "Riostream.h" +#include "AliPMDv1.h" +#include "AliRun.h" static Int_t kdet, ncell_sm, ncell_hole; static Float_t zdist, zdist1; diff --git a/PYTHIA6/AliDecayerPythia.cxx b/PYTHIA6/AliDecayerPythia.cxx index bc3f39a26e1..28a3c03b4f2 100644 --- a/PYTHIA6/AliDecayerPythia.cxx +++ b/PYTHIA6/AliDecayerPythia.cxx @@ -13,76 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2003/04/25 09:55:23 morsch -Initialize from decay table in constructor. - -Revision 1.1 2003/03/15 15:00:47 morsch -Classed imported from EVGEN. - -Revision 1.18 2003/02/12 09:09:19 morsch -Pylist removed. - -Revision 1.17 2003/01/31 16:54:38 morsch -Use TPDCCode.h instead of AliPDG. - -Revision 1.16 2003/01/31 15:56:42 morsch -Forcing of decay channels independent of order in decay table. - -Revision 1.15 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14 2002/10/11 10:05:18 morsch -pdg code for psi' corrected. - -Revision 1.10.6.3 2002/10/10 16:40:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.13 2002/09/16 10:40:48 morsch -Use correct pdg codes for Upsilon(2S) = 100553 and Upsilon(3S) = 200553. - -Revision 1.12 2002/06/05 14:05:46 morsch -Decayer option kPhiKK for forced phi->K+K- decay added. - -Revision 1.11 2002/04/26 10:32:59 morsch -Option kNoDecayHeavy added. - -Revision 1.10 2002/02/22 17:28:05 morsch -ReadDecayTable() and WriteDecayTable() methods added. - -Revision 1.9 2001/12/20 10:37:13 morsch -- Add omega forced decay. -- Semileptonic decays for some more B and D baryons. - -Revision 1.8 2001/07/04 10:28:20 morsch -Introduce GetLifetime(Int_T kf) method until functionality provided by -TParticlePDG. - -Revision 1.7 2001/04/12 07:23:28 morsch -Reactivate forcing option for dimuon and dielectron decay channels of phi (333). - -Revision 1.6 2001/03/27 10:53:26 morsch -Save pythia default decay table at first initialization. Reload at each -following Init() call. - -Revision 1.5 2001/03/09 13:04:06 morsch -Decay_t moved to AliDecayer.h - -Revision 1.4 2001/01/30 09:23:11 hristov -Streamers removed (R.Brun) - -Revision 1.3 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.2 2000/09/12 13:58:45 morsch -SetForceDcay(..) sets the member data storing the forced decay information. -ForceDecay() executes the change of the decay table. - -Revision 1.1 2000/09/06 14:23:43 morsch -Realisation of AliDecayer using Pythia6 - -*/ +/* $Id$ */ // Implementation of AliDecayer using Pythia // Method forwarding to the AliPythia instance. diff --git a/PYTHIA6/AliGenPythiaEventHeader.cxx b/PYTHIA6/AliGenPythiaEventHeader.cxx index 78ea5829403..05da0ce6ebc 100644 --- a/PYTHIA6/AliGenPythiaEventHeader.cxx +++ b/PYTHIA6/AliGenPythiaEventHeader.cxx @@ -13,15 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2002/11/15 00:40:21 morsch -Information about trigger jets added. - -Revision 1.1 2001/07/13 09:34:53 morsch -Event header class for Pythia added. - -*/ +/* $Id$ */ #include "AliGenPythiaEventHeader.h" ClassImp(AliGenPythiaEventHeader) diff --git a/PYTHIA6/AliGenPythiaJets.cxx b/PYTHIA6/AliGenPythiaJets.cxx index 1c883ba5ae7..275b4bafe9a 100644 --- a/PYTHIA6/AliGenPythiaJets.cxx +++ b/PYTHIA6/AliGenPythiaJets.cxx @@ -13,20 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/03/15 15:00:48 morsch -Classed imported from EVGEN. - -Revision 1.3 2003/02/26 13:08:22 morsch -TParticle included. - -Revision 1.2 2003/02/26 10:26:32 morsch -AliGenPythiaJets: jets centered on EMCAL - -Revision 1.1 2003/01/17 04:10:31 morsch -First commit. -*/ +/* $Id$ */ // // Generator using the TPythia interface (via AliPythia) diff --git a/PYTHIA6/AliPythia.cxx b/PYTHIA6/AliPythia.cxx index c07ce5dae44..5613d528c7b 100644 --- a/PYTHIA6/AliPythia.cxx +++ b/PYTHIA6/AliPythia.cxx @@ -497,5 +497,3 @@ void AliPythia::Pycell(Int_t& njet) pycell(njet); } - - diff --git a/PYTHIA6/AliPythiaRndm.cxx b/PYTHIA6/AliPythiaRndm.cxx index 98de97d0e3b..c10eb9e5101 100644 --- a/PYTHIA6/AliPythiaRndm.cxx +++ b/PYTHIA6/AliPythiaRndm.cxx @@ -83,10 +83,8 @@ TRandom * AliPythiaRndm::GetPythiaRandom() { //_______________________________________________________________________ #define pyr pyr_ -// #define pyrset pyrset_ -// #define pyrget pyrget_ -// #define pyclus pyclus_ -// #define pycell pycell_ +#define pyrset pyrset_ +#define pyrget pyrget_ extern "C" { Double_t pyr(Int_t*) @@ -98,6 +96,6 @@ extern "C" { while(0 >= r || r >= 1); return r; } -// void pyrset(Int_t*,Int_t*) {} -// void pyrget(Int_t*,Int_t*) {} + void pyrset(Int_t*,Int_t*) {} + void pyrget(Int_t*,Int_t*) {} } diff --git a/PYTHIA6/pythia6203.f b/PYTHIA6/pythia6203.f index c742466af84..89de20179a0 100644 --- a/PYTHIA6/pythia6203.f +++ b/PYTHIA6/pythia6203.f @@ -51149,92 +51149,92 @@ C...0 and 1, excluding the endpoints. * * RETURN * END - +* C********************************************************************* - +* C...PYRGET C...Dumps the state of the random number generator on a file C...for subsequent startup from this state onwards. - - SUBROUTINE PYRGET(LFN,MOVE) - +* +* SUBROUTINE PYRGET(LFN,MOVE) +* C...Double precision and integer declarations. - IMPLICIT DOUBLE PRECISION(A-H, O-Z) - IMPLICIT INTEGER(I-N) - INTEGER PYK,PYCHGE,PYCOMP +* IMPLICIT DOUBLE PRECISION(A-H, O-Z) +* IMPLICIT INTEGER(I-N) +* INTEGER PYK,PYCHGE,PYCOMP C...Commonblocks. - COMMON/PYDATR/MRPY(6),RRPY(100) - SAVE /PYDATR/ +* COMMON/PYDATR/MRPY(6),RRPY(100) +* SAVE /PYDATR/ C...Local character variable. - CHARACTER CHERR*8 - +* CHARACTER CHERR*8 +* C...Backspace required number of records (or as many as there are). - IF(MOVE.LT.0) THEN - NBCK=MIN(MRPY(6),-MOVE) - DO 100 IBCK=1,NBCK - BACKSPACE(LFN,ERR=110,IOSTAT=IERR) - 100 CONTINUE - MRPY(6)=MRPY(6)-NBCK - ENDIF - +* IF(MOVE.LT.0) THEN +* NBCK=MIN(MRPY(6),-MOVE) +* DO 100 IBCK=1,NBCK +* BACKSPACE(LFN,ERR=110,IOSTAT=IERR) +* 100 CONTINUE +* MRPY(6)=MRPY(6)-NBCK +* ENDIF +* C...Unformatted write on unit LFN. - WRITE(LFN,ERR=110,IOSTAT=IERR) (MRPY(I1),I1=1,5), - &(RRPY(I2),I2=1,100) - MRPY(6)=MRPY(6)+1 - RETURN - +* WRITE(LFN,ERR=110,IOSTAT=IERR) (MRPY(I1),I1=1,5), +* &(RRPY(I2),I2=1,100) +* MRPY(6)=MRPY(6)+1 +* RETURN +* C...Write error. - 110 WRITE(CHERR,'(I8)') IERR - CALL PYERRM(18,'(PYRGET:) error when accessing file, IOSTAT ='// - &CHERR) - - RETURN - END - +* 110 WRITE(CHERR,'(I8)') IERR +* CALL PYERRM(18,'(PYRGET:) error when accessing file, IOSTAT ='// +* &CHERR) +* +* RETURN +* END +* C********************************************************************* C...PYRSET C...Reads a state of the random number generator from a file C...for subsequent generation from this state onwards. - - SUBROUTINE PYRSET(LFN,MOVE) - +* +* SUBROUTINE PYRSET(LFN,MOVE) +* C...Double precision and integer declarations. - IMPLICIT DOUBLE PRECISION(A-H, O-Z) - IMPLICIT INTEGER(I-N) - INTEGER PYK,PYCHGE,PYCOMP +* IMPLICIT DOUBLE PRECISION(A-H, O-Z) +* IMPLICIT INTEGER(I-N) +* INTEGER PYK,PYCHGE,PYCOMP C...Commonblocks. - COMMON/PYDATR/MRPY(6),RRPY(100) - SAVE /PYDATR/ +* COMMON/PYDATR/MRPY(6),RRPY(100) +* SAVE /PYDATR/ C...Local character variable. - CHARACTER CHERR*8 - +* CHARACTER CHERR*8 +* C...Backspace required number of records (or as many as there are). - IF(MOVE.LT.0) THEN - NBCK=MIN(MRPY(6),-MOVE) - DO 100 IBCK=1,NBCK - BACKSPACE(LFN,ERR=120,IOSTAT=IERR) - 100 CONTINUE - MRPY(6)=MRPY(6)-NBCK - ENDIF - +* IF(MOVE.LT.0) THEN +* NBCK=MIN(MRPY(6),-MOVE) +* DO 100 IBCK=1,NBCK +* BACKSPACE(LFN,ERR=120,IOSTAT=IERR) +* 100 CONTINUE +* MRPY(6)=MRPY(6)-NBCK +* ENDIF +* C...Unformatted read from unit LFN. - NFOR=1+MAX(0,MOVE) - DO 110 IFOR=1,NFOR - READ(LFN,ERR=120,IOSTAT=IERR) (MRPY(I1),I1=1,5), - & (RRPY(I2),I2=1,100) - 110 CONTINUE - MRPY(6)=MRPY(6)+NFOR - RETURN - +* NFOR=1+MAX(0,MOVE) +* DO 110 IFOR=1,NFOR +* READ(LFN,ERR=120,IOSTAT=IERR) (MRPY(I1),I1=1,5), +* & (RRPY(I2),I2=1,100) +* 110 CONTINUE +* MRPY(6)=MRPY(6)+NFOR +* RETURN +* C...Write error. - 120 WRITE(CHERR,'(I8)') IERR - CALL PYERRM(18,'(PYRSET:) error when accessing file, IOSTAT ='// - &CHERR) - - RETURN - END - +* 120 WRITE(CHERR,'(I8)') IERR +* CALL PYERRM(18,'(PYRSET:) error when accessing file, IOSTAT ='// +* &CHERR) +* +* RETURN +* END +* C********************************************************************* C...PYROBO diff --git a/RALICE/AliCalorimeter.cxx b/RALICE/AliCalorimeter.cxx index 47917b8521c..baf5fa37cf5 100644 --- a/RALICE/AliCalorimeter.cxx +++ b/RALICE/AliCalorimeter.cxx @@ -355,6 +355,13 @@ void AliCalorimeter::Reset(Int_t mode) delete fModules; fModules=0; } + for (Int_t i=0; i diff --git a/RICH/AliRICH.cxx b/RICH/AliRICH.cxx index 9b6e5c3f3c2..a7c880c5b5a 100644 --- a/RICH/AliRICH.cxx +++ b/RICH/AliRICH.cxx @@ -13,183 +13,15 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.65 2003/01/14 10:50:19 alibrary - Cleanup of STEER coding conventions - - Revision 1.64 2002/11/21 22:54:07 alibrary - Removing AliMC and AliMCProcess - - Revision 1.63 2002/11/04 09:02:52 morsch - Further corrcetions on Fresnel and Grid losses. - - Revision 1.62 2002/10/31 08:44:04 morsch - Problems with rotated RICH solved: - Detector response (fresnel reflection, grid absorption ...) has to be - determined using local coordinates. - - Revision 1.61 2002/10/29 15:00:08 morsch - - Diagnostics updated. - - RecHits structure synchronized. - - Digitizer method using AliRICHDigitizer. - (J. Barbosa) - - - Revision 1.60 2002/10/22 16:28:21 alibrary - Introducing Riostream.h - - Revision 1.59 2002/10/14 14:57:31 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.58.6.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02 - - Revision 1.58 2001/11/14 09:49:37 dibari - Use debug methods - - Revision 1.57 2001/11/09 17:29:31 dibari - Setters fro models moved to header - - Revision 1.56 2001/11/02 15:37:25 hristov - Digitizer class created. Code cleaning and bug fixes (J.Chudoba) - - Revision 1.55 2001/10/23 13:03:35 hristov - The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) - - Revision 1.54 2001/09/07 08:38:10 hristov - Pointers initialised to 0 in the default constructors - - Revision 1.53 2001/08/30 09:51:23 hristov - The operator[] is replaced by At() or AddAt() in case of TObjArray. - - Revision 1.52 2001/05/16 14:57:20 alibrary - New files for folders and Stack - - Revision 1.51 2001/05/14 10:18:55 hristov - Default arguments declared once - - Revision 1.50 2001/05/10 14:44:16 jbarbosa - Corrected some overlaps (thanks I. Hrivnacovna). - - Revision 1.49 2001/05/10 12:23:49 jbarbosa - Repositioned the RICH modules. - Eliminated magic numbers. - Incorporated diagnostics (from macros). - - Revision 1.48 2001/03/15 10:35:00 jbarbosa - Corrected bug in MakeBranch (was using a different version of STEER) - - Revision 1.47 2001/03/14 18:13:56 jbarbosa - Several changes to adapt to new IO. - Removed digitising function, using AliRICHMerger::Digitise from now on. - - Revision 1.46 2001/03/12 17:46:33 hristov - Changes needed on Sun with CC 5.0 - - Revision 1.45 2001/02/27 22:11:46 jbarbosa - Testing TreeS, removing of output. - - Revision 1.44 2001/02/27 15:19:12 jbarbosa - Transition to SDigits. - - Revision 1.43 2001/02/23 17:19:06 jbarbosa - Corrected photocathode definition in BuildGeometry(). - - Revision 1.42 2001/02/13 20:07:23 jbarbosa - Parametrised definition of photcathode dimensions. New spacers. New data members in AliRICHHit to store particle momentum - when entering the freon. Corrected calls to particle stack. - - Revision 1.41 2001/01/26 20:00:20 hristov - Major upgrade of AliRoot code - - Revision 1.40 2001/01/24 20:58:03 jbarbosa - Enhanced BuildGeometry. Now the photocathodes are drawn. - - Revision 1.39 2001/01/22 21:40:24 jbarbosa - Removing magic numbers - - Revision 1.37 2000/12/20 14:07:25 jbarbosa - Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova) - - Revision 1.36 2000/12/18 17:45:54 jbarbosa - Cleaned up PadHits object. - - Revision 1.35 2000/12/15 16:49:40 jbarbosa - Geometry and materials updates (wire supports, pcbs, backplane supports, frame). - - Revision 1.34 2000/11/10 18:12:12 jbarbosa - Bug fix for AliRICHCerenkov (thanks to P. Hristov) - - Revision 1.33 2000/11/02 10:09:01 jbarbosa - Minor bug correction (some pointers were not initialised in the default constructor) - - Revision 1.32 2000/11/01 15:32:55 jbarbosa - Updated to handle both reconstruction algorithms. - - Revision 1.31 2000/10/26 20:18:33 jbarbosa - Supports for methane and freon vessels - - Revision 1.30 2000/10/24 13:19:12 jbarbosa - Geometry updates. - - Revision 1.29 2000/10/19 19:39:25 jbarbosa - Some more changes to geometry. Further correction of digitisation "per part. type" - - Revision 1.28 2000/10/17 20:50:57 jbarbosa - Inversed digtise by particle type (now, only the selected particle type is not digitsed). - Corrected several geometry minor bugs. - Added new parameter (opaque quartz thickness). - - Revision 1.27 2000/10/11 10:33:55 jbarbosa - Corrected bug introduced by earlier revisions (CerenkovData array cannot be reset to zero on wach call of StepManager) - - Revision 1.26 2000/10/03 21:44:08 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.25 2000/10/02 21:28:12 fca - Removal of useless dependecies via forward declarations - - Revision 1.24 2000/10/02 15:43:17 jbarbosa - Fixed forward declarations. - Fixed honeycomb density. - Fixed cerenkov storing. - New electronics. - - Revision 1.23 2000/09/13 10:42:14 hristov - Minor corrections for HP, DEC and Sun; strings.h included - - Revision 1.22 2000/09/12 18:11:13 fca - zero hits area before using - - Revision 1.21 2000/07/21 10:21:07 morsch - fNrawch = 0; and fNrechits = 0; in the default constructor. - - Revision 1.20 2000/07/10 15:28:39 fca - Correction of the inheritance scheme - - Revision 1.19 2000/06/30 16:29:51 dibari - Added kDebugLevel variable to control output size on demand - - Revision 1.18 2000/06/12 15:15:46 jbarbosa - Cleaned up version. - - Revision 1.17 2000/06/09 14:58:37 jbarbosa - New digitisation per particle type - - Revision 1.16 2000/04/19 12:55:43 morsch - Newly structured and updated version (JB, AM) - -*/ - +/* $Id$ */ //////////////////////////////////////////////// // Manager and hits classes for set:RICH // //////////////////////////////////////////////// +#include #include -#include #include #include #include @@ -208,7 +40,6 @@ #include #include #include - #include "AliConst.h" #include "AliMagF.h" #include "AliPoints.h" @@ -231,8 +62,6 @@ #include "AliSegmentation.h" - - static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines static Int_t sCurIterPad=0; @@ -298,8 +127,8 @@ AliRICH::AliRICH(const char *name, const char *title) for (i=0; iAddAt(new TClonesArray("AliRICHDigit",10000), i); - fNdch[i]=0; + fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i); + fNdch[i]=0; } //fNrawch = new Int_t[kNCH]; @@ -1856,100 +1685,107 @@ Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t ) } //___________________________________________ -void AliRICH::MakeBranch(Option_t* option, const char *file) +void AliRICH::MakeBranch(Option_t* option) { // Create Tree branches for the RICH. - const Int_t kBufferSize = 4000; - char branchname[20]; + const Int_t kBufferSize = 4000; + char branchname[20]; - AliDetector::MakeBranch(option,file); - const char *cH = strstr(option,"H"); - const char *cD = strstr(option,"D"); - const char *cR = strstr(option,"R"); - const char *cS = strstr(option,"S"); - - - if (cH) { - sprintf(branchname,"%sCerenkov",GetName()); - if (fCerenkovs && gAlice->TreeH()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - } - sprintf(branchname,"%sSDigits",GetName()); - if (fSDigits && gAlice->TreeH()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - //printf("Making branch %sSDigits in TreeH\n",GetName()); - } - } + const char *cH = strstr(option,"H"); + const char *cD = strstr(option,"D"); + const char *cR = strstr(option,"R"); + const char *cS = strstr(option,"S"); + + + + if (cH && TreeH()) { + sprintf(branchname,"%sCerenkov",GetName()); + if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000); + MakeBranchInTree(TreeH(),branchname, &fCerenkovs, kBufferSize, 0) ; + + sprintf(branchname,"%sSDigits",GetName()); + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHSDigit",100000); + MakeBranchInTree(TreeH(),branchname, &fSDigits, kBufferSize, 0) ; + //branch->SetAutoDelete(kFALSE); + //printf("Making branch %sSDigits in TreeH\n",GetName()); + if (fHits == 0x0) fHits = new TClonesArray("AliRICHHit",1000 ); + + } + //this is after cH because we need to guarantee that fHits array is created + AliDetector::MakeBranch(option); - if (cS) { - sprintf(branchname,"%sSDigits",GetName()); - if (fSDigits && gAlice->TreeS()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - //printf("Making branch %sSDigits in TreeS\n",GetName()); - } - } - - if (cD) { + if (cS && fLoader->TreeS()) { + sprintf(branchname,"%sSDigits",GetName()); + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHSDigit",100000); + MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, 0) ; + } + + if (cD && fLoader->TreeD()) + { // // one branch for digits per chamber // - Int_t i; - - for (i=0; iTreeD()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - //printf("Making Branch %sDigits%d\n",GetName(),i+1); - } + Int_t i; + if (fDchambers == 0x0) + { + fDchambers = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHDigit",10000), i); + } } - } + for (i=0; iTreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0); + } + } - if (cR) { + if (cR && gAlice->TreeR()) + { // // one branch for raw clusters per chamber // + Int_t i; + if (fRawClusters == 0x0 ) + { + fRawClusters = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHRawCluster",10000), i); + } + } + + if (fRecHits1D == 0x0) + { + fRecHits1D = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHRecHit1D",1000), i); + } + } - //printf("Called MakeBranch for TreeR\n"); - - Int_t i; - - for (i=0; iTreeR()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - } - } - // - // one branch for rec hits per chamber - // - for (i=0; iTreeR()) { - //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ; - MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - } + if (fRecHits3D == 0x0) + { + fRecHits3D = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHRecHit3D",1000), i); + } } - for (i=0; iTreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0); + sprintf(branchname,"%sRecHits1D%d",GetName(),i+1); + MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0); sprintf(branchname,"%sRecHits3D%d",GetName(),i+1); - if (fRecHits3D && gAlice->TreeR()) { - MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, file) ; - //branch->SetAutoDelete(kFALSE); - } - } - } + MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0); + } + }//if (cR && gAlice->TreeR()) } //___________________________________________ @@ -1959,66 +1795,110 @@ void AliRICH::SetTreeAddress() char branchname[20]; Int_t i; - AliDetector::SetTreeAddress(); - TBranch *branch; - TTree *treeH = gAlice->TreeH(); - TTree *treeD = gAlice->TreeD(); - TTree *treeR = gAlice->TreeR(); - TTree *treeS = gAlice->TreeS(); + TBranch *branch; + TTree *treeH = fLoader->TreeH(); + TTree *treeD = fLoader->TreeD(); + TTree *treeR = fLoader->TreeR(); + TTree *treeS = fLoader->TreeS(); - if (treeH) { - if (fCerenkovs) { - branch = treeH->GetBranch("RICHCerenkov"); - if (branch) branch->SetAddress(&fCerenkovs); - } - if (fSDigits) { - branch = treeH->GetBranch("RICHSDigits"); - if (branch) - { - branch->SetAddress(&fSDigits); - //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits); - } + if (treeH) + { + branch = treeH->GetBranch("RICHCerenkov"); + if (branch) + { + if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000); + branch->SetAddress(&fCerenkovs); } - } - - if (treeS) { - if (fSDigits) { - branch = treeS->GetBranch("RICHSDigits"); - if (branch) - { - branch->SetAddress(&fSDigits); - //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits); - } + + branch = treeH->GetBranch("RICHSDigits"); + if (branch) + { + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHSDigit",100000); + branch->SetAddress(&fSDigits); + //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits); } + if (fHits == 0x0) fHits = new TClonesArray("AliRICHHit",1000 ); + } + + //this is after TreeH because we need to guarantee that fHits array is created + AliDetector::SetTreeAddress(); + + if (treeS) { + branch = treeS->GetBranch("RICHSDigits"); + if (branch) + { + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHSDigit",100000); + branch->SetAddress(&fSDigits); + //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits); + } } - if (treeD) { - for (int i=0; iGetBranch(branchname); - if (branch) branch->SetAddress(&((*fDchambers)[i])); - } - } + if (treeD) + { + if (fDchambers == 0x0) + { + fDchambers = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHDigit",10000), i); + } + } + + for (i=0; iGetBranch(branchname); + if (branch) branch->SetAddress(&((*fDchambers)[i])); + } + } } + if (treeR) { - for (i=0; iAddAt(new TClonesArray("AliRICHRawCluster",10000), i); + } + } + + if (fRecHits1D == 0x0) + { + fRecHits1D = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHRecHit1D",1000), i); + } + } + + if (fRecHits3D == 0x0) + { + fRecHits3D = new TObjArray(kNCH); + for (i=0; iAddAt(new TClonesArray("AliRICHRecHit3D",1000), i); + } + } + + for (i=0; iGetBranch(branchname); if (branch) branch->SetAddress(&((*fRawClusters)[i])); } - } + } - for (i=0; iGetBranch(branchname); if (branch) branch->SetAddress(&((*fRecHits1D)[i])); } - } + } for (i=0; iGetDetector("RICH"); - TTree *treeH = gAlice->TreeH(); + TTree *treeH = TreeH(); Int_t ntracks =(Int_t) treeH->GetEntries(); // Start loop on tracks in the hits containers @@ -3389,7 +3269,7 @@ AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); // Get pointers to RICH detector and Hits containers - TTree *TH = gAlice->TreeH(); + TTree *TH = TreeH(); Stat_t ntracks = TH->GetEntries(); // Start loop on tracks in the hits containers diff --git a/RICH/AliRICH.h b/RICH/AliRICH.h index d47492f63a7..358fbb294dc 100644 --- a/RICH/AliRICH.h +++ b/RICH/AliRICH.h @@ -61,7 +61,7 @@ public: virtual Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola); virtual void StepManager(); Int_t DistancetoPrimitive(Int_t px, Int_t py); - virtual void MakeBranch(Option_t *opt=" ", const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void MakeBranchInTreeD(TTree *treeD, const char *file=0); void SetTreeAddress(); virtual void ResetHits(); @@ -144,16 +144,16 @@ public: inline virtual void Print(Option_t *option)const; // Prints debug information protected: - TObjArray *fChambers; // List of RICH chambers aka modules + TObjArray *fChambers; // !List of RICH chambers aka modules Int_t fNSDigits; // Number of clusters Int_t fNcerenkovs; // Number of cerenkovs - TClonesArray *fSDigits; // List of clusters - TObjArray *fDchambers; // List of digits - TClonesArray *fCerenkovs; // List of cerenkovs + TClonesArray *fSDigits; // !List of clusters + TObjArray *fDchambers; // !List of digits + TClonesArray *fCerenkovs; // !List of cerenkovs Int_t fNdch[kNCH]; // Number of digits - TObjArray *fRawClusters; // List of raw clusters - TObjArray *fRecHits1D; // List of rec. hits - TObjArray *fRecHits3D; // List of rec. hits + TObjArray *fRawClusters; // !List of raw clusters + TObjArray *fRecHits1D; // !List of rec. hits + TObjArray *fRecHits3D; // !List of rec. hits Int_t fNrawch[kNCH]; // Number of raw clusters Int_t fNrechits1D[kNCH]; // Number of rec hits Int_t fNrechits3D[kNCH]; // Number of rec hits @@ -181,7 +181,7 @@ protected: Text_t *fFileName; //! File with background hits AliRICHMerger *fMerger; //! pointer to merger - ClassDef(AliRICH,1) // Main RICH class + ClassDef(AliRICH,2) // Main RICH class };//class AliRICH inline void AliRICH::Print(Option_t *option)const diff --git a/RICH/AliRICHChamber.h b/RICH/AliRICHChamber.h index 9242cb35e57..6e2e272c095 100644 --- a/RICH/AliRICHChamber.h +++ b/RICH/AliRICHChamber.h @@ -74,7 +74,8 @@ public: void SigGenInit(Float_t x, Float_t y, Float_t z) {fSegmentation->SigGenInit(x, y, z) ;} Int_t SigGenCond(Float_t x, Float_t y, Float_t z) {return fSegmentation->SigGenCond(x, y, z);} - Int_t Sector(Float_t x, Float_t y) {return fSegmentation->Sector(x, y);} // Returns number of sector containing (x,y) position + Int_t Sector(Float_t x, Float_t y) {return fSegmentation->Sector((Int_t)x, (Int_t)y);} // Returns number of sector containing (x,y) position + void SetPadSize(Float_t p1, Float_t p2) {fSegmentation->SetPadSize(p1,p2);} Float_t IntPH(Float_t eloss, Float_t yhit) {return fResponse->IntPH(eloss,yhit);} diff --git a/RICH/AliRICHClusterFinder.cxx b/RICH/AliRICHClusterFinder.cxx index de5bb452628..b66452d33c9 100644 --- a/RICH/AliRICHClusterFinder.cxx +++ b/RICH/AliRICHClusterFinder.cxx @@ -15,6 +15,12 @@ /* $Log$ + Revision 1.11.4.1 2003/07/10 17:09:50 hristov + Merging to v3-10-00 + + Revision 1.12 2003/06/27 10:03:00 rdm + avoid assignment of TF1 objects. In SinoidalFit() pass TF1 by pointer. + Revision 1.11 2001/10/23 13:03:35 hristov The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) diff --git a/RICH/AliRICHDetect.cxx b/RICH/AliRICHDetect.cxx index 1356a168baa..ba7b1dcffd9 100644 --- a/RICH/AliRICHDetect.cxx +++ b/RICH/AliRICHDetect.cxx @@ -13,57 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.16 2001/10/23 13:03:35 hristov - The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) - - Revision 1.15 2001/10/21 18:31:23 hristov - Several pointers were set to zero in the default constructors to avoid memory management problems - - Revision 1.14 2001/05/14 13:25:54 hristov - stdlib.h included (for Alpha) - - Revision 1.13 2001/05/10 12:26:31 jbarbosa - Totally reworked version of reconstruction algorithm. - - Revision 1.12 2001/02/27 22:15:03 jbarbosa - Removed compiler warning. - - Revision 1.11 2001/02/27 15:21:46 jbarbosa - Transition to SDigits. - - Revision 1.10 2001/02/13 20:39:06 jbarbosa - Changes to make it work with new IO. - - Revision 1.9 2001/01/22 21:39:11 jbarbosa - Several tune-ups - - Revision 1.8 2000/11/15 15:52:53 jbarbosa - Turned on spot algorithm. - - Revision 1.7 2000/11/01 15:37:05 jbarbosa - Updated to use its own rec. point object. - - Revision 1.6 2000/10/02 21:28:12 fca - Removal of useless dependecies via forward declarations - - Revision 1.5 2000/06/30 16:30:28 dibari - Disabled writing to rechits. - - Revision 1.4 2000/06/15 15:46:59 jbarbosa - Corrected compilation errors on HP-UX (replaced pow with TMath::Power) - - Revision 1.3 2000/06/13 13:15:41 jbarbosa - Still some code cleanup done (variable names) - - Revision 1.2 2000/06/12 15:19:30 jbarbosa - Cleaned up version. - - Revision 1.1 2000/04/19 13:05:14 morsch - J. Barbosa's spot reconstruction algorithm. - -*/ +/* $Id$ */ #include @@ -87,8 +37,6 @@ #include -#include "malloc.h" - ClassImp(AliRICHDetect) //___________________________________________ @@ -223,8 +171,8 @@ void AliRICHDetect::Detect(Int_t nev, Int_t type) Activation->SetFillColor(5); Activation->SetXTitle("activation"); - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); - + Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); + Float_t trackglob[3]; Float_t trackloc[3]; @@ -234,7 +182,7 @@ void AliRICHDetect::Detect(Int_t nev, Int_t type) for (track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pRICH->TreeH()->GetEvent(track); TClonesArray *pHits = pRICH->Hits(); if (pHits == 0) return; Int_t nhits = pHits->GetEntriesFast(); diff --git a/RICH/AliRICHDetectV1.cxx b/RICH/AliRICHDetectV1.cxx index 40efe1e2bfd..6c02af52beb 100644 --- a/RICH/AliRICHDetectV1.cxx +++ b/RICH/AliRICHDetectV1.cxx @@ -15,10 +15,19 @@ /* $Log$ + Revision 1.1.4.2 2003/04/16 07:51:47 hristov + Removing malloc.h + + Revision 1.1.4.1 2002/11/26 16:59:29 hristov + Merging NewIO with v3-09-04 + + Revision 1.1 2002/10/29 14:09:45 morsch + Second reconstruction algorithm. (J. Barbosa) + */ -#include +#include #include "AliRICHDetectV1.h" #include "AliRICH.h" @@ -40,8 +49,6 @@ #include -#include "malloc.h" - ClassImp(AliRICHDetectV1) @@ -184,7 +191,7 @@ void AliRICHDetectV1::Detect(Int_t nev, Int_t type) Activation->SetFillColor(5); Activation->SetXTitle("activation"); - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); + Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); Float_t trackglob[3]; Float_t trackloc[3]; @@ -195,7 +202,7 @@ void AliRICHDetectV1::Detect(Int_t nev, Int_t type) for (track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pRICH->TreeH()->GetEvent(track); TClonesArray *pHits = pRICH->Hits(); if (pHits == 0) return; Int_t nhits = pHits->GetEntriesFast(); diff --git a/RICH/AliRICHDigitizer.cxx b/RICH/AliRICHDigitizer.cxx index 758ecf3bc15..8d009dba1fd 100644 --- a/RICH/AliRICHDigitizer.cxx +++ b/RICH/AliRICHDigitizer.cxx @@ -13,30 +13,12 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.5 2002/07/09 13:11:26 hristov - Old style include files needed on HP (aCC) +/* $Id$ */ - Revision 1.4 2002/05/28 07:53:10 morsch - Wrong order of arguments in for-statement corrected. +//Piotr.Skowronski@cern.ch : +//Corrections applied in order to compile (only) with new I/O and folder structure +//To be implemented correctly by responsible - Revision 1.3 2001/12/05 14:53:34 hristov - Destructor corRevision 1.60 2002/10/22 16:28:21 alibrary - Introducing Riostream.h - - Revision 1.59 2002/10/14 14:57:31 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.58.6.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02rected - - Revision 1.2 2001/11/07 14:50:31 hristov - Minor correction of the Log part - - Revision 1.1 2001/11/02 15:37:26 hristov - Digitizer class created. Code cleaning and bug fixes (J.Chudoba) -*/ #include #include @@ -45,6 +27,9 @@ #include #include +#include "AliRunLoader.h" +#include "AliLoader.h" + #include "AliRICHDigitizer.h" #include "AliRICHChamber.h" #include "AliHitMap.h" @@ -82,7 +67,7 @@ AliRICHDigitizer::AliRICHDigitizer(AliRunDigitizer* manager) fDebug = 0; if (GetDebug()>2) cerr<<"AliRICHDigitizer::AliRICHDigitizer" - <<"(AliRunDigitizer* manager) was processed"<QPad()); // charge per pad pdigit->AddSignal(iqpad); - pdigit->AddPhysicsSignal(iqpad); + pdigit->AddPhysicsSignal(iqpad); // update list of tracks // @@ -181,11 +166,21 @@ void AliRICHDigitizer::Exec(Option_t* option) AliRICHChamber* iChamber; AliSegmentation* segmentation; - + + AliRunLoader *inRL, *outRL;//in and out Run Loaders + AliLoader *ingime, *outgime;// in and out ITSLoaders + + outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + outgime = outRL->GetLoader("RICHLoader"); + fTDList = new TObjArray; - + + AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); - pRICH->MakeBranchInTreeD(fManager->GetTreeD()); + + if (outgime->TreeD() == 0x0) outgime->MakeTree("D"); + + pRICH->MakeBranchInTreeD(outgime->TreeD()); fHitMap= new AliHitMap* [kNCH]; for (Int_t i =0; iGetNinputs(); - inputFile++) { - + for (Int_t inputFile=0; inputFileGetNinputs(); inputFile++) + { + inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + ingime = inRL->GetLoader("RICHLoader"); + // Connect RICH branches if (inputFile > 0 ) fSignal = kFALSE; TBranch *branchHits = 0; TBranch *branchSDigits = 0; - TTree *treeH = fManager->GetInputTreeH(inputFile); + + ingime->LoadHits("READ"); + TTree *treeH = ingime->TreeH(); if (GetDebug()>2) { cerr<<" inputFile "<GetBranch("RICH"); - if (branchHits) { - fHits->Clear(); - branchHits->SetAddress(&fHits); + if (branchHits) + { + fHits->Clear(); + branchHits->SetAddress(&fHits); } else - Error("Exec","branch RICH was not found"); + Error("Exec","branch RICH was not found"); } if (GetDebug()>2) cerr<<" branchHits = "<GetBranch("RICHSDigits"); if (branchSDigits) - branchSDigits->SetAddress(&fSDigits); + branchSDigits->SetAddress(&fSDigits); else - Error("exec","branch RICHSDigits was not found"); + Error("exec","branch RICHSDigits was not found"); } if (GetDebug()>2) cerr<<" branchSDigits = "<AddDigits(ich,tracks,charges,fDigits); - - - } - fManager->GetTreeD()->Fill(); + } + outgime->TreeD()->Fill(); //pRICH->ResetDigits(); fTDList->Delete(); // or fTDList->Clear(); ??? @@ -374,8 +372,10 @@ void AliRICHDigitizer::Exec(Option_t* option) Int_t ndigit=richDigits->GetEntriesFast(); printf ("Chamber %d digits %d \n",k,ndigit); } - fManager->GetTreeD()->Write(0,TObject::kOverwrite); - pRICH->ResetDigits(); + pRICH->ResetDigits(); /// ??? should it be here??? + + outgime->WriteDigits("OVERWRITE"); + delete [] fHitMap; delete fTDList; diff --git a/RICH/AliRICHDisplay.cxx b/RICH/AliRICHDisplay.cxx index d33fab28044..491d1ada034 100644 --- a/RICH/AliRICHDisplay.cxx +++ b/RICH/AliRICHDisplay.cxx @@ -13,66 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.19 2002/11/04 08:59:20 morsch - Correct orientation of modules. (J. Barbosa) - - Revision 1.18 2002/10/29 14:24:19 morsch - Minor corrections on the display (adc counts readable, ...). - (J. Barbosa) - - Revision 1.17 2001/10/23 13:03:35 hristov - The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) - - Revision 1.16 2001/10/21 18:31:24 hristov - Several pointers were set to zero in the default constructors to avoid memory management problems - - Revision 1.15 2001/10/09 07:34:09 hristov - Modifications needed by Root.03.01.06 (J.Chudoba) - - Revision 1.14 2001/05/16 14:57:20 alibrary - New files for folders and Stack - - Revision 1.13 2001/05/10 12:35:16 jbarbosa - Removed hit display, added rec. ring properties. - - Revision 1.12 2001/03/14 18:15:03 jbarbosa - Changes to adapt to new IO. - Removed verbose output. - - Revision 1.11 2001/02/27 15:21:34 jbarbosa - Transition to SDigits. - - Revision 1.10 2001/02/13 20:18:48 jbarbosa - Corrected some more positioning of points. Changes in LoadDigits to accomodate the new IO. - - Revision 1.9 2000/11/01 15:33:11 jbarbosa - Updated to handle both reconstruction algorithms. - - Revision 1.8 2000/10/03 21:44:09 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.7 2000/10/02 21:28:12 fca - Removal of useless dependecies via forward declarations - - Revision 1.6 2000/10/02 15:46:38 jbarbosa - Fixed forward declarations. - - Revision 1.5 2000/06/30 16:49:34 dibari - Different call for ring drawing. - - Revision 1.4 2000/06/12 15:21:08 jbarbosa - Cleaned up version. - - Revision 1.3 2000/06/09 14:52:08 jbarbosa - New tentative ellipse drawing routine - - Revision 1.1 2000/04/19 13:07:45 morsch - Digits, clusters and reconstruction results added. - -*/ - +/* $Id$ */ ////////////////////////////////////////////////////////////////////////// // // @@ -1080,7 +1021,7 @@ void AliRICHDisplay::LoadHits(Int_t chamber) AliRICHChamber* iChamber; iChamber = &(pRICH->Chamber(chamber-1)); - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); + Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); Int_t track; if (fPhits == 0) fPhits = new TObjArray(ntracks); @@ -1092,7 +1033,7 @@ void AliRICHDisplay::LoadHits(Int_t chamber) Int_t nAllHits=0; for (track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pRICH->TreeH()->GetEvent(track); TClonesArray *pRICHhits = pRICH->Hits(); if (pRICHhits == 0) return; Int_t nhits = pRICHhits->GetEntriesFast(); @@ -1104,7 +1045,7 @@ void AliRICHDisplay::LoadHits(Int_t chamber) Int_t npoints=0; for (track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pRICH->TreeH()->GetEvent(track); TClonesArray *pRICHhits = pRICH->Hits(); if (pRICHhits == 0) return; Int_t nhits = pRICHhits->GetEntriesFast(); @@ -1151,7 +1092,7 @@ void AliRICHDisplay::LoadCerenkovs(Int_t chamber) iChamber = &(pRICH->Chamber(chamber-1)); pRICH->SetTreeAddress(); - Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); + Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks); TVector *xp = new TVector(1000); @@ -1161,7 +1102,7 @@ void AliRICHDisplay::LoadCerenkovs(Int_t chamber) TVector *phit = new TVector(1000); for (Int_t track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); + pRICH->TreeH()->GetEvent(track); TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs(); if (pRICHCerenkovs == 0) return; Int_t nhits = pRICHCerenkovs->GetEntriesFast(); diff --git a/RICH/AliRICHEllipse.cxx b/RICH/AliRICHEllipse.cxx index e6ab33e6519..cbd14eff34d 100644 --- a/RICH/AliRICHEllipse.cxx +++ b/RICH/AliRICHEllipse.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.4 2001/05/10 12:34:43 jbarbosa - Changed drwaing routines. - - Revision 1.3 2000/11/01 15:37:44 jbarbosa - Removed verbose output. - - Revision 1.2 2000/06/30 16:31:51 dibari - New drawing routine from Nico and Daniela. - - Revision 1.1 2000/06/12 15:21:57 jbarbosa - Cleaned up version. - -*/ +/* $Id$ */ #include "TMath.h" #include "AliRICHEllipse.h" diff --git a/RICH/AliRICHMerger.cxx b/RICH/AliRICHMerger.cxx index 35c2fa958bf..05030f2ce44 100644 --- a/RICH/AliRICHMerger.cxx +++ b/RICH/AliRICHMerger.cxx @@ -13,34 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/14 14:57:32 hristov -Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ -Revision 1.7.6.1 2002/07/24 10:07:52 alibrary -Updating VirtualMC - -Revision 1.7 2001/11/02 15:37:26 hristov -Digitizer class created. Code cleaning and bug fixes (J.Chudoba) - -Revision 1.5 2001/10/23 13:03:35 hristov -The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) - -Revision 1.4 2001/10/21 18:31:24 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.3 2001/05/16 14:57:20 alibrary -New files for folders and Stack - -Revision 1.2 2001/03/14 18:16:08 jbarbosa -Corrected bug (more to correct). -File "points.dat" is no longer created. - -Revision 1.1 2001/02/27 22:13:34 jbarbosa -Implementing merger class. - -*/ #include #include @@ -228,7 +202,7 @@ void AliRICHMerger::Digitise(Int_t nev, Int_t flag) fSignal = kTRUE; fCounter = 0; - TTree *treeH = gAlice->TreeH(); + TTree *treeH = pRICH->TreeH(); Int_t ntracks =(Int_t) treeH->GetEntries(); for (fTrack=0; fTrackResetHits(); diff --git a/RICH/AliRICHPatRec.cxx b/RICH/AliRICHPatRec.cxx index 326ee3edb22..6cebefb102b 100644 --- a/RICH/AliRICHPatRec.cxx +++ b/RICH/AliRICHPatRec.cxx @@ -15,6 +15,12 @@ /* $Log$ + Revision 1.13.4.1 2002/05/31 09:37:59 hristov + First set of changes done by Piotr + + Revision 1.13 2001/10/23 13:03:35 hristov + The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) + Revision 1.12 2001/05/10 12:34:23 jbarbosa Changed drwaing routines. @@ -116,7 +122,7 @@ void AliRICHPatRec::PatRec() //printf("PatRec started\n"); AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); - TTree *treeH = gAlice->TreeH(); + TTree *treeH = pRICH->TreeH(); ntracks =(Int_t) treeH->GetEntries(); // ntracks = 1; @@ -220,10 +226,10 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich, Float_t rectheta, Float_t //printf("Calling TrackParam\n"); gAlice->ResetHits(); - TTree *treeH = gAlice->TreeH(); + AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); + TTree *treeH = pRICH->TreeH(); treeH->GetEvent(itr); - AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1); if(mHit==0) return 1; ich = mHit->Chamber()-1; diff --git a/RICH/AliRICHPoints.cxx b/RICH/AliRICHPoints.cxx index 771bc737dab..1eba522cbfa 100644 --- a/RICH/AliRICHPoints.cxx +++ b/RICH/AliRICHPoints.cxx @@ -15,6 +15,12 @@ /* $Log$ + Revision 1.10.4.1 2002/05/31 09:37:59 hristov + First set of changes done by Piotr + + Revision 1.10 2001/10/23 13:03:35 hristov + The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba) + Revision 1.9 2001/02/27 15:20:56 jbarbosa Transition to SDigits. @@ -182,7 +188,7 @@ AliRICHHit *AliRICHPoints::GetHit() const // Returns pointer to hit index in AliRun::fParticles // AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); - gAlice->TreeH()->GetEvent(fTrackIndex); + pRICH->TreeH()->GetEvent(fTrackIndex); TClonesArray *pRICHhits = pRICH->Hits(); Int_t nhits = pRICHhits->GetEntriesFast(); if (fHitIndex < 0 || fHitIndex >= nhits) return 0; diff --git a/RICH/AliRICHRecHit3D.cxx b/RICH/AliRICHRecHit3D.cxx index a75472c5a76..a687ac23a94 100644 --- a/RICH/AliRICHRecHit3D.cxx +++ b/RICH/AliRICHRecHit3D.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.2 2001/05/10 12:33:24 jbarbosa - Added mean radius data member. - - Revision 1.1 2000/11/01 15:31:56 jbarbosa - New rec. point object for 3D Hough reconstruction. - - Revision 1.2 2000/06/30 16:36:58 dibari - Several new data members for Bari reconstruction - - Revision 1.1 2000/06/12 15:28:06 jbarbosa - Cleaned up version. - -*/ +/* $Id$ */ #include "AliRICHRecHit3D.h" diff --git a/RICH/AliRICHRecHit3D.h b/RICH/AliRICHRecHit3D.h index b1ecf2abd66..da7ab324d93 100644 --- a/RICH/AliRICHRecHit3D.h +++ b/RICH/AliRICHRecHit3D.h @@ -6,6 +6,7 @@ * See cxx source for full Copyright notice */ /* $Id$ */ + #include class AliRICHRecHit3D : public TObject { public: diff --git a/RICH/AliRICHResponseV0.cxx b/RICH/AliRICHResponseV0.cxx index 326cddec172..11739765f2b 100644 --- a/RICH/AliRICHResponseV0.cxx +++ b/RICH/AliRICHResponseV0.cxx @@ -13,50 +13,17 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.10 2002/10/14 14:57:32 hristov - Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ - Revision 1.9.6.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02 - - Revision 1.9 2001/11/08 20:10:45 dibari - ctor with initialising of parmeters added - - Revision 1.8 2001/09/05 09:09:38 hristov - The energy of feedback photons calculated correctly - - Revision 1.7 2001/05/10 12:32:27 jbarbosa - Changed call to SetTrack. - - Revision 1.6 2001/02/23 17:39:02 jbarbosa - Removed verbose output. - - Revision 1.5 2001/02/23 17:25:08 jbarbosa - Re-definition of IntPH() to accomodate for wire sag effect. - - Revision 1.4 2000/12/01 17:37:44 morsch - Replace in argument of SetTrack(..) string constant by kPFeedBackPhoton. - - Revision 1.3 2000/10/03 21:44:09 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.2 2000/10/02 21:28:12 fca - Removal of useless dependecies via forward declarations - - Revision 1.1 2000/06/12 15:29:37 jbarbosa - Cleaned up version. - -*/ +#include +#include +#include +#include #include "AliRICHResponseV0.h" -#include "AliSegmentation.h" #include "AliRun.h" +#include "AliSegmentation.h" -#include -#include -#include //___________________________________________ ClassImp(AliRICHResponseV0) diff --git a/RICH/AliRICHv0.cxx b/RICH/AliRICHv0.cxx index 4dde6f2dbee..88621b55025 100644 --- a/RICH/AliRICHv0.cxx +++ b/RICH/AliRICHv0.cxx @@ -13,103 +13,28 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.25 2002/10/22 16:28:21 alibrary - Introducing Riostream.h - - Revision 1.24 2002/10/14 14:57:32 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.23.8.2 2002/07/24 10:07:52 alibrary - Updating VirtualMC - - Revision 1.23.8.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02 - - Revision 1.23 2001/08/30 09:51:23 hristov - The operator[] is replaced by At() or AddAt() in case of TObjArray. - - Revision 1.22 2001/05/16 14:57:20 alibrary - New files for folders and Stack - - Revision 1.21 2001/05/10 12:28:15 jbarbosa - Repositioned the RICH modules. - - Revision 1.20 2001/02/23 17:25:57 jbarbosa - Setters for wire sag effect and voltage values. - - Revision 1.19 2001/02/13 20:10:22 jbarbosa - Removed call to SetNSec() (obsolete). Fixed bug in chamber initialisation (not all chambers were initialised). - - Revision 1.18 2000/12/20 14:07:36 jbarbosa - Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova) - - Revision 1.17 2000/12/18 17:44:29 jbarbosa - Took two lines out of output. - - Revision 1.16 2000/10/03 21:44:09 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.15 2000/10/02 15:54:55 jbarbosa - New default version (15 mm freon). - - Revision 1.14 2000/07/10 15:28:39 fca - Correction of the inheritance scheme - - Revision 1.13 2000/06/30 16:38:15 dibari - Test on kDebugevel - - Revision 1.12 2000/06/13 13:06:28 jbarbosa - Fixed compiling error for HP (multiple declaration) - - Revision 1.11 2000/06/12 15:35:44 jbarbosa - Cleaned up version. - - Revision 1.10 2000/06/09 14:59:25 jbarbosa - New default version. No setters needed, no hits. - - Revision 1.9 2000/05/31 08:19:38 jbarbosa - Fixed bug in StepManager - - Revision 1.8 2000/05/26 17:30:08 jbarbosa - Cerenkov angle now stored within cerenkov data structure. - - Revision 1.7 2000/05/18 10:31:36 jbarbosa - Fixed positioning of spacers inside freon. - Fixed positioning of proximity gap - inside methane. - Fixed cut on neutral particles in the StepManager. - - Revision 1.6 2000/04/28 11:51:58 morsch - Dimensions of arrays hits and Ckov_data corrected. - - Revision 1.5 2000/04/19 13:28:46 morsch - Major changes in geometry (parametrised), materials (updated) and - step manager (diagnostics) (JB, AM) - -*/ - +/* $Id$ */ ///////////////////////////////////////////////////////////// // Manager and hits classes for set: RICH default version // ///////////////////////////////////////////////////////////// -#include +#include "Riostream.h" + #include #include +#include +#include -#include "AliRICHv0.h" -#include "AliSegmentation.h" +#include "AliConst.h" +#include "AliPDG.h" +#include "AliRICHGeometry.h" #include "AliRICHResponse.h" -#include "AliRICHSegmentationV0.h" #include "AliRICHResponseV0.h" -#include "AliRICHGeometry.h" +#include "AliRICHSegmentationV0.h" +#include "AliRICHv0.h" #include "AliRun.h" -#include "Riostream.h" -#include "AliConst.h" -#include "AliPDG.h" ClassImp(AliRICHv0) diff --git a/RICH/AliRICHv1.cxx b/RICH/AliRICHv1.cxx index 74787737e19..8230cd49b7e 100644 --- a/RICH/AliRICHv1.cxx +++ b/RICH/AliRICHv1.cxx @@ -13,111 +13,30 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.18 2002/10/22 16:28:21 alibrary - Introducing Riostream.h - - Revision 1.17 2002/10/14 14:57:32 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.16.6.2 2002/07/24 10:07:52 alibrary - Updating VirtualMC - - Revision 1.16.6.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02 - - Revision 1.16 2001/10/10 11:29:17 morsch - Use segmentation v1 and wire sag as default. It does not work otherwise. Why ? - - Revision 1.15 2001/08/30 09:51:23 hristov - The operator[] is replaced by At() or AddAt() in case of TObjArray. - - Revision 1.14 2001/05/16 14:57:20 alibrary - New files for folders and Stack - - Revision 1.13 2001/05/10 12:28:04 jbarbosa - Repositioned the RICH modules. - - Revision 1.12 2001/02/23 17:26:12 jbarbosa - Setters for wire sag effect and voltage values. - - Revision 1.11 2001/02/13 20:10:33 jbarbosa - Removed call to SetNSec() (obsolete). Fixed bug in chamber initialisation (not all chambers were initialised). - - Revision 1.10 2000/12/20 14:08:02 jbarbosa - Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova) - - Revision 1.9 2000/12/18 17:44:40 jbarbosa - Took two lines out of output. - - Revision 1.8 2000/11/01 15:39:00 jbarbosa - Updated default geometry. - - Revision 1.7 2000/10/03 21:44:09 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.6 2000/07/10 15:28:39 fca - Correction of the inheritance scheme - - Revision 1.5 2000/06/30 16:38:51 dibari - Removed setters. - - Revision 1.4 2000/06/13 13:13:40 jbarbosa - Correcting previous correction... - - Revision 1.3 2000/06/13 13:06:38 jbarbosa - Fixed compiling error for HP (multiple declaration) - - Revision 1.2 2000/06/12 15:36:16 jbarbosa - Cleaned up version. - - Revision 1.1 2000/06/09 15:00:31 jbarbosa - New full version. All parameters configurable. - - Revision 1.9 2000/05/31 08:19:38 jbarbosa - Fixed bug in StepManager - - Revision 1.8 2000/05/26 17:30:08 jbarbosa - Cerenkov angle now stored within cerenkov data structure. - - Revision 1.7 2000/05/18 10:31:36 jbarbosa - Fixed positioning of spacers inside freon. - Fixed positioning of proximity gap - inside methane. - Fixed cut on neutral particles in the StepManager. - - Revision 1.6 2000/04/28 11:51:58 morsch - Dimensions of arrays hits and Ckov_data corrected. - - Revision 1.5 2000/04/19 13:28:46 morsch - Major changes in geometry (parametrised), materials (updated) and - step manager (diagnostics) (JB, AM) - -*/ - +/* $Id$ */ ////////////////////////////////////////////////////////// // Manager and hits classes for set: RICH full version // ////////////////////////////////////////////////////////// -#include +#include "Riostream.h" + #include -#include #include +#include +#include +#include -#include "AliRICHv1.h" +#include "AliConst.h" +#include "AliPDG.h" +#include "AliRICHGeometry.h" #include "AliRICHHit.h" -#include "AliSegmentation.h" #include "AliRICHResponse.h" -#include "AliRICHSegmentationV1.h" #include "AliRICHResponseV0.h" -#include "AliRICHGeometry.h" +#include "AliRICHSegmentationV1.h" +#include "AliRICHv1.h" #include "AliRun.h" -#include "Riostream.h" -#include "AliConst.h" -#include "AliPDG.h" ClassImp(AliRICHv1) diff --git a/RICH/AliRICHv2.cxx b/RICH/AliRICHv2.cxx index 0896996121c..8279c417533 100644 --- a/RICH/AliRICHv2.cxx +++ b/RICH/AliRICHv2.cxx @@ -13,94 +13,26 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* - $Log$ - Revision 1.10 2002/10/22 16:28:21 alibrary - Introducing Riostream.h - - Revision 1.9 2002/10/14 14:57:32 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.8.10.2 2002/07/24 10:07:52 alibrary - Updating VirtualMC - - Revision 1.8.10.1 2002/06/10 15:12:46 hristov - Merged with v3-08-02 - - Revision 1.8 2001/05/16 14:57:20 alibrary - New files for folders and Stack - - Revision 1.7 2001/05/10 12:28:26 jbarbosa - Repositioned the RICH modules. - - Revision 1.6 2001/02/13 20:10:45 jbarbosa - Removed call to SetNSec() (obsolete). Fixed bug in chamber initialisation (not all chambers were initialised). - - Revision 1.5 2000/12/20 14:08:14 jbarbosa - Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova) - - Revision 1.4 2000/12/18 17:44:49 jbarbosa - Took two lines out of output. - - Revision 1.3 2000/10/03 21:44:09 morsch - Use AliSegmentation and AliHit abstract base classes. - - Revision 1.2 2000/07/10 15:28:39 fca - Correction of the inheritance scheme - - Revision 1.1 2000/06/30 16:40:03 dibari - New configurale version. - - Revision 1.4 2000/06/13 13:13:40 jbarbosa - Correcting previous correction... - - Revision 1.3 2000/06/13 13:06:38 jbarbosa - Fixed compiling error for HP (multiple declaration) - - Revision 1.2 2000/06/12 15:36:16 jbarbosa - Cleaned up version. - - Revision 1.1 2000/06/09 15:00:31 jbarbosa - New full version. All parameters configurable. - - Revision 1.9 2000/05/31 08:19:38 jbarbosa - Fixed bug in StepManager - - Revision 1.8 2000/05/26 17:30:08 jbarbosa - Cerenkov angle now stored within cerenkov data structure. - - Revision 1.7 2000/05/18 10:31:36 jbarbosa - Fixed positioning of spacers inside freon. - Fixed positioning of proximity gap - inside methane. - Fixed cut on neutral particles in the StepManager. - - Revision 1.6 2000/04/28 11:51:58 morsch - Dimensions of arrays hits and Ckov_data corrected. - - Revision 1.5 2000/04/19 13:28:46 morsch - Major changes in geometry (parametrised), materials (updated) and - step manager (diagnostics) (JB, AM) - -*/ - +/* $Id$ */ ////////////////////////////////////////////////////////// // Manager and hits classes for set: RICH full version // ////////////////////////////////////////////////////////// -#include +#include "Riostream.h" + #include -#include #include +#include +#include +#include -#include "AliRICHv2.h" -#include "AliRICHHit.h" -#include "AliRun.h" -#include "Riostream.h" #include "AliConst.h" #include "AliPDG.h" +#include "AliRICHHit.h" +#include "AliRICHv2.h" +#include "AliRun.h" ClassImp(AliRICHv2) diff --git a/RICH/AliRICHv3.cxx b/RICH/AliRICHv3.cxx index a2501147d74..6de87f681cb 100644 --- a/RICH/AliRICHv3.cxx +++ b/RICH/AliRICHv3.cxx @@ -13,27 +13,27 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -#include "AliRICHv3.h" -#include "AliRun.h" -#include "AliMagF.h" - -#include "AliConst.h" -#include "AliPDG.h" +/* $Id$ */ #include -#include -#include -#include +#include +#include #include -#include +#include #include +#include +#include - +#include "AliConst.h" +#include "AliMagF.h" +#include "AliPDG.h" #include "AliRICHGeometry.h" -#include "AliRICHSegmentationV1.h" -#include "AliRICHResponseV0.h" #include "AliRICHHit.h" +#include "AliRICHResponseV0.h" +#include "AliRICHSegmentationV1.h" +#include "AliRICHv3.h" +#include "AliRun.h" ClassImp(AliRICHv3) diff --git a/START/AliSTART.cxx b/START/AliSTART.cxx index b9fa903839a..431e25e7696 100755 --- a/START/AliSTART.cxx +++ b/START/AliSTART.cxx @@ -13,84 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.26 2002/10/22 15:40:19 alibrary -Introducing Riostream.h - -Revision 1.25 2002/10/14 14:57:32 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.23.8.1 2002/07/24 09:50:10 alibrary -Updating VirtualMC - -Revision 1.24 2002/07/23 11:48:05 alla -new Digits structure - -Revision 1.23 2001/09/19 18:41:45 alla -Asimmetric START geometry - -Revision 1.22 2001/07/27 13:03:12 hristov -Default Branch split level set to 99 - -Revision 1.21 2001/06/27 16:06:59 hristov -Rotation matrix in BuildGeometry has been changed to rotx999 - -Revision 1.20.2.1 2001/06/27 10:51:15 alla -Rotation matrix in BuildGeometry has benn changed to rotx999 - -Revision 1.20 2001/05/16 14:57:21 alibrary -New files for folders and Stack - -Revision 1.19 2001/04/04 12:10:18 alla -changes according Coding Convension - -Revision 1.18 2001/03/12 17:46:43 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.17 2001/01/26 19:59:53 hristov -Major upgrade of AliRoot code - -Revision 1.16 2001/01/17 10:56:08 hristov -Corrections to destructors - -Revision 1.15 2001/01/01 13:10:42 hristov -Local definition of digits removed - -Revision 1.14 2000/12/22 16:17:15 hristov -Updated START code from Alla - -Revision 1.13 2000/12/18 11:39:41 alibrary -Quick fix to avoid crash in display waiting for new version - -Revision 1.12 2000/12/04 08:48:19 alibrary -Fixing problems in the HEAD - -Revision 1.11 2000/10/13 13:14:08 hristov -Bug fixes and code cleaning - -Revision 1.10 2000/10/02 21:28:13 fca -Removal of useless dependecies via forward declarations - -Revision 1.9 2000/07/13 16:41:29 fca -New START corrected for coding conventions - -Revision 1.8 2000/03/27 17:24:25 alla -Modifing geometry - -Revision 1.6 2000/01/21 15:45:23 fca -New Version from Alla - -Revision 1.5 2000/01/19 17:17:15 fca -Introducing a list of lists of hits -- more hits allowed for detector now - -Revision 1.4 1999/11/12 15:04:00 fca -Modifications from A.Maevskaya - -Revision 1.3 1999/09/29 09:24:29 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -114,17 +37,18 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// -#include #include -#include "TMath.h" -#include "TTUBE.h" -#include "TNode.h" -#include "TRandom.h" -#include "TGeometry.h" -#include "TFile.h" -#include "TParticle.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "AliLoader.h" #include "AliRun.h" #include "AliSTART.h" #include "AliSTARTdigit.h" @@ -269,7 +193,7 @@ void AliSTART::Init() } //--------------------------------------------------------------------------- -void AliSTART::MakeBranch(Option_t* option, const char *file) +void AliSTART::MakeBranch(Option_t* option) { // // Specific START branches @@ -279,31 +203,24 @@ void AliSTART::MakeBranch(Option_t* option, const char *file) char branchname[20]; sprintf(branchname,"%s",GetName()); - AliDetector::MakeBranch(option,file); const char *cD = strstr(option,"D"); const char *cH = strstr(option,"H"); - if (cH) + if (cH && fLoader->TreeH()) { + if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); sprintf (branchname, "%shitPhoton", GetName()); - MakeBranchInTree (gAlice->TreeH(), branchname, &fPhotons, 50000, file); + MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0); + if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); } - + AliDetector::MakeBranch(option); + if (cD) { digits = new AliSTARTdigit(); - MakeBranchInTree(gAlice->TreeD(), - branchname, "AliSTARTdigit", digits, buffersize, 1, file); + MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0); } -/* - char *cR = strstr(option,"R"); - - if (cR) { - MakeBranchInTree(gAlice->TreeR(), - branchname, "Int_t", &fZposit, buffersize, 1, file); - } - */ } //_____________________________________________________________________________ @@ -318,18 +235,22 @@ void AliSTART::ResetHits() //_____________________________________________________________________________ void AliSTART::SetTreeAddress() { - TBranch *branch; - TTree *treeH; - - AliDetector::SetTreeAddress(); - treeH = gAlice->TreeH(); + TBranch *branch; + TTree *treeH; + + + treeH = TreeH(); if (treeH) - if (fPhotons) { - branch = treeH->GetBranch ("STARThitPhoton"); - if (branch) branch->SetAddress (&fPhotons); + if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); + branch = treeH->GetBranch("STARThitPhoton"); + if (branch) branch->SetAddress(&fPhotons); + if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); } + + AliDetector::SetTreeAddress(); + } @@ -337,127 +258,5 @@ void AliSTART::SetTreeAddress() void AliSTART::Hit2digit(Int_t evnum) { - // - // From hits to digits - // - /* - Float_t x,y,e; - Int_t nbytes = 0; - Int_t hit; - Int_t nhits; - Int_t volume,pmt; - char nameTH[8],nameTD[8]; - Float_t timediff,timeright,timeleft,timeav; - Float_t besttimeright,besttimeleft,meanTime; - Int_t channelWidth=10; - - TParticle *particle; - AliSTARThit *startHit; - - Int_t buffersize=256; - - digits= new AliSTARTdigit(); - TBranch *bDig=0; - - - // Event ------------------------- LOOP - - sprintf(nameTD,"TreeD%d",evnum); - TTree *td = new TTree(nameTD,"START"); - bDig = td->Branch("START","AliSTARTdigit",&digits,buffersize); - - besttimeright=9999.; - besttimeleft=9999.; - Int_t timeDiff=0; - Int_t timeAv=0; - - Int_t nparticles = gAlice->GetEvent(evnum); - if (nparticles <= 0) return; - printf("\n nparticles %d\n",nparticles); - - - sprintf(nameTH,"TreeH%d",evnum); - printf("%s\n",nameTH); - TTree *th = gAlice->TreeH(); - Int_t ntracks = (Int_t) th->GetEntries(); - if (ntracks<=0) return; - // Start loop on tracks in the hits containers - for (Int_t track=0; trackResetHits(); - nbytes += th->GetEvent(track); - particle=gAlice->Particle(track); - nhits =fHits->GetEntriesFast(); - - for (hit=0;hitUncheckedAt(hit); - pmt=startHit->fPmt; - e=startHit->fEtot; - x=startHit->X(); - y=startHit->Y(); - volume = startHit->fVolume; - if(volume==1){ - timeright = startHit->fTime; - if(timerightfTime; - // printf("timeleft %f\n",timeleft); - if(timeleftGaus(besttimeright,0.05); - Float_t besttimeleftGaus=gRandom->Gaus(besttimeleft,0.05); - timediff=besttimerightGaus-besttimeleftGaus; - meanTime=(besttimerightGaus+besttimeleftGaus)/2.; - if ( TMath::Abs(timediff)<2. && meanTime<3.) - { - //we assume centre of bunch is 5ns after TTS signal - //TOF values are relative of the end of bunch - Float_t ppBunch=25; - - ppBunch=ppBunch-10/2; - Float_t t1=1000.*besttimeleftGaus; - Float_t t2=1000.*besttimerightGaus; - t1=t1/channelWidth+ppBunch; //time in ps to channelWidth - t2=t2/channelWidth+ppBunch; //time in ps to channelWidth - - timeav=(t1+t2)/2.; - - // Time to TDC signal - // 256 channels for timediff, range 1ns - - timediff=128+1000*timediff/channelWidth; // time in ps - - timeAv = (Int_t)(timeav); // time (ps) channel numbres - timeDiff = (Int_t)(timediff); // time ( ps) channel numbres - digits->Set(timeAv,timeDiff); - } - else - {timeAv=999999; timeDiff=99999;} - - td->Fill(); - printf("digits-> %d \n",digits->GetTime()); - td->Write(); - */ } - - - - - - - - - - - - - diff --git a/START/AliSTART.h b/START/AliSTART.h index 083b863e035..004f4a1a0eb 100755 --- a/START/AliSTART.h +++ b/START/AliSTART.h @@ -38,7 +38,7 @@ public: {b1->SetAddress(&fHits); b2=0;} void Hit2digit(Int_t iEventNum); void Hit2digit(){return;} - virtual void MakeBranch(Option_t *opt=" ", const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void StepManager(){} virtual void ResetHits(); virtual void SetTreeAddress(); @@ -46,12 +46,12 @@ public: protected: Int_t fIdSens; // Sensetive Cherenkov radiator - Int_t fNPhotons; // Number of photons plan to photokatod + Int_t fNPhotons; // Number of photons plan to photokatod - TClonesArray *fPhotons; // List of photons + TClonesArray *fPhotons; //! List of photons private: - ClassDef(AliSTART,2) //Base class for the T0 aka START detector + ClassDef(AliSTART,3) //Base class for the T0 aka START detector }; //_____________________________________________________________________________ diff --git a/START/AliSTARTDigitizer.cxx b/START/AliSTARTDigitizer.cxx index 90fd8be0066..9c3ae72d0b6 100644 --- a/START/AliSTARTDigitizer.cxx +++ b/START/AliSTARTDigitizer.cxx @@ -35,6 +35,8 @@ #include "AliGenEventHeader.h" #include "AliRun.h" #include "AliPDG.h" +#include "AliLoader.h" +#include "AliRunLoader.h" #include #include @@ -84,7 +86,13 @@ Bool_t AliSTARTDigitizer::Init() void AliSTARTDigitizer::Exec(Option_t* option) { - cout<<" AliSTARTDigitizer::Exec"<GetOutputFolderName()); + outgime = outRL->GetLoader("STARTLoader"); + #ifdef DEBUG cout<<"AliSTARTDigitizer::>SDigits2Digits start...\n"; #endif @@ -94,7 +102,6 @@ void AliSTARTDigitizer::Exec(Option_t* option) Int_t hit, nhits; Int_t CountEr[13],CountEl[13]; //!!! Int_t volume,pmt,tr,tl,sumRight; - char nameDigits[20]; Float_t timediff,timeav; Float_t besttimeright,besttimeleft,meanTime; Int_t bestRightADC,bestLeftADC; @@ -137,9 +144,14 @@ void AliSTARTDigitizer::Exec(Option_t* option) CountEr[i0]=0; CountEl[i0]=0; } TClonesArray *STARThits = START->Hits (); + + inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + ingime = inRL->GetLoader("STARTLoader"); + ingime->LoadHits("READ");//probably it is necessary to load them before TClonesArray *STARThitsPhotons = START->Photons (); - TTree *th = fManager->GetInputTreeH(inputFile); + + TTree *th = ingime->TreeH(); brHits = th->GetBranch("START"); brHitPhoton = th->GetBranch("STARThitPhoton"); if (brHits) { @@ -267,20 +279,9 @@ void AliSTARTDigitizer::Exec(Option_t* option) } else {timeAv=999999; timeDiff=99999;} - - // trick to find out output dir: - TTree *outTree = fManager->GetTreeD(); - if (!outTree) { - cerr<<"something wrong with output...."<GetDirectory()->cd(); - sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr()); - fdigits->Write(nameDigits); - cout<cd(); + +// trick to find out output dir: + outgime->WriteDigits("OVERWRITE"); } } diff --git a/START/AliSTARTdigit.cxx b/START/AliSTARTdigit.cxx index 6c5d519e48b..584090b6874 100644 --- a/START/AliSTARTdigit.cxx +++ b/START/AliSTARTdigit.cxx @@ -12,27 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/14 14:57:32 hristov -Merging the VirtualMC branch to the main development branch (HEAD) -Revision 1.4.12.1 2002/07/24 09:50:10 alibrary -Updating VirtualMC - -Revision 1.5 2002/07/23 11:48:05 alla -new Digits structure - -Revision 1.4 2000/10/13 13:14:08 hristov -Bug fixes and code cleaning - -Revision 1.3 2000/07/13 16:41:29 fca -New START corrected for coding conventions - -Revision 1.2 2000/03/24 17:40:35 alla -New AliSTART - -*/ +/* $Id$ */ #include #include "AliSTARTdigit.h" diff --git a/START/AliSTARTv0.cxx b/START/AliSTARTv0.cxx index 937e16068c1..1ae8b3110fa 100755 --- a/START/AliSTARTv0.cxx +++ b/START/AliSTARTv0.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.15 2002/10/22 15:40:19 alibrary -Introducing Riostream.h - -Revision 1.14 2001/10/19 05:29:38 alla -bug in meduim fixed - -Revision 1.13 2001/09/19 18:41:59 alla -Asimmetric START geometry - -Revision 1.12 2001/04/25 14:09:34 alla -Curent bur fixed - -Revision 1.11 2001/04/04 12:10:18 alla -changes according Coding Convension - -Revision 1.10 2000/12/04 08:48:19 alibrary -Fixing problems in the HEAD - -Revision 1.9 2000/10/02 21:28:13 fca -Removal of useless dependecies via forward declarations - -Revision 1.8 2000/07/13 16:41:29 fca -New START corrected for coding conventions - -Revision 1.7 2000/01/21 15:45:23 fca -New Version from Alla - -Revision 1.6 1999/11/12 15:04:00 fca -Modifications from A.Maevskaya - -Revision 1.5 1999/09/29 09:24:29 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ ///////////////////////////////////////////////////////////////////// // // @@ -63,20 +28,20 @@ Introduction of the Copyright and cvs Log // // ////////////////////////////////////////////////////////////////////// -#include +#include +#include + #include -#include -#include #include +#include +#include +#include +#include -#include "AliSTARTv0.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliRun.h" #include "AliSTARThit.h" - -#include - -#include +#include "AliSTARTv0.h" ClassImp(AliSTARTv0) diff --git a/START/AliSTARTv1.cxx b/START/AliSTARTv1.cxx index 218f90f60b0..8c59fd9ddc3 100755 --- a/START/AliSTARTv1.cxx +++ b/START/AliSTARTv1.cxx @@ -27,20 +27,20 @@ // // ////////////////////////////////////////////////////////////////////// -#include +#include +#include + #include -#include -#include #include +#include +#include +#include +#include -#include "AliSTARTv1.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliRun.h" #include "AliSTARThit.h" - -#include - -#include +#include "AliSTARTv1.h" ClassImp(AliSTARTv1) diff --git a/START/AliSTARTv2.cxx b/START/AliSTARTv2.cxx index cdd8fe99761..3f17c686ce1 100644 --- a/START/AliSTARTv2.cxx +++ b/START/AliSTARTv2.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + ///////////////////////////////////////////////////////////////////// // // // START ( T-zero) detector version 0 // @@ -29,20 +31,22 @@ #define RIGHT_ARRAY 1 #define LEFT_ARRAY 2 -#include +#include +#include + #include -#include -#include #include +#include +#include +#include +#include -#include "AliSTARTv2.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliRun.h" #include "AliSTARThit.h" - -#include - -#include +#include "AliSTARTv2.h" +//#include "AliSTARThitPhoton.h" +//#include "TGeant3.h" ClassImp(AliSTARTv2) diff --git a/START/AliSTARTvertex.cxx b/START/AliSTARTvertex.cxx index 8277944a5bd..03870f6a5c9 100644 --- a/START/AliSTARTvertex.cxx +++ b/START/AliSTARTvertex.cxx @@ -12,57 +12,20 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2002/10/22 15:40:19 alibrary -Introducing Riostream.h -Revision 1.10 2002/10/14 14:57:32 hristov -Merging the VirtualMC branch to the main development branch (HEAD) +/* $Id$ */ -Revision 1.6.6.2 2002/07/24 09:50:10 alibrary -Updating VirtualMC - -Revision 1.9 2002/07/23 11:48:05 alla -new Digits structure - -Revision 1.8 2002/04/16 10:52:41 hristov -Wrong usage of exit() corrected (Sun) - -Revision 1.7 2002/04/15 08:04:01 alla -Digits and reconstruction with TObject - -Revision 1.6 2001/10/19 05:29:38 alla -bug in meduim fixed - -Revision 1.5 2001/07/27 13:03:12 hristov -Default Branch split level set to 99 - -Revision 1.4 2000/12/22 16:17:15 hristov -Updated START code from Alla - -Revision 1.3 2000/10/02 21:28:13 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/07/13 16:41:29 fca -New START corrected for coding conventions +#include +#include -Revision 1.1 2000/03/24 17:46:58 alla -Vertex reconstruction +#include +#include -*/ -#include "TObject.h" -#include "AliSTARTvertex.h" +#include "AliRun.h" +#include "AliSTART.h" #include "AliSTARTdigit.h" #include "AliSTARThit.h" -#include "AliSTART.h" -#include "AliRun.h" - -//#include "TTree.h" -#include "TDirectory.h" -#include -#include -#include +#include "AliSTARTvertex.h" ClassImp(AliSTARTvertex) @@ -119,19 +82,9 @@ void AliSTARTvertex::Reconstruct(Int_t evNumber=1) cout<<" Zposit "<Set((Int_t) Zposit); } - /* - TTree *outTreeR = gAlice->TreeR(); - if (!outTreeR) { - cerr<<"something wrong with output...."<GetDirectory()->cd(); - fvertex->Write(nameTR); - // wd->cd(); + fvertex->Write(nameTR); } diff --git a/START/readDigits.C b/START/readDigits.C index ee6f59cb8f9..2ee8df315bf 100644 --- a/START/readDigits.C +++ b/START/readDigits.C @@ -10,7 +10,7 @@ void readDigits(Int_t evNumber=1) // Connect the Root Galice file containing Geometry, Kine and Hits TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); - if (!file) file = new TFile("galice.root","UPDATE"); + if (!file) file = new TFile("production.root","UPDATE"); // Get AliRun object from file or create it if not on file if (!gAlice) { diff --git a/START/readVertex.C b/START/readVertex.C index 0136056cb81..273de62312e 100644 --- a/START/readVertex.C +++ b/START/readVertex.C @@ -10,7 +10,7 @@ void readVertex(Int_t evNumber=1) // Connect the Root Galice file containing Geometry, Kine and Hits TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); - if (!file) file = new TFile("~/w0/START/galice.root","UPDATE"); + if (!file) file = new TFile("production.root","UPDATE"); // Get AliRun object from file or create it if not on file if (!gAlice) { diff --git a/STEER/AliConfig.cxx b/STEER/AliConfig.cxx index 933c934ab28..63331ca6a0f 100644 --- a/STEER/AliConfig.cxx +++ b/STEER/AliConfig.cxx @@ -15,30 +15,95 @@ /* $Id$ */ -// Class for configuration of TFolder and TTasks -// in AliRoot. Used by AliRun, AliGenerator, -// AliModule and AliDetector classes -// as well as by the PHOS and EMCAL Getters -// Author: Originally developed by the PHOS group +// Description: +// This class is responsible for creating folder structure +// All stuff of aliroot sits in one folder with name defined by +// fgkTopFolderName data wich do not very trough event to event are +// sitting in directly in "top folder" all data which changes from +// event to event are sitting in one folder (which has more subfolders) +// Idea is to have more than one event in folder structure which allows +// usage of standard procedures in merging +// Add(AliDetector*) calls Add(AliModule*) as AliDetector is a AliModule +// as well and should be listed in module list -#include #include #include #include +#include #include +#include #include +#include #include #include "AliConfig.h" #include "AliDetector.h" #include "AliGenerator.h" -#include "TObjString.h" -#include "TString.h" -#include "TTask.h" - +#include "AliLoader.h" + +enum + { + kDetTaskQA = 0, + kDetTaskSDigitizer, + kDetTaskDigitizer, + kDetTaskRecontructioner, + kDetTaskTracker, + kDetTaskPID, + kDetTaskLast + }; + +enum + { + kDetFolderData = 0, + kDetFolderCalibration, + kDetFolderAligmnet, + kDetFolderQA, + kDetFolderLast + }; ClassImp(AliConfig) -AliConfig* AliConfig::fgInstance = 0; +AliConfig* AliConfig::fInstance = 0; + +//0 level folder +const TString AliConfig::fgkTopFolderName("Folders"); + +//1st level folder +const TString AliConfig::fgkTasksFolderName("Tasks"); //task folder, commn +const TString AliConfig::fgkConstantsFolderName("Constants"); +const TString AliConfig::fgkDefaultEventFolderName("Event"); //default folder for event, always used except merging + +//2st level folder +//subfolder of event folder +const TString AliConfig::fgkDataFolderName("Data");//folder for data (hits, digits, points, tracks) grouped by detectors +const TString AliConfig::fgkModuleFolderName("Modules");//folder with modules objects +const TString AliConfig::fgkConditionsFolderName("Conditions");//folder with conditions (mag. field etc.) +const TString AliConfig::fgkConfigurationFolderName("Configuration");//folder with configuration (setup) of the detector +const TString AliConfig::fgkHeaderFolderName("Header");//folder with header and other MC information + +//Tasks names, goes into fgkTasksFolderName folder +const TString AliConfig::fgkDigitizerTaskName("Digitizer"); +const TString AliConfig::fgkSDigitizerTaskName("SDigitizer"); +const TString AliConfig::fgkReconstructionerTaskName("Reconstructioner"); +const TString AliConfig::fgkTrackerTaskName("Tracker"); +const TString AliConfig::fgkPIDTaskName("PIDTask");//;=) PIDer??? +const TString AliConfig::fgkQATaskName("QAtask"); + +//3rd level folder +//fgkConditionsFolderName subfolders +const TString AliConfig::fgkCalibrationFolderName("Calibration"); +const TString AliConfig::fgkAligmentFolderName("Aligment"); +const TString AliConfig::fgkQAFolderName("QAout"); + +//3rd level folder +//fgkConfigurationFolderName subfolders +const TString AliConfig::fgkFieldFolderName("Field"); +const TString AliConfig::fgkGeneratorsFolderName("Generators"); +const TString AliConfig::fgkVirtualMCFolderName("VirtualMC"); + + +const TString AliConfig::fgkPDGFolderName("Constants/DatabasePDG");//folder with PDG Database +const TString AliConfig::fgkGeneratorFolderName("Configuration/Generators");//folder with generators +const TString AliConfig::fgkMCFolderName("Configuration/VirtualMC"); //____________________________________________________________________________ AliConfig* AliConfig::Instance () @@ -46,242 +111,157 @@ AliConfig* AliConfig::Instance () // // Instance method for singleton class // - if(!fgInstance) fgInstance = new AliConfig ("Folders","Alice data exchange"); - - return fgInstance; + if(fInstance == 0) + { + fInstance = new AliConfig (fgkTopFolderName,"Alice data exchange board"); + } + return fInstance; } //____________________________________________________________________________ AliConfig::AliConfig(): - fTopFolder(0), - fTasks(0), - fPDGFolder(0), - fGeneratorFolder(0), - fMCFolder(0), - fModuleFolder(0), - fDetectorFolder(0), - fDetectorTask(0) + fTopFolder(0x0), + fTaskFolder(0x0), + fConstFolder(0x0), + fDetectorTask(0x0), + fDetectorFolder(0x0) { // // Default constructor, mainly to keep coding conventions // - fgInstance=0; - - Fatal("ctor", - "Constructor should not be called for a singleton\n"); + fInstance=0;//never mind, its going to exit in next step + Fatal("ctor","Constructor should not be called for a singleton\n"); } - //____________________________________________________________________________ + AliConfig::AliConfig(const AliConfig& conf): - TNamed(conf), - fTopFolder(0), - fTasks(0), - fPDGFolder(0), - fGeneratorFolder(0), - fMCFolder(0), - fModuleFolder(0), - fDetectorFolder(0), - fDetectorTask(0) + fTopFolder(0x0), + fTaskFolder(0x0), + fConstFolder(0x0), + fDetectorTask(0x0), + fDetectorFolder(0x0) { // // Copy constructor, mainly to keep coding conventions // - fgInstance=0; + fInstance=0; Fatal("copy ctor", "Copy constructor should not be called for a singleton\n"); } - //____________________________________________________________________________ + AliConfig::AliConfig(const char *name, const char *title): TNamed(name,title), - fTopFolder(gROOT->GetRootFolder ()->AddFolder (name,title)), - fTasks(0), - fPDGFolder("Constants/DatabasePDG"), - fGeneratorFolder("RunMC/Configuration/Generators"), - fMCFolder("RunMC/Configuration/VirtualMC"), - fModuleFolder("Run/Configuration/Modules"), - fDetectorFolder(new const char*[kFolders]), - fDetectorTask(new const char*[kTasks]) + fTopFolder(gROOT->GetRootFolder()->AddFolder(name,title)), + fTaskFolder(fTopFolder->AddFolder(fgkTasksFolderName, "ALICE Tasks")), + fConstFolder(0x0), + fDetectorTask(0x0), + fDetectorFolder(new TString[kDetFolderLast+1]) { - // - // Constructor - // - fgInstance=this; - - fDetectorFolder[0] = "Run/Conditions/Calibration" ; - fDetectorFolder[1] = "Run/Event/Data" ; - fDetectorFolder[2] = "Run/Event/RecData" ; - fDetectorFolder[3] = "RunMC/Event/Data/Hits" ; - fDetectorFolder[4] = "RunMC/Event/Data/SDigits" ; - fDetectorFolder[5] = "Run/Conditions/QA" ; - fDetectorFolder[6] = "RunMC/Event/Data/TrackReferences" ; - fDetectorFolder[7] = 0 ; - fDetectorTask[0] = "Tasks/QA" ; - fDetectorTask[1] = "Tasks/SDigitizer" ; - fDetectorTask[2] = "Tasks/Digitizer" ; - fDetectorTask[3] = "Tasks/Reconstructioner" ; - fDetectorTask[4] = 0 ; - - fTopFolder->SetOwner() ; - gROOT->GetListOfBrowsables ()->Add (fTopFolder, name); - - TFolder *subfolder; - - TFolder *constants = - fTopFolder->AddFolder ("Constants", "Detector constants"); - - subfolder = - constants->AddFolder ("DatabasePDG", "PDG database"); - - TFolder *run = - fTopFolder->AddFolder ("Run", "Run dependent folders"); - - TFolder *conditions = - run->AddFolder ("Conditions", "Run conditions"); - - subfolder = - conditions->AddFolder ("Calibration","Detector calibration data"); - - subfolder = - conditions->AddFolder ("Aligment", "Detector aligment"); - - subfolder = - conditions->AddFolder ("QA", "Detector QA"); - - TFolder *configuration = - run->AddFolder ("Configuration", "Run configuration"); - - subfolder = - configuration->AddFolder ("Modules", "Detector objects"); - - subfolder = - configuration->AddFolder ("Field", "Magnetic field maps"); - - TFolder *event = - run->AddFolder ("Event", "Event folders"); - - subfolder = - event->AddFolder ("Data", "Detector raw data"); - - subfolder = - event->AddFolder ("RecData", "Detectors reconstucted data"); - - TFolder *runMC = - fTopFolder->AddFolder ("RunMC", "MonteCarlo run dependent folders"); - - TFolder *configurationMC = - runMC->AddFolder ("Configuration","MonteCarlo run configuration"); - - subfolder = - configurationMC->AddFolder ("Generators","list of generator objects"); - - subfolder = - configurationMC->AddFolder ("VirtualMC", "the Virtual MC"); - - TFolder *eventMC = - runMC->AddFolder ("Event", "MonteCarlo event folders"); - - subfolder = - eventMC->AddFolder ("Header", "MonteCarlo event header"); - - // subfolder = - // eventMC->AddFolder ("Kinematics", "MonteCarlo generated particles"); +// Constructor + + //Main AliRoot Folder + if (fTopFolder == 0x0) + { + Fatal("AliConfig(const char*, const char*)","Can not create Top Alice Folder."); + return;//never reached + } + fTopFolder->SetOwner(); - TFolder *dataMC = - eventMC->AddFolder ("Data", "MonteCarlo data"); + fDetectorFolder[kDetFolderData] = fgkDataFolderName; + fDetectorFolder[kDetFolderCalibration] = fgkConditionsFolderName+"/"+fgkCalibrationFolderName; + fDetectorFolder[kDetFolderAligmnet] = fgkConditionsFolderName+"/"+fgkAligmentFolderName; + fDetectorFolder[kDetFolderQA] = fgkConditionsFolderName+"/"+fgkQAFolderName; + fDetectorFolder[kDetFolderLast] = ""; - subfolder = - dataMC->AddFolder ("Hits", "MonteCarlo Hits") ; - - subfolder = - dataMC->AddFolder ("SDigits", "MonteCarlo SDigits") ; - - subfolder = - dataMC->AddFolder ("TrackReferences", "MonteCarlo track references") ; - + gROOT->GetListOfBrowsables()->Add(fTopFolder, name); + //Constants folder + TFolder *fConstFolder = fTopFolder->AddFolder (fgkConstantsFolderName, "Constant parameters"); + fConstFolder->AddFolder("DatabasePDG", "PDG database"); // Add the tasks to //Folders - TFolder * tasksfolder = fTopFolder->AddFolder("Tasks", "ALICE Tasks") ; - - TTask * qa = new TTask("QA", "Alice QA tasks") ; - tasksfolder->Add(qa); - - TTask * sd = new TTask("SDigitizer", "Alice SDigitizer") ; - tasksfolder->Add(sd); - - TTask * di = new TTask("Digitizer", "Alice Digitizer") ; - tasksfolder->Add(di); - - TTask * re = new TTask("Reconstructioner", "Alice Reconstructioner") ; - tasksfolder->Add(re); - + TTask * qa = new TTask(fgkQATaskName, "Alice QA tasks"); + fTaskFolder->Add(qa); + TTask * sd = new TTask(fgkSDigitizerTaskName, "Alice SDigitizer") ; + fTaskFolder->Add(sd); + TTask * di = new TTask(fgkDigitizerTaskName, "Alice Digitizer") ; + fTaskFolder->Add(di); + TTask * re = new TTask(fgkReconstructionerTaskName, "Alice Reconstructioner") ; + fTaskFolder->Add(re); + TTask * tr = new TTask(fgkTrackerTaskName,"Alice Tracker"); + fTaskFolder->Add(tr); + TTask * pid = new TTask(fgkPIDTaskName,"Alice Particle Identification Task"); + fTaskFolder->Add(pid); + fDetectorTask = new TString[kDetTaskLast+1]; + + fDetectorTask[kDetTaskQA] = fgkQATaskName; + fDetectorTask[kDetTaskSDigitizer] = fgkSDigitizerTaskName; + fDetectorTask[kDetTaskDigitizer] = fgkDigitizerTaskName; + fDetectorTask[kDetTaskRecontructioner] = fgkReconstructionerTaskName; + fDetectorTask[kDetTaskTracker] = fgkTrackerTaskName; + fDetectorTask[kDetTaskPID] = fgkPIDTaskName; + fDetectorTask[kDetTaskLast] = ""; + + fInstance=this; } //____________________________________________________________________________ AliConfig::~AliConfig() { - // destructor delete [] fDetectorFolder ; - delete fDetectorTask ; - delete fTopFolder ; + delete [] fDetectorTask; + if (fTopFolder) + { + fTopFolder->SetOwner(); + delete fTopFolder; + } } - //____________________________________________________________________________ + void AliConfig::AddInFolder (const char *dir, TObject *obj) { - // Adds an object "obj" to a folder named "dir" - TFolder *folder = - dynamic_cast(fTopFolder->FindObject(dir)); + TFolder *folder = dynamic_cast(fTopFolder->FindObject(dir)); if (folder) folder->Add (static_cast(obj)); } - //____________________________________________________________________________ -void AliConfig::AddSubFolder(const char * dir[], TObject *obj) -{ - // Adds a subfolder taken from "obj" to all the folders from dir, - // which are found in the top folder - int iDir = 0; - - while (dir[iDir]) - { - TFolder * folder = dynamic_cast(fTopFolder->FindObject (dir[iDir++])); - if (folder) { - TFolder * subfolder = dynamic_cast(folder->FindObject (obj->GetName())); - if (!subfolder) - subfolder = folder->AddFolder (obj->GetName(),obj->GetTitle()); - } - } -} -//____________________________________________________________________________ -void AliConfig::AddSubTask(const char * dir[], TObject *obj) +Int_t AliConfig::AddSubTask(const char *taskname, const char* name,const char* title) { - // Adds a subtask taken from "obj" to all the folders from dir, - // which are found in the top folder - int iDir = 0; - - while (dir[iDir]) - { - TTask * task = dynamic_cast(fTopFolder->FindObject (dir[iDir++])); - if (task) { - TTask * subtask = static_cast(task->GetListOfTasks()->FindObject (obj->GetName())); - if (!subtask) { - subtask = new TTask(obj->GetName(), obj->GetTitle()) ; - task->Add(subtask); - } - } - } +//Create new task named 'name' and titled 'title' +//as a subtask of the task named 'taskname' + + if (AliLoader::fgDebug) Info("AddSubTask","Try to get folder named %s",taskname); + TObject* obj = fTopFolder->FindObject(taskname); + TTask * task = (obj)?dynamic_cast(obj):0x0; + if (task) + { + if (AliLoader::fgDebug) Info("AddSubTask"," Got"); + TTask * subtask = static_cast(task->GetListOfTasks()->FindObject(name)); + if (!subtask) + { + subtask = new TTask(name,title); + task->Add(subtask); + } + else + { + Warning("AddSubTask","Task named \"%s\" already exists in Task %s\n",name,taskname); + } + } + else + { + Error("AddSubTask","Can not find task %s to put a new task in.",taskname); + return 1; + } + return 0; } //____________________________________________________________________________ TObject* AliConfig::FindInFolder (const char *dir, const char *name) { - // Searches for object with "name" in the top directory and in - // the directory "dir" if(!name) return(fTopFolder->FindObject(name)); TFolder * folder = dynamic_cast(fTopFolder->FindObject(dir)); if (!folder) return (NULL); @@ -289,54 +269,163 @@ TObject* AliConfig::FindInFolder (const char *dir, const char *name) } //____________________________________________________________________________ -void AliConfig::Add (AliGenerator * obj) +void AliConfig::Add (AliGenerator * obj,const char* eventfolder) { - // Adds new AliGenerator to the generator's folder - AddInFolder(fGeneratorFolder, obj); + TString path(eventfolder); + path = path + "/" + fgkGeneratorsFolderName; + AddInFolder(path,obj); } //____________________________________________________________________________ -void AliConfig::Add (TVirtualMC * obj) +void AliConfig::Add (TVirtualMC * obj,const char* eventfolder) { - // Adds new object of type TVirtualMC to the MC folder - AddInFolder(fMCFolder, obj); + TString path(eventfolder); + path = path + "/" + fgkMCFolderName; + AddInFolder(path, obj); } //____________________________________________________________________________ -void AliConfig::Add (TDatabasePDG * obj) +void AliConfig::Add (TDatabasePDG * obj) { - // Adds new TDatabasePDG to the PDG folder - AddInFolder(fPDGFolder, obj); + AddInFolder(fgkPDGFolderName, obj); } //____________________________________________________________________________ -void AliConfig::Add (AliModule* obj) +void AliConfig::Add(AliModule* obj,const char* eventfolder) { - // Adds new module to the folder of modules - AddInFolder(fModuleFolder, obj); + + TString path(eventfolder); + path = path + "/" + fgkModuleFolderName; + if (AliLoader::fgDebug) + Info("Add(AliModule*)","module name = %s, Ev. Fold. Name is %s.", + obj->GetName(),eventfolder); + AddInFolder(path, obj); } +//____________________________________________________________________________ +Int_t AliConfig::AddDetector(TFolder* evntfolder, const char *name, const char* title) +{ +//creates folders and tasks for the detector 'name' + Int_t retval;//returned value + retval = CreateDetectorFolders(evntfolder,name,title); + if (retval) + { + Error("AddDetector","CreateDetectorFolders returned error for detector %s",name); + return retval; + } + return 0; +} //____________________________________________________________________________ -void AliConfig::Add (AliDetector * obj) + +Int_t AliConfig::AddDetector(const char* evntfoldername,const char *name, const char* title) { - // Adds new detector to the detctor's folder as well as to - // the detector's task - AddSubFolder(fDetectorFolder, obj); - AddSubTask(fDetectorTask, obj); +//creates folders and tasks for the detector 'name' + Int_t retval;//returned value + retval = CreateDetectorFolders(evntfoldername,name,title); + if (retval) + { + Error("AddDetector","CreateDetectorFolders returned error for detector %s",name); + return retval; + } +// retval = CreateDetectorTasks(name,title); +// if (retval) +// { +// Error("AddDetector","CreateDetectorTasks returned error for detector %s",name); +// return retval; +// } + return 0; } +//____________________________________________________________________________ +void AliConfig::Add(AliDetector * obj,const char* eventfolder) +{ + if (AliLoader::fgDebug) + Info("Add(AliDetector*)","detector name = %s, Ev. Fold. Name is %s.", + obj->GetName(),eventfolder); + + TObject* foundobj = GetTopFolder()->FindObject(eventfolder); + TFolder* evfolder = (foundobj)?dynamic_cast(foundobj):0x0; + if (evfolder == 0x0) + { + Fatal("Add(AliDetector * obj,const char* eventfolder)", + "Can not find folder %s while adding detector %s",eventfolder,obj->GetName()); + return; + } + CreateDetectorFolders(evfolder, obj->GetName(), obj->GetTitle()); + +// CreateDetectorTasks(obj->GetName(),obj->GetTitle()); + +} +//____________________________________________________________________________ + +Int_t AliConfig::CreateDetectorFolders(const char* evntfoldername,const char *name, const char* title) +{ +//creates a folders for detector named 'name' and titled 'title' +//in a event folder named 'evntfoldername' +//list of folder names where new folders are created is defined in fDetectorFolder array +//detector folders are named 'name' and titled 'title' as well + + TFolder* evfolder = dynamic_cast(GetTopFolder()->FindObject(evntfoldername)); + if (evfolder == 0x0) + { + Error("CreateDetectorFolders", + "Can not find folder %s while adding detector %s",evntfoldername,name); + return 1; + } + return CreateDetectorFolders(evfolder,name,title); +} +//____________________________________________________________________________ +Int_t AliConfig::CreateDetectorFolders(TFolder* evntfolder,const char *name, const char* title) +{ +//creates a folders for detector named 'name' and titled 'title' +//in a event folder 'evntfolder' +//list of folder names where new folders are created is defined in fDetectorFolder array +//detector folders are named 'name' and titled 'title' as well +//Here we add only detector not an modules + + Int_t tmp; + Int_t i = 0;//iterator + while(!fDetectorFolder[i].IsNull()) + { + tmp = AddSubFolder(evntfolder,fDetectorFolder[i],name,title); + if (tmp) + { + Error("AddDetector(TFolder*","Failed to create subfolder of %s for detector %s",fDetectorFolder[i].Data(),name); + return 1; + } + i++; + } + return 0; +} +//____________________________________________________________________________ +Int_t AliConfig::CreateDetectorTasks(const char *name, const char* title) +{ + Int_t i = 0; + Int_t tmp; + while (i < kDetTaskLast) + { + tmp = AddSubTask(fgkTasksFolderName+"/"+fDetectorTask[i], + name+fDetectorTask[i],(fDetectorTask[i]+" for ")+title); + if (tmp) + { + Error("CreateDetectorTasks","Error occured while creating task for %s in %s.", + name,fDetectorTask[i-1].Data()); + return 1; + } + i++; + } + return 0; +} //____________________________________________________________________________ void AliConfig::Add (char *list) { - // Finds in the list of directories all macros named Configure.C - // and Default.C and uses them to configure the setup char *path; - const char *confPath = gSystem->Getenv ("ALICE_CONFIG_PATH"); - if (confPath) { - path = new char[strlen (confPath)]; - strcpy (path, confPath); + const char *conf_path = gSystem->Getenv ("ALICE_CONFIG_PATH"); + if (conf_path) { + path = new char[strlen (conf_path)]; + strcpy (path, conf_path); } else { const char *alice = gSystem->Getenv ("ALICE_ROOT"); path = new char[strlen (alice) + 32]; @@ -361,57 +450,309 @@ void AliConfig::Add (char *list) token = strtok (list, " "); while (token != NULL) - { - cout << "Configuring " << token << ": "; + { + Info("Add(char *list)","Configuring token=%s",token); TObject *obj; TIter next (dirlist); TString found = "\0"; while ((obj = next ())) - { - TString dir(obj->GetName()); - TString tpath = dir + "/" + token; - TString macro = tpath + ".C"; - if (!gSystem->AccessPathName (macro.Data())) { - gInterpreter->ExecuteMacro (macro.Data()); - found = "(" + macro + ")"; - if (macro.Contains("/")) { - TString dirname = gSystem->DirName(macro.Data()); - TString macroConfigure = dirname + "/Configure.C"; - if (!gSystem->AccessPathName (macroConfigure.Data())) { - gInterpreter->ExecuteMacro (macroConfigure.Data()); - found += " => Configured"; - } - } - break; - } else { - TString macroDefault = tpath + "/Default.C"; - if (!gSystem->AccessPathName (macroDefault.Data())) { - gInterpreter->ExecuteMacro (macroDefault.Data()); - found = "(" + macro + ")"; - TString macroConfigure = tpath + "/Configure.C"; - if (!gSystem->AccessPathName (macroConfigure.Data())) { - gInterpreter->ExecuteMacro (macroConfigure.Data()); - found += " => Configured"; - } - break; - } - } - } + { + TString dir(obj->GetName()); + TString path = dir + "/" + token; + TString macro = path + ".C"; + if (!gSystem->AccessPathName (macro.Data())) + { + gInterpreter->ExecuteMacro (macro.Data()); + found = "(" + macro + ")"; + if (macro.Contains("/")) + { + TString dirname = gSystem->DirName(macro.Data()); + TString macroConfigure = dirname + "/Configure.C"; + if (!gSystem->AccessPathName (macroConfigure.Data())) + { + gInterpreter->ExecuteMacro (macroConfigure.Data()); + found += " => Configured"; + } + } + break; + } + else + { + TString macroDefault = path + "/Default.C"; + if (!gSystem->AccessPathName (macroDefault.Data())) + { + gInterpreter->ExecuteMacro (macroDefault.Data()); + found = "(" + macro + ")"; + TString macroConfigure = path + "/Configure.C"; + if (!gSystem->AccessPathName (macroConfigure.Data())) + { + gInterpreter->ExecuteMacro (macroConfigure.Data()); + found += " => Configured"; + } + break; + } + } + } - if (strlen(found.Data())) { - cout << found << " => OK" << endl; - } else { - cout << " => FAILED." << endl; - exit(1); - } + if (strlen(found.Data())) + { + Info("Add(char *list)","found=%s => OK",found.Data()); + } + else + { + Error("Add(char *list)"," => FAILED."); + exit(1); + } - token = strtok (NULL, " "); + token = strtok (NULL," "); } if (dirlist) delete dirlist; } +/*****************************************************************************/ + +TFolder* AliConfig::BuildEventFolder(const char* name,const char* title) +{ +/* + creates the folder structure for one event + TopFolder_ + | \ + | Tasks + |_ + | \ + | Constants + |_ + | \ + | Event_ + | | \ + | | Modules(detector objects) + | |_ + | | \ + | | Header + | |_ + | | \ + | | Data_ + | | | \ + | | | TPC_ + | | | | \ + | | | | Hits(object;e.g. tree) + | | | |_ + | | | | \ + | | | | SDigits(object) + | | | |_ + | | | | \ + | | | | Digits(object) + | | | |_ + | | | | \ + | | | | RecPoints(object) + | | | |_ + | | | \ + | | | Tracks(object) + | | |_ + | | \ + | | ITS_ + | | | \ + | | | Hits(object;e.g. tree) + | | |_ + | | | \ + | | | SDigits(object) + | | |_ + | | | \ + | | | Digits(object) + | | |_ + | | | \ + | | | RecPoints(object) + | | |_ + | | \ + | | Tracks(object) + | |_ + | \ + | Configuration + | + |_ + \ + Event2_ (to be merged with event) + | \ + | Modules(detector objects) + |_ + | \ + | Header + |_ + | \ + | Data_ + | | \ + | | TPC_ + | | | \ + | | | Hits(object;e.g. tree) + | | |_ + | | | \ + | | | SDigits(object) + | | |_ + | | | \ + | | | Digits(object) + | | |_ + | | | \ + | | | RecPoints(object) + | | |_ + | | \ + | | Tracks(object) + | |_ + | \ + | ITS_ + | | \ + | | Hits(object;e.g. tree) + | |_ + | | \ + | | SDigits(object) + | |_ + | | \ + | | Digits(object) + | |_ + | | \ + | | RecPoints(object) + | |_ + | \ + | Tracks(object) + |_ + \ + Configuration + +*/ + TFolder* eventfolder = fTopFolder->AddFolder(name,title); + + //modules + eventfolder->AddFolder(fgkModuleFolderName, "Detector objects"); + //event data + eventfolder->AddFolder(fgkDataFolderName, "Detector data"); + + //Conditions + TFolder *conditions = eventfolder->AddFolder(fgkConditionsFolderName, "Run conditions"); + conditions->AddFolder(fgkCalibrationFolderName,"Detector calibration data"); + conditions->AddFolder(fgkAligmentFolderName,"Detector aligment"); + conditions->AddFolder(fgkQAFolderName,"Quality Asurance Output"); //Folder with output of the QA task(s) + //Configuration + TFolder *configuration = eventfolder->AddFolder(fgkConfigurationFolderName, "Run configuration"); + configuration->AddFolder(fgkFieldFolderName, "Magnetic field maps"); + configuration->AddFolder(fgkGeneratorsFolderName,"list of generator objects"); + configuration->AddFolder(fgkVirtualMCFolderName,"the Virtual MC"); + + eventfolder->AddFolder(fgkHeaderFolderName,"MonteCarlo event header"); + + eventfolder->SetOwner(); + + return eventfolder; +} + +/*****************************************************************************/ +TString AliConfig::GetQATaskName() const + { + //returns task name + return fDetectorTask[kDetTaskQA]; + } +/*****************************************************************************/ + +TString AliConfig::GetDigitizerTaskName() const + { + //returns task name + return fDetectorTask[kDetTaskDigitizer]; + } +/*****************************************************************************/ + +TString AliConfig::GetSDigitizerTaskName() const + { + //returns task name + return fDetectorTask[kDetTaskSDigitizer]; + } +/*****************************************************************************/ + +TString AliConfig::GetReconstructionerTaskName() const + { + //returns task name + return fDetectorTask[kDetTaskRecontructioner]; + } +/*****************************************************************************/ + +TString AliConfig::GetTrackerTaskName() const + { + //returns task name + return fDetectorTask[kDetTaskTracker]; + } +/*****************************************************************************/ + +TString AliConfig::GetPIDTaskName() const + { + //returns task name + return fDetectorTask[kDetTaskPID]; + } +/*****************************************************************************/ + +const TString& AliConfig::GetQAFolderName() const +{ +//returns pathname of folder with QA output relative to Top Alice Folder + return fDetectorFolder[kDetFolderQA]; +} +/*****************************************************************************/ + +const TString& AliConfig::GetDataFolderName() +{ +//returns name of data folder path relative to event folder + return fgkDataFolderName; +} +/*****************************************************************************/ + +Int_t AliConfig::AddSubFolder(TFolder* topfolder, const char* infoler, + const char* newfoldname, const char* newfoldtitle) +{ +//helper method +//in topfolder looks for folder named 'infolder' +//and if it exist it creates inside a new folder named 'newfoldname' and titled 'newfoldtitle' + + if (topfolder == 0x0)//check if exists top folder + { + Error("AddSubFodler(TFolder*, ....","Parameter TFolder* points to NULL."); + return 1; + } + + TObject *obj; + TFolder* folder; + + folder = dynamic_cast(topfolder->FindObject(infoler)); + if (folder == 0x0) //check if we got inolder + { + Error("AddSubFodler(TFolder*, ....","Can not find folder %s in folder %s.",infoler,topfolder->GetName()); + return 1; + } + obj = folder->FindObject(newfoldname); //see if such a subfolder already exists + if (obj == 0x0) //nope + { + TFolder *newfolder = folder->AddFolder(newfoldname,newfoldtitle);//add the desired subfolder + if (newfolder == 0x0) //check if we managed + { + Error("AddSubFodler(TFolder*, ....","Can not create folder %s in folder %s",newfoldname,infoler); + return 2; + } + else return 0;//success + } + else + {//such an object already exists + TFolder* fol = dynamic_cast(obj); + if (fol == 0x0) + { + Error("AddSubFodler(TFolder*, ....", + "Object named %s already exists in folder %s AND IT IS NOT A FOLDER",newfoldname,infoler); + return 3; + } + else + { + Warning("AddSubFodler(TFolder*, ....", + "Folder named %s already exists in folder %s",newfoldname,infoler); + return 0; + } + } + return 0; //never reached +} diff --git a/STEER/AliConfig.h b/STEER/AliConfig.h index 358a01e7d0e..57329d13f76 100644 --- a/STEER/AliConfig.h +++ b/STEER/AliConfig.h @@ -5,7 +5,7 @@ /* $Id$ */ - +#include class TDatabasePDG; class TFolder; class TString; @@ -17,49 +17,106 @@ class AliGenerator; class AliModule; class AliTasks; -#include - class AliConfig : public TNamed { public: - + AliConfig(); - virtual ~ AliConfig (); - void Add (AliGenerator *generator); - void Add (TVirtualMC *mc); - void Add (TDatabasePDG *pdg); - void Add (AliModule *module); - void Add (AliDetector *detector); + virtual ~ AliConfig (); + + void Add(TDatabasePDG *pdg); + void Add(char *list); + + void Add(AliGenerator *generator,const char* eventfolder = fgkDefaultEventFolderName); + void Add (TVirtualMC *mc,const char* eventfolder = fgkDefaultEventFolderName); + void Add (AliModule *module,const char* eventfolder = fgkDefaultEventFolderName); + void Add (AliDetector *detector,const char* eventfolder = fgkDefaultEventFolderName); + + Int_t AddDetector(const char* evntfoldername,const char *name, const char* title); + Int_t AddDetector(TFolder* evntfolder,const char *name, const char* title); - void Add (char *list); + Int_t CreateDetectorFolders(const char* evntfoldername,const char *name, const char* title);//Used by AliRunGetter + Int_t CreateDetectorFolders(TFolder* evntfolder,const char *name, const char* title);//Used by AliRunGetter + Int_t CreateDetectorTasks(const char *name, const char* title); - static AliConfig* Instance(); + static AliConfig* Instance(); private: + AliConfig(const char * name, const char * title ); + AliConfig(const AliConfig&); - enum {kFolders=8, kTasks=5}; - AliConfig(const char * name, const char * title); - AliConfig(const AliConfig& conf); - void AddInFolder (const char * dir, TObject *obj); - void AddSubFolder(const char * dir[], TObject *obj); - void AddSubTask(const char * dir[], TObject *obj); - TObject* FindInFolder (const char *dir, const char *name); - AliConfig& operator = (const AliConfig&) {return *this;} - - TFolder *fTopFolder; // Pointer of the top folder - AliTasks *fTasks; // Pointer for the tasks + void AddInFolder (const char * dir, TObject *obj); + Int_t AddSubTask(const char *taskname, const char* name, const char* title); + Int_t AddSubFolder(TFolder* topfolder, const char* infoler, //helper method + const char* newfoldname, const char* newfoldtitle); + TObject* FindInFolder (const char *dir, const char *name); + // folders - const char* fPDGFolder ; // Names of the PDG folders - const char* fGeneratorFolder ; // Names of the Generator folders - const char* fMCFolder ; // Names of MC folders - const char* fModuleFolder ; // Names of Module folders - const char** fDetectorFolder ; // Names of Detector folders - const char** fDetectorTask ; // Names of Detector Task folders + TFolder* fTopFolder; + TFolder* fTaskFolder; + TFolder* fConstFolder; - static AliConfig* fgInstance; // Instance of the singleton - - ClassDef(AliConfig,1) //Configuration class for AliRun + static const TString fgkPDGFolderName; + static const TString fgkGeneratorFolderName; + static const TString fgkMCFolderName; + static const TString fgkModuleFolderName; + + TString *fDetectorTask;//!array with names for detector tasks + TString *fDetectorFolder;//!array with names for detector folders (where detector is going to be put) + + static AliConfig* fInstance; + + + public: + + TFolder* BuildEventFolder(const char* name,const char* tilte); + + TFolder* GetTopFolder(){return fTopFolder;} + TFolder* GetTaskFolder(){return fTaskFolder;} + TFolder* GetConstFolder(){return fConstFolder;} + + static const TString& GetModulesFolderName(){return fgkModuleFolderName;} + + TString GetQATaskName() const; //returns path to QA tasks + TString GetDigitizerTaskName () const; + TString GetSDigitizerTaskName () const; + TString GetReconstructionerTaskName () const; + TString GetTrackerTaskName () const; + TString GetPIDTaskName () const; + + + const TString& GetQAFolderName() const; //returns path to folder with QA output + + const TString& GetDataFolderName();//returns name of data folder + + static const TString fgkTopFolderName; //name of top AliRoot folder + + static const TString fgkDefaultEventFolderName; + static const TString fgkTasksFolderName; + static const TString fgkConstantsFolderName; + + static const TString fgkDataFolderName; + static const TString fgkConditionsFolderName; + static const TString fgkConfigurationFolderName; + static const TString fgkHeaderFolderName; + + static const TString fgkDigitizerTaskName; + static const TString fgkSDigitizerTaskName; + static const TString fgkQATaskName; + static const TString fgkReconstructionerTaskName; + static const TString fgkTrackerTaskName; + static const TString fgkPIDTaskName; + + static const TString fgkCalibrationFolderName; + static const TString fgkAligmentFolderName; + static const TString fgkQAFolderName; + + static const TString fgkFieldFolderName; + static const TString fgkGeneratorsFolderName; + static const TString fgkVirtualMCFolderName; + + ClassDef(AliConfig,2) //Configuration class for AliRun }; // end class AliConfig #endif diff --git a/STEER/AliDataLoader.cxx b/STEER/AliDataLoader.cxx new file mode 100644 index 00000000000..ec344cb4925 --- /dev/null +++ b/STEER/AliDataLoader.cxx @@ -0,0 +1,1157 @@ +#include +//__________________________________________ +///////////////////////////////////////////////////////////////////////////////////////////// +// // +// class AliDataLoader // +// // +// Container of all data needed for full // +// description of each data type // +// (Hits, Kine, ...) // +// // +// Each data loader has a basic standard setup of BaseLoaders // +// which can be identuified by indexes (defined by EStdBasicLoaders) // +// Data managed by these standard base loaders has fixed naming convention // +// e.g. - tree with hits is always named TreeH // +// (defined in AliLoader::fgkDefaultHitsContainerName) // +// - task DtectorName+Name defined // +// // +// EStdBasicLoaders idx Object Type Description // +// kData 0 TTree or TObject main data itself (hits,digits,...) // +// kTask 1 TTask object producing main data // +// kQA 2 TTree quality assurance tree // +// kQATask 3 TTask task producing QA object // +// // +// // +// User can define and add more basic loaders even Run Time. // +// Caution: in order to save information about added base loader // +// user must rewrite Run Loader to galice.file, overwriting old setup // +// // +///////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#include "AliRunLoader.h" + +ClassImp(AliDataLoader) + +AliDataLoader::AliDataLoader(): + fFileName(0), + fFile(0x0), + fDirectory(0x0), + fFileOption(), + fCompressionLevel(2), + fBaseLoaders(0x0), + fHasTask(kFALSE), + fTaskName(), + fParentalTask(0x0), + fEventFolder(0x0), + fFolder(0x0) +{ + +} +/*****************************************************************************/ + +AliDataLoader::AliDataLoader(const char* filename, const char* contname, const char* name, Option_t* opt): + TNamed(name,name), + fFileName(filename), + fFile(0x0), + fDirectory(0x0), + fFileOption(0), + fCompressionLevel(2), + fBaseLoaders(new TObjArray(4)), + fHasTask(kFALSE), + fTaskName(), + fParentalTask(0x0), + fEventFolder(0x0), + fFolder(0x0) +{ +//constructor +// creates a 0 loader, depending on option, default "T" is specialized loader for trees +// else standard object loader +// trees needs special care, becouse we need to set dir before writing + if (GetDebug()) + Info("AliDataLoader","File name is %s",fFileName.Data()); + + TString option(opt); + AliBaseLoader* bl; + if (option.CompareTo("T",TString::kIgnoreCase) == 0) + bl = new AliTreeLoader(contname,this); + else + bl = new AliObjectLoader(contname,this); + fBaseLoaders->AddAt(bl,kData); + +} +/*****************************************************************************/ + +AliDataLoader::~AliDataLoader() +{ +//dtor + UnloadAll(); +} +/*****************************************************************************/ + +Int_t AliDataLoader::SetEvent() +{ +//basically the same that GetEvent but do not post data to folders + AliRunLoader* rl = GetRunLoader(); + if (rl == 0x0) + { + Error("SetEvent","Can not get RunGettr"); + return 1; + } + + Int_t evno = rl->GetEventNumber(); + + TIter next(fBaseLoaders); + AliBaseLoader* bl; + while ((bl = (AliBaseLoader*)next())) + { + if (bl->DoNotReload() == kFALSE) bl->Clean(); + } + + if(fFile) + { + if (CheckReload()) + { + delete fFile; + fFile = 0x0; + if (GetDebug()) Info("SetEvent","Reloading new file. File opt is %s",fFileOption.Data()); + OpenFile(fFileOption); + } + + fDirectory = AliLoader::ChangeDir(fFile,evno); + if (fDirectory == 0x0) + { + Error("SetEvent","Can not chage directory in file %s",fFile->GetName()); + return 1; + } + } + return 0; +} +/*****************************************************************************/ + +Int_t AliDataLoader::GetEvent() +{ + // posts all loaded data from files to White Board + // event number is defined in RunLoader + // + //returns: + // 0 - in case of no error + // 1 - event not found + // + //for each base laoder post, if was loaded before GetEvent + + //call set event to switch to new directory in file + + + //post all data that were loaded before + // ->SetEvent does not call Unload, but only cleans White Board + // such IsLoaded flag stays untached + + if ( AliLoader::TestFileOption(fFileOption) == kTRUE ) //if file is read or update mode try to post + { //in other case there is no sense to post: file is new + TIter nextbl(fBaseLoaders); + AliBaseLoader* bl; + while ((bl = (AliBaseLoader*)nextbl())) + { + if (bl->IsLoaded()) + { + if (bl->DoNotReload() == kFALSE) bl->Post(); + } + } + } + return 0; +} +/*****************************************************************************/ + +Int_t AliDataLoader::OpenFile(Option_t* opt) +{ +//Opens file named 'filename', and assigns pointer to it to 'file' +//jumps to fDirectoryectory corresponding to current event and stores the pointer to it in 'fDirectory' +//option 'opt' is passed to TFile::Open + if (fFile) + { + if(fFile->IsOpen() == kTRUE) + { + Warning("OpenFile"," File %s already opened. First close it.",fFile->GetName()); + return 0; + } + else + { + Warning("OpenFile","Pointer to file %s is not null, but file is not opened", + fFile->GetName()); + delete fFile; + fFile = 0x0; + } + } + + TString fname(SetFileOffset(fFileName)); + + fFile = (TFile *)(gROOT->GetListOfFiles()->FindObject(fname)); + if (fFile) + { + if(fFile->IsOpen() == kTRUE) + { + Warning("OpenFile","File %s already opened by sombody else. First close it.", + fFile->GetName()); + return 0; + } + } + + fFileOption = opt; + fFile = TFile::Open(fname,fFileOption);//open the file + if (fFile == 0x0) + {//file is null + Error("OpenFile","Can not open file %s",fname.Data()); + return 1; + } + if (fFile->IsOpen() == kFALSE) + {//file is null + Error("OpenFile","Can not open file %s",fname.Data()); + return 1; + } + + fFile->SetCompressionLevel(fCompressionLevel); + + AliRunLoader* rg = GetRunLoader(); + if (rg == 0x0) + { + Error("OpenFile","Can not find Run-Loader in folder."); + return 2; + } + Int_t evno = rg->GetEventNumber(); + + fDirectory = AliLoader::ChangeDir(fFile,evno); + if (fDirectory == 0x0) + { + Error("OpenFile","Can not chage fDirectory in file %s.",fFile->GetName()); + return 3; + } + return 0; +} +/*****************************************************************************/ + +void AliDataLoader::Unload() +{ + //unloads main data - shortcut method + GetBaseLoader(0)->Unload(); +} +/*****************************************************************************/ + +void AliDataLoader::UnloadAll() +{ +//Unloads all data and tasks + TIter next(fBaseLoaders); + AliBaseLoader* bl; + while ((bl = (AliBaseLoader*)next())) + { + bl->Unload(); + } +} +/*****************************************************************************/ + +Int_t AliDataLoader::Reload() +{ + //Unloads and loads data again + if ( fFile == 0x0 ) return 0; + + TBits loaded(fBaseLoaders->GetEntries()); + TIter next(fBaseLoaders); + AliBaseLoader* bl; + + Int_t i = 0; + while ((bl = (AliBaseLoader*)next())) + { + if (bl->IsLoaded()) + { + loaded.SetBitNumber(i++,kTRUE); + bl->Unload(); + } + } + + Int_t retval; + i = 0; + next.Reset(); + while ((bl = (AliBaseLoader*)next())) + { + if (loaded.TestBitNumber(i++)) + { + retval = bl->Load(fFileOption); + if (retval) + { + Error("Reload","Error occur while loading %s",bl->GetName()); + return retval; + } + } + } + + + return 0; + } +/*****************************************************************************/ +Int_t AliDataLoader::WriteData(Option_t* opt) +{ +//Writes primary data == first BaseLoader + if (GetDebug()) + Info("WriteData","Writing %s container for %s data. Option is %s.", + GetBaseLoader(0)->GetName(),GetName(),opt); + return GetBaseLoader(0)->WriteData(opt); +} +/*****************************************************************************/ + +Int_t AliDataLoader::Load(Option_t* opt) +{ +//Writes primary data == first BaseLoader + return GetBaseLoader(0)->Load(opt); +} +/*****************************************************************************/ + +Int_t AliDataLoader::SetEventFolder(TFolder* eventfolder) +{ + //sets the event folder + if (eventfolder == 0x0) + { + Error("SetEventFolder","Stupid joke. Argument is NULL"); + return 1; + } + if (GetDebug()) + Info("SetFolder","name = %s Setting Event Folder named %s.", + GetName(),eventfolder->GetName()); + + fEventFolder = eventfolder; + return 0; +} +/*****************************************************************************/ + +Int_t AliDataLoader::SetFolder(TFolder* folder) +{ + + if (folder == 0x0) + { + Error("SetFolder","Stupid joke. Argument is NULL"); + return 1; + } + + if (GetDebug()) Info("SetFolder","name = %s Setting folder named %s.",GetName(),folder->GetName()); + + fFolder = folder; + TIter next(fBaseLoaders); + AliBaseLoader* bl; + + while ((bl = (AliBaseLoader*)next())) + { + bl->SetDataLoader(this); + } + + return 0; +} +/******************************************************************/ + +TFolder* AliDataLoader::GetEventFolder() +{ +//get EVENT folder (data that are changing from event to event, even in single run) + if (GetDebug()) Info("GetEventFolder","EF = %#x"); + return fEventFolder; +} +/*****************************************************************************/ + +AliRunLoader* AliDataLoader::GetRunLoader() +{ +//gets the run-loader from event folder + AliRunLoader* rg = 0x0; + TFolder* ef = GetEventFolder(); + if (ef == 0x0) + { + Error("GetRunLoader","Can not get event folder."); + return 0; + } + rg = dynamic_cast(ef->FindObject(AliRunLoader::fgkRunLoaderName)); + return rg; +} + +/*****************************************************************************/ +void AliDataLoader::CloseFile() +{ + //closes file + TIter next(fBaseLoaders); + AliBaseLoader* bl; + while ((bl = (AliBaseLoader*)next())) + { + if (bl->IsLoaded()) return; + } + + if (GetDebug()) + Info("CloseFile","Closing and deleting (object) file."); + + delete fFile; + fFile = 0x0; + fDirectory = 0x0; +} +/*****************************************************************************/ + +void AliDataLoader::Clean() +{ + //Cleans main data + GetBaseLoader(0)->Clean(); +} +/*****************************************************************************/ + +void AliDataLoader::CleanAll() +{ + //Cleans all folders and tasks + TIter next(fBaseLoaders); + AliBaseLoader* bl; + while ((bl = (AliBaseLoader*)next())) + { + bl->Clean(); + } +} +/*****************************************************************************/ + +void AliDataLoader::SetFileNameSuffix(const TString& suffix) +{ + //adds the suffix before ".root", + //e.g. TPC.Digits.root -> TPC.DigitsMerged.root + //made on Jiri Chudoba demand + if (GetDebug()) + { + Info("SetFileNameSuffix","suffix=%s",suffix.Data()); + Info("SetFileNameSuffix"," Digits File Name before: %s",fFileName.Data()); + } + + static TString dotroot(".root"); + const TString& suffixdotroot = suffix + dotroot; + fFileName = fFileName.ReplaceAll(dotroot,suffixdotroot); + + if (GetDebug()) + Info("SetDigitsFileNameSuffix"," after : %s",fFileName.Data()); +} +/*****************************************************************************/ + +Bool_t AliDataLoader::CheckReload() +{ +//checks if we have to reload given file + if (fFile == 0x0) return kFALSE; + TString tmp = SetFileOffset(fFileName); + if (tmp.CompareTo(fFile->GetName())) return kTRUE; //file must be reloaded + return kFALSE; +} +/*****************************************************************************/ + +const TString AliDataLoader::SetFileOffset(const TString& fname) +{ + +//return fname; + Long_t offset = (Long_t)GetRunLoader()->GetFileOffset(); + if (offset < 1) return fname; + + TString soffset; + soffset += offset;//automatic conversion to string + TString dotroot(".root"); + const TString& offfsetdotroot = offset + dotroot; + TString out = fname; + out = out.ReplaceAll(dotroot,offfsetdotroot); + if (GetDebug()) Info("SetFileOffset","in=%s out=%s.",fname.Data(),out.Data()); + return out; + +} +/*****************************************************************************/ + +void AliDataLoader::SetFileOption(Option_t* newopt) +{ + //sets file option + if (fFileOption.CompareTo(newopt) == 0) return; + fFileOption = newopt; + Reload(); +} +/*****************************************************************************/ + +void AliDataLoader::SetCompressionLevel(Int_t cl) +{ +//sets comression level for data defined by di + fCompressionLevel = cl; + if (fFile) fFile->SetCompressionLevel(cl); +} +/*****************************************************************************/ + +Int_t AliDataLoader::GetDebug() const +{ + //it is not inline bacause AliLoader.h includes AliDataLoaer.h + //and there is circular depenedence + return AliLoader::GetDebug(); +} +/*****************************************************************************/ + +void AliDataLoader::MakeTree() +{ + AliTreeLoader* tl = dynamic_cast(fBaseLoaders->At(0)); + if (tl == 0x0) + { + Error("MakeTree","Can not make a tree because main base loader is not a tree loader"); + return; + } + tl->MakeTree(); +} +/*****************************************************************************/ + +Bool_t AliDataLoader::IsFileWritable() const +{ +//returns true if file is writable + return (fFile)?fFile->IsWritable():kFALSE; +} +/*****************************************************************************/ + +Bool_t AliDataLoader::IsFileOpen() const +{ +//returns true if file is writable + return (fFile)?fFile->IsOpen():kFALSE; +} +/*****************************************************************************/ + +Bool_t AliDataLoader::IsOptionContrary(const TString& option) const +{ +//Checks if passed option is contrary with file open option +//which is passed option "writable" and existing option not wriable +//in reverse case it is no harm so it is NOT contrary + if (fFile == 0x0) return kFALSE; //file is not opened - no problem + + if ( ( AliLoader::IsOptionWritable(option) == kTRUE ) && // passed option is writable and + ( AliLoader::IsOptionWritable(fFileOption) == kFALSE ) ) // existing one is not writable + { + return kTRUE; + } + + return kFALSE; +} +/*****************************************************************************/ +void AliDataLoader::AddBaseLoader(AliBaseLoader* bl) +{ +//Adds a base loader to lits of base loaders managed by this data loader +//Managed data/task will be stored in proper root directory, +//and posted to +// - in case of tree/object - data folder connected with detector associated with this data loader +// - in case of task - parental task which defined in this AliTaskLoader + + if (bl == 0x0) + { + Warning("AddBaseLoader","Pointer is null."); + return; + } + + TObject* obj = fBaseLoaders->FindObject(bl->GetName()); + if (obj) + { + Error("AddBaseLoader","Can not add this base loader."); + Error("AddBaseLoader","There exists already base loader which manages data named %s for this detector."); + return; + } + + + fBaseLoaders->Add(bl); +} + +/*****************************************************************************/ + +AliBaseLoader* AliDataLoader::GetBaseLoader(const TString& name) const +{ + return dynamic_cast(fBaseLoaders->FindObject(name)); +} +/*****************************************************************************/ + +AliBaseLoader* AliDataLoader::GetBaseLoader(Int_t n) const +{ + return dynamic_cast(fBaseLoaders->At(n)); +} +/*****************************************************************************/ + +TTree* AliDataLoader::Tree() const +{ +//returns tree from the main base loader +//it is just shortcut method for comfort of user +//main storage object does not have to be Tree - +//that is why first we need to check if it is a TreeLoader + AliTreeLoader* tl = dynamic_cast(GetBaseLoader(0)); + if (tl == 0x0) return 0x0; + return tl->Tree(); +} +/*****************************************************************************/ + +void AliDataLoader::SetDirName(TString& dirname) +{ + if (GetDebug()>9) Info("SetDirName","FileName before %s",fFileName.Data()); + + Int_t n = fFileName.Last('/'); + + if (GetDebug()>9) Info("SetDirName","Slash found on pos %d",n); + + if (n > 0) fFileName = fFileName.Remove(0,n+1); + + if (GetDebug()>9) Info("SetDirName","Core FileName %s",fFileName.Data()); + + fFileName = dirname + "/" + fFileName; + + if (GetDebug()>9) Info("SetDirName","FileName after %s",fFileName.Data()); +} +/*****************************************************************************/ +AliObjectLoader* AliDataLoader::GetBaseDataLoader() +{ + return dynamic_cast(GetBaseLoader(kData)); +} +/*****************************************************************************/ +AliTaskLoader* AliDataLoader::GetBaseTaskLoader() +{ + return dynamic_cast(GetBaseLoader(kTask)); +} +/*****************************************************************************/ +AliBaseLoader* AliDataLoader::GetBaseQALoader() +{ + return GetBaseLoader(kQA); +} +/*****************************************************************************/ +AliTaskLoader* AliDataLoader::GetBaseQATaskLoader() +{ +//returns pointer to QA base loader + return dynamic_cast(GetBaseLoader(kQATask)); +} +/*****************************************************************************/ +void AliDataLoader::SetBaseDataLoader(AliBaseLoader* bl) +{ +//sets data base loader + if (bl == 0x0) + { + Error("SetBaseDataLoader","Parameter is null"); + return; + } + if (GetBaseDataLoader()) delete GetBaseDataLoader(); + fBaseLoaders->AddAt(bl,kData); +} +/*****************************************************************************/ +void AliDataLoader::SetBaseTaskLoader(AliTaskLoader* bl) +{ +//sets Task base loader + if (bl == 0x0) + { + Error("SetBaseTaskLoader","Parameter is null"); + return; + } + if (GetBaseTaskLoader()) delete GetBaseTaskLoader(); + fBaseLoaders->AddAt(bl,kTask); +} +/*****************************************************************************/ +void AliDataLoader::SetBaseQALoader(AliBaseLoader* bl) +{ +//sets QA base loader + if (bl == 0x0) + { + Error("SetBaseQALoader","Parameter is null"); + return; + } + if (GetBaseQALoader()) delete GetBaseQALoader(); + fBaseLoaders->AddAt(bl,kQA); +} +/*****************************************************************************/ +void AliDataLoader::SetBaseQATaskLoader(AliTaskLoader* bl) +{ +//sets QA Task base loader + if (bl == 0x0) + { + Error("SetBaseQATaskLoader","Parameter is null"); + return; + } + if (GetBaseQATaskLoader()) delete GetBaseQATaskLoader(); + fBaseLoaders->AddAt(bl,kQATask); +} + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ +//__________________________________________ +/////////////////////////////////////////////////////////////////////////////// +// // +// class AliBaseLoader // +// // +// // +/////////////////////////////////////////////////////////////////////////////// +ClassImp(AliBaseLoader) + +AliBaseLoader::AliBaseLoader(): + fIsLoaded(kFALSE), + fStoreInTopOfFile(kFALSE), + fDoNotReload(kFALSE), + fDataLoader(0x0) +{ +} +/*****************************************************************************/ + +AliBaseLoader::AliBaseLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop): + TNamed(name,name+" Base Loader"), + fIsLoaded(kFALSE), + fStoreInTopOfFile(storeontop), + fDoNotReload(storeontop),//if stored on top of file - this object is loaded ones pe + fDataLoader(dl) +{ +} + +/*****************************************************************************/ + +Int_t AliBaseLoader::Load(Option_t* opt) +{ + if (GetDebug()) + Info("Load","data type = %s, option = %s",GetName(),opt); + + if (Get()) + { + Warning("Load","Data <<%s>> are already loaded. Use ReloadData to force reload. Nothing done",GetName()); + return 0; + } + + Int_t retval; + + if (GetDataLoader()->IsFileOpen() == kTRUE) + { + if (GetDataLoader()->IsOptionContrary(opt) == kTRUE) + { + Error("Load","Data Type %s, Container Name %s", GetDataLoader()->GetName(),GetName()); + Error("Load","File was already opened in READ-ONLY mode, while now WRITEABLE access is requested."); + Error("Load","Use AliDataLoader::SetOption to enforce change of access mode OR"); + Error("Load","Load previosly loaded data with coherent option."); + return 10; + } + } + else + { + retval = GetDataLoader()->OpenFile(opt); + if (retval) + { + Error("Load","Error occured while opening <<%s>> file",GetName()); + return retval; + } + } + //if file is recreated there is no sense to search for data to post and get Error message + if (AliLoader::TestFileOption(opt) == kFALSE) + { + AliTreeLoader* tl = dynamic_cast(this); + if (tl) tl->MakeTree(); + fIsLoaded = kTRUE; + return 0; + } + + retval = Post(); + if (retval) + { + Error("Load","Error occured while posting %s from file to folder.",GetName()); + return retval; + } + + fIsLoaded = kTRUE; + return 0; +} +/*****************************************************************************/ + +Int_t AliBaseLoader::Post() +{ +//Posts data container to proper folders + + if ( GetDirectory() == 0x0) + { + Error("Post","%s directory is NULL. Load before.",GetDataLoader()->GetName()); + return 2; + } + + TObject* data = GetFromDirectory(fName); + if(data) + { + //if such an obejct already exists - remove it first + return Post(data); + } + else + { + //check if file is in update mode + Int_t fileupdate = GetDataLoader()->GetFileOption().CompareTo("update",TString::kIgnoreCase); + if ( fileupdate == 0) + { //if it is, it is normal that there is no data yet + if (GetDebug()) + { + Info("Post","Can not find %s in file %s (file is opened in UPDATE mode).", + GetName(),GetDataLoader()->GetFile()->GetName()); + } + } + else + { + Warning("Post","Can not find %s in file %s", GetName(),GetDataLoader()->GetFile()->GetName()); + } + } + return 0; +} +/*****************************************************************************/ + +Int_t AliBaseLoader::Post(TObject* data) +{ +//Posts data container to proper folders + if (data == 0x0) + { + Error("Post","Pointer to object is NULL"); + return 1; + } + TObject* obj = Get(); + if (data == obj) + { + if (GetDebug()) Warning("Post","This object was already posted."); + return 0; + } + if (obj) + { + Warning("PostData","Object named %s already exitsts in data folder. Removing it",GetName()); + Clean(); + } + return AddToBoard(data); +} +/*****************************************************************************/ + +Int_t AliBaseLoader::WriteData(Option_t* opt) +{ +//Writes data defined by di object +//opt might be "OVERWRITE" in case of forcing overwriting + if (GetDebug()) + Info("WriteData","Writing %s container for %s data. Option is %s.", + GetName(),GetDataLoader()->GetName(),opt); + + TObject *data = Get(); + if(data == 0x0) + {//did not get, nothing to write + Warning("WriteData","Tree named %s not found in folder. Nothing to write.",GetName()); + return 0; + } + + //check if file is opened + if (GetDirectory() == 0x0) + { + //if not try to open + GetDataLoader()->SetFileOption("UPDATE"); + if (GetDataLoader()->OpenFile("UPDATE")) + { + //oops, can not open the file, give an error message and return error code + Error("WriteData","Can not open hits file. %s ARE NOT WRITTEN",GetName()); + return 1; + } + } + + if (GetDataLoader()->IsFileWritable() == kFALSE) + { + Error("WriteData","File %s is not writable",GetDataLoader()->GetFileName().Data()); + return 2; + } + + GetDirectory()->cd(); //set the proper directory active + + //see if hits container already exists in this (root) directory + TObject* obj = GetFromDirectory(GetName()); + if (obj) + { //if they exist, see if option OVERWRITE is used + const char *oOverWrite = strstr(opt,"OVERWRITE"); + if(!oOverWrite) + {//if it is not used - give an error message and return an error code + Error("WriteData","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data"); + return 3; + } + } + + if (GetDebug()) Info("WriteData","DataName = %s, opt = %s, data object name = %s", + GetName(),opt,data->GetName()); + if (GetDebug()) Info("WriteData","File Name = %s, Directory Name = %s Directory's File Name = %s", + GetDataLoader()->GetFile()->GetName(),GetDirectory()->GetName(), + GetDirectory()->GetFile()->GetName()); + + if (GetDebug()) Info("WriteData","Writing data"); + data->Write(0,TObject::kOverwrite); + + fIsLoaded = kTRUE; // Just to ensure flag is on. Object can be posted manually to folder structure, not using loader. + + return 0; + +} +/*****************************************************************************/ + +Int_t AliBaseLoader::Reload() +{ +//Unloads and loads datat again - if loaded before + if (IsLoaded()) + { + Unload(); + return Load(GetDataLoader()->GetFileOption()); + } + return 0; +} +/*****************************************************************************/ + +void AliBaseLoader::Clean() +{ +//removes objects from folder/task + if (GetDebug()) Info("Clean","%s %s",GetName(),GetDataLoader()->GetName()); + TObject* obj = Get(); + if(obj) + { + if (GetDebug()) + Info("Clean","cleaning %s.",GetName()); + RemoveFromBoard(obj); + delete obj; + } +} +/*****************************************************************************/ + +void AliBaseLoader::Unload() +{ + Clean(); + fIsLoaded = kFALSE; + GetDataLoader()->CloseFile(); +} +/*****************************************************************************/ +AliDataLoader* AliBaseLoader::GetDataLoader() const +{ + if (fDataLoader == 0x0) + { + Fatal("GetDataLoader","Pointer to Data Loader is NULL"); + } + return fDataLoader; +} +/*****************************************************************************/ + +Int_t AliBaseLoader::GetDebug() const +{ + return (Int_t)AliLoader::fgDebug; +} + +TDirectory* AliBaseLoader::GetDirectory() +{ + // returnd TDirectory where data are to be saved + //if fStoreInTopOfFile flag is true - returns pointer to file + return (fStoreInTopOfFile)?GetDataLoader()->GetFile():GetDataLoader()->GetDirectory(); +} +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ +//__________________________________________ +/////////////////////////////////////////////////////////////////////////////// +// // +// class AliObjectLoader // +// // +// // +/////////////////////////////////////////////////////////////////////////////// + +ClassImp(AliObjectLoader) + +AliObjectLoader::AliObjectLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop): + AliBaseLoader(name,dl,storeontop) +{ +//constructor +} +/*****************************************************************************/ + +TFolder* AliObjectLoader::GetFolder() const +{ + TFolder* df = GetDataLoader()->GetFolder(); + if (df == 0x0) + { + Fatal("GetFolder","Data Folder is NULL"); + } + return df; +} +/*****************************************************************************/ + +void AliObjectLoader::RemoveFromBoard(TObject* obj) +{ + GetFolder()->Remove(obj); +} +/*****************************************************************************/ +Int_t AliObjectLoader::AddToBoard(TObject* obj) +{ + GetFolder()->Add(obj); + return 0; +} +/*****************************************************************************/ + +TObject* AliObjectLoader::Get() const +{ + return (GetFolder()) ? GetFolder()->FindObject(GetName()) : 0x0; +} + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ +//__________________________________________ +/////////////////////////////////////////////////////////////////////////////// +// // +// class AliTreeLoader // +// // +// // +/////////////////////////////////////////////////////////////////////////////// + +ClassImp(AliTreeLoader) + +AliTreeLoader::AliTreeLoader(const TString& name, AliDataLoader* dl,Bool_t storeontop): + AliObjectLoader(name,dl,storeontop) +{ +//constructor +} + +/*****************************************************************************/ + +Int_t AliTreeLoader::WriteData(Option_t* opt) +{ +//Writes data defined by di object +//opt might be "OVERWRITE" in case of forcing overwriting + + if (GetDebug()) + Info("WriteData","Writing %s container for %s data. Option is %s.", + GetName(),GetDataLoader()->GetName(),opt); + + TObject *data = Get(); + if(data == 0x0) + {//did not get, nothing to write + Warning("WriteData","Tree named %s not found in folder. Nothing to write.",GetName()); + return 0; + } + + //check if file is opened + if (GetDirectory() == 0x0) + { + //if not try to open + GetDataLoader()->SetFileOption("UPDATE"); + if (GetDataLoader()->OpenFile("UPDATE")) + { + //oops, can not open the file, give an error message and return error code + Error("WriteData","Can not open hits file. %s ARE NOT WRITTEN",GetName()); + return 1; + } + } + + if (GetDataLoader()->IsFileWritable() == kFALSE) + { + Error("WriteData","File %s is not writable",GetDataLoader()->GetFileName().Data()); + return 2; + } + + GetDirectory()->cd(); //set the proper directory active + + //see if hits container already exists in this (root) directory + TObject* obj = GetFromDirectory(GetName()); + if (obj) + { //if they exist, see if option OVERWRITE is used + const char *oOverWrite = strstr(opt,"OVERWRITE"); + if(!oOverWrite) + {//if it is not used - give an error message and return an error code + Error("WriteData","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data"); + return 3; + } + } + + if (GetDebug()) Info("WriteData","DataName = %s, opt = %s, data object name = %s", + GetName(),opt,data->GetName()); + if (GetDebug()) Info("WriteData","File Name = %s, Directory Name = %s Directory's File Name = %s", + GetDataLoader()->GetFile()->GetName(),GetDirectory()->GetName(), + GetDirectory()->GetFile()->GetName()); + + //if a data object is a tree set the directory + TTree* tree = dynamic_cast(data); + if (tree) tree->SetDirectory(GetDirectory()); //forces setting the directory to this directory (we changed dir few lines above) + + if (GetDebug()) Info("WriteData","Writing tree"); + data->Write(0,TObject::kOverwrite); + + fIsLoaded = kTRUE; // Just to ensure flag is on. Object can be posted manually to folder structure, not using loader. + + return 0; + +} +/*****************************************************************************/ + +void AliTreeLoader::MakeTree() +{ +//this virtual method creates the tree for hits in the file + if (Tree()) + { + if (GetDebug()) + Info("MakeTree","name = %s, Data Name = %s Tree already exists.", + GetName(),GetDataLoader()->GetName()); + return;//tree already made + } + if (GetDebug()) + Info("MakeTree","Making Tree named %s.",GetName()); + + TString dtypename(GetDataLoader()->GetName()); + TTree* tree = new TTree(GetName(), dtypename + " Container"); //make a tree + if (tree == 0x0) + { + Error("MakeTree","Can not create %s tree.",GetName()); + return; + } + tree->SetAutoSave(1000000000); //no autosave + GetFolder()->Add(tree); + WriteData("OVERWRITE");//write tree to the file +} + + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ +//__________________________________________ +/////////////////////////////////////////////////////////////////////////////// +// // +// class AliTaskLoader // +// // +// // +/////////////////////////////////////////////////////////////////////////////// + +ClassImp(AliTaskLoader) + +AliTaskLoader::AliTaskLoader(const TString& name, AliDataLoader* dl, TTask* parentaltask, Bool_t storeontop): + AliBaseLoader(name,dl,storeontop), + fParentalTask(parentaltask) +{ +//constructor +} + +/*****************************************************************************/ + +void AliTaskLoader::RemoveFromBoard(TObject* obj) +{ + GetParentalTask()->GetListOfTasks()->Remove(obj); +} +/*****************************************************************************/ + +Int_t AliTaskLoader::AddToBoard(TObject* obj) +{ + TTask* task = dynamic_cast(obj); + if (task == 0x0) + { + Error("AddToBoard","To TTask board can be added only tasks."); + return 1; + } + GetParentalTask()->Add(task); + return 0; +} +/*****************************************************************************/ + +TObject* AliTaskLoader::Get() const +{ + return (GetParentalTask()) ? GetParentalTask()->GetListOfTasks()->FindObject(GetName()) : 0x0; +} +/*****************************************************************************/ + +TTask* AliTaskLoader::GetParentalTask() const +{ +//returns parental tasks for this task + return fParentalTask; +} + +/*****************************************************************************/ + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ + + diff --git a/STEER/AliDataLoader.h b/STEER/AliDataLoader.h new file mode 100644 index 00000000000..a666403b62c --- /dev/null +++ b/STEER/AliDataLoader.h @@ -0,0 +1,256 @@ +#ifndef ALIDATALOADER_H +#define ALIDATALOADER_H +//__________________________________________ +//////////////////////////////////////////// +// // +// class AliDataLoader // +// // +// Loader responsible for one data type // +// i.e. Hits, Kine, etc. // +// many objects type can be assciated // +// with one data type: storing object // +// (usually tree), task producing it, // +// Quality Assurance(QA), QA Task, and // +// others. // +// // +// // +//////////////////////////////////////////// +#include +#include +#include +#include +#include + +class AliLoader; +class TFile; +class TFolder; +class AliRunLoader; +class AliBaseLoader; +class AliObjectLoader; +class AliTreeLoader; +class AliTaskLoader; + +class AliDataLoader: public TNamed + { + public: + AliDataLoader(); + AliDataLoader(const char* filename, const char* contname, const char* name, Option_t* opt = "t"); + virtual ~AliDataLoader(); + + virtual Int_t SetEvent(); + virtual Int_t GetEvent(); + + //shrtcuts method to basic data base loader 0 + virtual Int_t Load(Option_t* opt=""); + virtual void Unload(); + virtual Int_t Reload(); + virtual Int_t WriteData(Option_t* opt=""); + virtual TTree* Tree() const; + virtual void Clean(); + virtual void MakeTree(); + virtual Int_t OpenFile(Option_t* opt); + + virtual void CloseFile(); + void UnloadAll(); + void CleanAll(); + const TString& GetFileName() const {return fFileName;} + TFile* GetFile() const {return fFile;} + TDirectory* GetDirectory() const {return fDirectory;} + const TString& GetFileOption() const {return fFileOption;} + const Int_t& GetCompressionLevel() const {return fCompressionLevel;} + + Bool_t cd(){return (fDirectory)?fDirectory->cd():kFALSE;} + + virtual void SetFileName(const TString& filename){fFileName = filename;} + virtual void SetFileOption(const Option_t* fileopt); + virtual void SetCompressionLevel(Int_t cl); + + Int_t SetEventFolder(TFolder* eventfolder);//sets the event folder + Int_t SetFolder(TFolder* folder);//sets the data folder ?????? + TFolder* GetEventFolder(); + TFolder* GetFolder() const {return fFolder;} + +// TObject* GetFromDirectory(const char *name){return (fDirectory)?fDirectory->Get(name):0x0;} + void SetFileNameSuffix(const TString& suffix);//adds the suffix before ".root", + //e.g. TPC.Digits.root -> TPC.DigitsMerged.root + //made on Jiri Chudoba demand + const TString SetFileOffset(const TString& fname);//adds the proper number before .root extension suffix + void SetDirName(TString& dirname); + + void AddBaseLoader(AliBaseLoader* bl); + enum EStdBasicLoaders {kData = 0,kTask,kQA,kQATask};//standard basic loaders identifiers + + AliBaseLoader* GetBaseLoader(const TString& name) const; + AliBaseLoader* GetBaseLoader(Int_t n) const; + AliObjectLoader* GetBaseDataLoader(); + AliTaskLoader* GetBaseTaskLoader(); + AliBaseLoader* GetBaseQALoader(); + AliTaskLoader* GetBaseQATaskLoader(); + + void SetBaseDataLoader(AliBaseLoader* bl); + void SetBaseTaskLoader(AliTaskLoader* bl); + void SetBaseQALoader(AliBaseLoader* bl); + void SetBaseQATaskLoader(AliTaskLoader* bl); + + Bool_t CheckReload();//checks if we have to reload given file + Bool_t IsFileWritable() const; + Bool_t IsFileOpen() const; + Bool_t IsOptionContrary(const TString& option) const; + protected: + Int_t GetDebug() const; + AliRunLoader* GetRunLoader();//gets the run-loader from event folder + + private: + + TString fFileName; //name of the file + TFile* fFile; //! pointer to file + TDirectory* fDirectory; //!pointer to TDirectory + TString fFileOption; //!file option while opened + Int_t fCompressionLevel; //Compression Level of File + + TObjArray* fBaseLoaders;//base loaders + Bool_t fHasTask;// flag if has a task + TString fTaskName;// name of the task + TTask* fParentalTask;//Parental task + + TFolder* fEventFolder;//!event folder + TFolder* fFolder;//! folder with data + + public: + ClassDef(AliDataLoader,1) + }; + + +//__________________________________________ +//////////////////////////////////////////// +// // +// class AliBaseLoader // +// // +// // +//////////////////////////////////////////// + + +class AliBaseLoader: public TNamed +{ + public: + AliBaseLoader(); + AliBaseLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop = kFALSE); + + virtual ~AliBaseLoader(){}; + + virtual Int_t Load(Option_t* opt=""); + virtual void Unload(); + virtual Int_t Reload(); + virtual Int_t WriteData(Option_t* opt=""); + virtual void Clean(); + virtual Int_t Post(); + virtual Int_t Post(TObject* data); + virtual TObject* Get() const = 0; + Bool_t IsLoaded()const{return fIsLoaded;} + void SetDataLoader(AliDataLoader* dl){fDataLoader = dl;} + void SetEventFolder(TFolder* ef){;} + void SetDoNotReload(Bool_t flag){fDoNotReload = flag;} + Bool_t DoNotReload() const {return fDoNotReload;} + TDirectory* GetDirectory();//returns pointer to directory where data are stored. + TObject* GetFromDirectory(const char *name){return (GetDirectory())?GetDirectory()->Get(name):0x0;} + protected: + + virtual Int_t AddToBoard(TObject* obj) = 0;//add to white board - board can be TTask or TFolder + virtual void RemoveFromBoard(TObject* obj) = 0; + + AliDataLoader* GetDataLoader() const; + Int_t GetDebug() const; + + Bool_t fIsLoaded; //! flag indicating if data are loaded + Bool_t fStoreInTopOfFile;// if true, data are stored in top of file ->Indicates fDoNotReload == kTRUE + + private: + Bool_t fDoNotReload; // if this flag is on object is not reloaded while GetEvent is called. + //Specially important for tasks. Task loops over events while producing data, + //and has a base loader which writes it to file every processed event. + //If this flag is not on, while taking next event, loader deletes task + // and tries to get new one from file + AliDataLoader* fDataLoader; //! pointer to Data Loader this Base Loader belongs to + + ClassDef(AliBaseLoader,1) +}; + +//__________________________________________ +//////////////////////////////////////////// +// // +// class AliObjectLoader // +// // +// // +//////////////////////////////////////////// + +class AliObjectLoader: public AliBaseLoader + { + public: + AliObjectLoader(){}; + AliObjectLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop = kFALSE); + virtual ~AliObjectLoader(){}; + TObject* Get() const; + + protected: + TFolder* GetFolder() const; + Int_t AddToBoard(TObject* obj); + void RemoveFromBoard(TObject* obj); + + ClassDef(AliObjectLoader,1) + + }; + +//__________________________________________ +//////////////////////////////////////////// +// // +// class AliTreeLoader // +// // +// // +//////////////////////////////////////////// + +class AliTreeLoader: public AliObjectLoader + { + public: + AliTreeLoader(){}; + AliTreeLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop = kFALSE); + virtual ~AliTreeLoader(){}; + + virtual TTree* Tree() const {return dynamic_cast(Get());} + virtual void MakeTree(); + virtual Int_t WriteData(Option_t* opt=""); + + ClassDef(AliTreeLoader,1) + }; + +//__________________________________________ +//////////////////////////////////////////// +// // +// class AliTaskLoader // +// // +// // +//////////////////////////////////////////// + +class AliTaskLoader: public AliBaseLoader + { + public: + AliTaskLoader():fParentalTask(0x0){}; + AliTaskLoader(const TString& name, AliDataLoader* dl, TTask* parentaltask, Bool_t storeontop = kFALSE); + virtual ~AliTaskLoader(){}; + + TObject* Get() const; + virtual TTask* Task() const {return dynamic_cast(Get());} + + protected: + Int_t AddToBoard(TObject* obj); + void RemoveFromBoard(TObject* obj); + TTask* GetParentalTask() const; + + private: + TTask* fParentalTask; + + ClassDef(AliTaskLoader,1) + }; + +#endif + + diff --git a/STEER/AliDebugVolume.cxx b/STEER/AliDebugVolume.cxx index 0ead08cbf69..3a99a90c934 100644 --- a/STEER/AliDebugVolume.cxx +++ b/STEER/AliDebugVolume.cxx @@ -21,7 +21,6 @@ // Author: A.Morsch //----------------------------------------------------------------------- - #include "AliDebugVolume.h" ClassImp(AliDebugVolume) diff --git a/STEER/AliDetector.cxx b/STEER/AliDetector.cxx index 6738269febf..b3897c432eb 100644 --- a/STEER/AliDetector.cxx +++ b/STEER/AliDetector.cxx @@ -35,17 +35,18 @@ #include -#include #include #include #include #include #include +#include #include "AliConfig.h" #include "AliDetector.h" #include "AliHit.h" #include "AliPoints.h" +#include "AliLoader.h" #include "AliRun.h" @@ -65,8 +66,8 @@ AliDetector::AliDetector(): fBufferSize(1600), fHits(0), fDigits(0), - fDigitsFile(0), - fPoints(0) + fPoints(0), + fLoader(0x0) { // // Default constructor for the AliDetector class @@ -83,8 +84,8 @@ AliDetector::AliDetector(const AliDetector &det): fBufferSize(1600), fHits(0), fDigits(0), - fDigitsFile(0), - fPoints(0) + fPoints(0), + fLoader(0x0) { det.Copy(*this); } @@ -99,8 +100,8 @@ AliDetector::AliDetector(const char* name,const char *title): fBufferSize(1600), fHits(0), fDigits(0), - fDigitsFile(0), - fPoints(0) + fPoints(0), + fLoader(0x0) { // // Normal constructor invoked by all Detectors. @@ -132,37 +133,22 @@ AliDetector::~AliDetector() delete fDigits; fDigits = 0; } - if (fDigitsFile) delete [] fDigitsFile; + + if (fLoader) + { + fLoader->GetModulesFolder()->Remove(this); + } + } //_______________________________________________________________________ void AliDetector::Publish(const char *dir, void *address, const char *name) { - // - // Register pointer to detector objects. - // - TFolder *topFolder = dynamic_cast(gROOT->FindObjectAny("/Folders")); - if (topFolder) { - TFolder *folder = dynamic_cast(topFolder->FindObjectAny(dir)); - // TFolder *folder = dynamic_cast(gROOT->FindObjectAny(dir)); - if (!folder) { - cerr << "Cannot register: Missing folder: " << dir << endl; - } else { - TFolder *subfolder = dynamic_cast(folder->FindObjectAny(this->GetName())); - - if(!subfolder) - subfolder = folder->AddFolder(this->GetName(),this->GetTitle()); - if (address) { - TObject **obj = static_cast(address); - if ((*obj)->InheritsFrom(TCollection::Class())) { - TCollection *collection = dynamic_cast(*obj); - if (name) - collection->SetName(name); - } - subfolder->Add(*obj); - } - } - } +// +// Register pointer to detector objects. +// +// TFolder *topFolder = (TFolder *)gROOT->FindObjectAny("/Folders"); + MayNotUse("Publish"); } //_______________________________________________________________________ @@ -179,66 +165,35 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, void* address,Int_t size, Int_t splitlevel, const char *file) { - // - // Makes branch in given tree and diverts them to a separate file - // - if (GetDebug()>1) - printf("* MakeBranch * Making Branch %s \n",name); - - TDirectory *cwd = gDirectory; - TBranch *branch = 0; - - if (classname) { - branch = tree->Branch(name,classname,address,size,splitlevel); - } else { - branch = tree->Branch(name,address,size); - } - - if (file) { - char * outFile = new char[strlen(gAlice->GetBaseFile())+strlen(file)+2]; - sprintf(outFile,"%s/%s",gAlice->GetBaseFile(),file); - branch->SetFile(outFile); - TIter next( branch->GetListOfBranches()); - while ((branch=dynamic_cast(next()))) { - branch->SetFile(outFile); - } - delete outFile; - - cwd->cd(); - - if (GetDebug()>1) - printf("* MakeBranch * Diverting Branch %s to file %s\n",name,file); - } - const char *folder = 0; - TString folderName(name); - - if (!strncmp(tree->GetName(),"TreeE",5)) folder = "RunMC/Event/Data"; - if (!strncmp(tree->GetName(),"TreeK",5)) folder = "RunMC/Event/Data"; - if (!strncmp(tree->GetName(),"TreeH",5)) { - folder = "RunMC/Event/Data/Hits"; - folderName = "Hits" ; - } - if (!strncmp(tree->GetName(),"TreeTrackReferences",5)) { - folder = "RunMC/Event/Data/TrackReferences"; - folderName = "TrackReferences" ; - } - - if (!strncmp(tree->GetName(),"TreeD",5)) { - folder = "Run/Event/Data"; - folderName = "Digits" ; - } - if (!strncmp(tree->GetName(),"TreeS",5)) { - folder = "RunMC/Event/Data/SDigits"; - folderName = "SDigits" ; - } - if (!strncmp(tree->GetName(),"TreeR",5)) folder = "Run/Event/RecData"; - - if (folder) { - if (GetDebug()) - printf("%15s: Publishing %s to %s\n",ClassName(),name,folder); - Publish(folder,address, folderName.Data()); - } +// +// Makes branch in given tree and diverts them to a separate file +// +// +// +// if (GetDebug()>1) + if(GetDebug()) Info("MakeBranch","Making Branch %s",name); + if (tree == 0x0) + { + Error("MakeBranch","Making Branch %s Tree is NULL",name); + return 0x0; + } + TBranch *branch = tree->GetBranch(name); + if (branch) + { + if(GetDebug()) Info("MakeBranch","Branch %s is already in tree.",name); return branch; + } + + if (classname) + { + branch = tree->Branch(name,classname,address,size,splitlevel); + } + else + { + branch = tree->Branch(name,address,size); + } + if(GetDebug()) Info("MakeBranch","Branch %s returning branch %#x",name,branch); + return branch; } //_______________________________________________________________________ @@ -277,7 +232,6 @@ void AliDetector::FinishRun() // } - //_______________________________________________________________________ AliHit* AliDetector::FirstHit(Int_t track) { @@ -289,8 +243,8 @@ AliHit* AliDetector::FirstHit(Int_t track) // track is returned // if(track>=0) { - gAlice->ResetHits(); - gAlice->TreeH()->GetEvent(track); + gAlice->ResetHits(); //stupid = if N detector this method is called N times + TreeH()->GetEvent(track); //skowron } // sMaxIterHit=fHits->GetEntriesFast(); @@ -299,7 +253,6 @@ AliHit* AliDetector::FirstHit(Int_t track) else return 0; } - //_______________________________________________________________________ AliHit* AliDetector::NextHit() { @@ -317,17 +270,24 @@ AliHit* AliDetector::NextHit() } } - //_______________________________________________________________________ void AliDetector::LoadPoints(Int_t) { // // Store x, y, z of all hits in memory // - if (fHits == 0) return; + if (fHits == 0) + { + Error("LoadPoints","fHits == 0. Name is %s",GetName()); + return; + } // Int_t nhits = fHits->GetEntriesFast(); - if (nhits == 0) return; + if (nhits == 0) + { +// Error("LoadPoints","nhits == 0. Name is %s",GetName()); + return; + } Int_t tracks = gAlice->GetNtrack(); if (fPoints == 0) fPoints = new TObjArray(tracks); AliHit *ahit; @@ -351,19 +311,23 @@ void AliDetector::LoadPoints(Int_t) ahit = dynamic_cast(fHits->UncheckedAt(hit)); trk=ahit->GetTrack(); assert(trk<=tracks); - if(ntrk[trk]==limi[trk]) { + if(ntrk[trk]==limi[trk]) + { // // Initialise a new track fp=new Float_t[3*(limi[trk]+chunk)]; - if(coor[trk]) { - memcpy(fp,coor[trk],sizeof(Float_t)*3*limi[trk]); - delete [] coor[trk]; - } + if(coor[trk]) + { + memcpy(fp,coor[trk],sizeof(Float_t)*3*limi[trk]); + delete [] coor[trk]; + } limi[trk]+=chunk; coor[trk] = fp; - } else { + } + else + { fp = coor[trk]; - } + } fp[3*ntrk[trk] ] = ahit->X(); fp[3*ntrk[trk]+1] = ahit->Y(); fp[3*ntrk[trk]+2] = ahit->Z(); @@ -389,51 +353,19 @@ void AliDetector::LoadPoints(Int_t) } //_______________________________________________________________________ -void AliDetector::MakeBranch(Option_t *option, const char *file) +void AliDetector::MakeBranch(Option_t *option) { // - // Create a new branch in the current Root Tree - // The branch of fHits is automatically split + // Create a new branch for this detector in its treeH // - - char branchname[10]; - sprintf(branchname,"%s",GetName()); - // - // Get the pointer to the header + + if(GetDebug()) Info("MakeBranch"," for %s",GetName()); const char *cH = strstr(option,"H"); - // - if (fHits && gAlice->TreeH() && cH) { - MakeBranchInTree(gAlice->TreeH(), - branchname, &fHits, fBufferSize, file) ; - } - - const char *cD = strstr(option,"D"); - if (cD) { - if (file) { - fDigitsFile = new char[strlen (file)]; - strcpy(fDigitsFile,file); - } - } -} -//_______________________________________________________________________ -void AliDetector::MakeBranchTR(Option_t *option, const char *file) -{ - // - // Create a new branch in the current Root Tree - // The branch of fHits is automatically split - // - - char branchname[10]; - sprintf(branchname,"%s",GetName()); - // - // Get the pointer to the header - const char *cTR = strstr(option,"T"); - // - if (fTrackReferences && gAlice->TreeTR() && cTR) { - MakeBranchInTree(gAlice->TreeTR(), - branchname, &fTrackReferences, fBufferSize, file) ; - } + if (fHits && TreeH() && cH) + { + MakeBranchInTree(TreeH(), GetName(), &fHits, fBufferSize, 0); + } } //_______________________________________________________________________ @@ -443,7 +375,7 @@ void AliDetector::ResetDigits() // Reset number of digits and the digits array // fNdigits = 0; - if (fDigits) fDigits->Clear(); + if (fDigits) fDigits->Clear(); } //_______________________________________________________________________ @@ -453,7 +385,7 @@ void AliDetector::ResetHits() // Reset number of hits and the hits array // fNhits = 0; - if (fHits) fHits->Clear(); + if (fHits) fHits->Clear(); } //_______________________________________________________________________ @@ -476,24 +408,78 @@ void AliDetector::SetTreeAddress() // Set branch address for the Hits and Digits Trees // TBranch *branch; - char branchname[20]; - sprintf(branchname,"%s",GetName()); // // Branch address for hit tree - TTree *treeH = gAlice->TreeH(); - if (treeH && fHits) { - branch = treeH->GetBranch(branchname); - if (branch) branch->SetAddress(&fHits); + + TTree *tree = TreeH(); + if (tree && fHits) { + branch = tree->GetBranch(GetName()); + if (branch) + { + if(GetDebug()) Info("SetTreeAddress","(%s) Setting for Hits",GetName()); + branch->SetAddress(&fHits); + } + else + { + Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName()); + } } + // // Branch address for digit tree - TTree *treeD = gAlice->TreeD(); + TTree *treeD = fLoader->TreeD(); if (treeD && fDigits) { - branch = treeD->GetBranch(branchname); + branch = treeD->GetBranch(GetName()); if (branch) branch->SetAddress(&fDigits); } AliModule::SetTreeAddress(); } +//_______________________________________________________________________ +void AliDetector::MakeTree(Option_t *option) + { + //makes a tree (container) for the data defined in option + //"H" - hits + //"D" - digits + //"S" - summable digits + //"R" - recontructed points and tracks + AliLoader* loader = GetLoader(); + if (loader == 0x0) + { + Error("MakeTree","Can not get loader for %s",GetName()); + return; + } + loader->MakeTree(option); //delegate this job to getter + } + +//_______________________________________________________________________ +AliLoader* AliDetector::MakeLoader(const char* topfoldername) +{ +//builds standard getter (AliLoader type) +//if detector wants to use castomized getter, it must overload this method + + cout<<"AliDetector::MakeLoader: Creating standard getter for detector "<TreeH(); + return tree; +} + diff --git a/STEER/AliDetector.h b/STEER/AliDetector.h index c8c9ac3f40a..c752a737d87 100644 --- a/STEER/AliDetector.h +++ b/STEER/AliDetector.h @@ -5,10 +5,13 @@ /* $Id$ */ -#include +#include "AliModule.h" + class AliHit; class TTree; class TBranch; +class AliLoader; + class AliDetector : public AliModule { public: @@ -25,6 +28,7 @@ public: virtual int GetNhits() const {return fNhits;} TClonesArray *Digits() const {return fDigits;} TClonesArray *Hits() const {return fHits;} + TObjArray *Points() const {return fPoints;} Int_t GetIshunt() const {return fIshunt;} void SetIshunt(Int_t ishunt) {fIshunt=ishunt;} @@ -36,10 +40,10 @@ public: virtual void Browse(TBrowser *b); virtual void FinishRun(); virtual void LoadPoints(Int_t track); - virtual void MakeBranch(Option_t *opt=" ", const char *file=0 ); - virtual void MakeBranchTR(Option_t *opt=" ", const char *file=0 ); + virtual void MakeBranch(Option_t *opt=" "); virtual void ResetDigits(); virtual void ResetHits(); + virtual void ResetPoints(); virtual void SetTreeAddress(); virtual void SetTimeGate(Float_t gate) {fTimeGate=gate;} @@ -51,8 +55,14 @@ public: virtual void SetBufferSize(Int_t bufsize=8000) {fBufferSize = bufsize;} virtual TBranch* MakeBranchInTree(TTree *tree, const char* cname, void* address, Int_t size=32000, const char *file=0); virtual TBranch* MakeBranchInTree(TTree *tree, const char* cname, const char* name, void* address, Int_t size=32000, Int_t splitlevel=99, const char *file=0); - - // Data members + + void MakeTree(Option_t *option); //skowron + + virtual AliLoader* MakeLoader(const char* topfoldername); //builds standard getter (AliLoader type) + void SetLoader(AliLoader* loader){fLoader = loader;} + AliLoader* GetLoader() const {return fLoader;} //skowron + TTree* TreeH(); //shorcut method for accessing treeH from folder + // Data members protected: Float_t fTimeGate; //Time gate in seconds @@ -63,9 +73,10 @@ protected: Int_t fBufferSize; //!buffer size for Tree detector branches TClonesArray *fHits; //!List of hits for one track only TClonesArray *fDigits; //!List of digits for this detector - char *fDigitsFile; //!File to store branches of digits tree for detector TObjArray *fPoints; //!Array of points for each track (all tracks in memory) - ClassDef(AliDetector,3) //Base class for ALICE detectors + AliLoader* fLoader;//! pointer to getter for this module skowron + + ClassDef(AliDetector,4) //Base class for ALICE detectors }; #endif diff --git a/STEER/AliDigitizer.cxx b/STEER/AliDigitizer.cxx index 6b14fa4afbc..fe002825194 100644 --- a/STEER/AliDigitizer.cxx +++ b/STEER/AliDigitizer.cxx @@ -21,7 +21,6 @@ // Author: Jiri Chudoba (CERN) //---------------------------------------------------------------------- - // system includes #include @@ -37,7 +36,6 @@ ClassImp(AliDigitizer) AliDigitizer::AliDigitizer(const Text_t* name, const Text_t* title): TTask(name,title), fManager(0) - { // // Default ctor with name and title diff --git a/STEER/AliDigitizer.h b/STEER/AliDigitizer.h index 05a1a248171..b6199489fae 100644 --- a/STEER/AliDigitizer.h +++ b/STEER/AliDigitizer.h @@ -22,14 +22,14 @@ class AliDigitizer: public TTask { public: // ctor with name and title AliDigitizer(const Text_t* name="AliDigitizer", - const Text_t* title="AliDigitizer"); + const Text_t* title="AliDigitizer"); // ctor to be used with name and title AliDigitizer(AliRunDigitizer *manager, - const Text_t* name="AliDigitizer", - const Text_t* title="AliDigitizer"); + const Text_t* name="AliDigitizer", + const Text_t* title="AliDigitizer"); // Copy ctor needed because there is a pointer AliDigitizer(const AliDigitizer &dig); - AliDigitizer& operator=(const AliDigitizer &dig) + AliDigitizer& operator=(AliDigitizer &dig) {dig.Copy(*this);return *this;} virtual ~AliDigitizer(); @@ -46,3 +46,4 @@ protected: }; #endif // ALIDIGITIZER_H + diff --git a/STEER/AliDisplay.cxx b/STEER/AliDisplay.cxx index 1003c55c0c1..c6c876099f5 100644 --- a/STEER/AliDisplay.cxx +++ b/STEER/AliDisplay.cxx @@ -15,7 +15,6 @@ /* $Id$ */ - ////////////////////////////////////////////////////////////////////////// // // // AliDisplay // @@ -88,7 +87,7 @@ AliDisplay::AliDisplay(): // } -//_______________________________________________________________________ +//_____________________________________________________________________________ AliDisplay::AliDisplay(Int_t size): fZoomMode(1), fDrawAllViews(kFALSE), @@ -118,102 +117,100 @@ AliDisplay::AliDisplay(Int_t size): fTracksToDisplay(0), fNTracksToDisplay(0) { - // Create an event display object. - // A canvas named "edisplay" is created with a vertical size in pixels - // - // A QUICK Overview of the Event Display functions - // =============================================== - // - // The event display can ve invoked by executing the macro "display.C" - // A canvas like in the picture below will appear. - // - // On the left side of the canvas, the following buttons appear: - // *Next* to move to the next event - // *Previous* to move to the previous event - // *Top View* to display a top view of the current event - // *Side View* to display a side view of the current event - // *Front View* to display a front view of the current event - // *All Views* to display front/side/top/30-30 views of the current event - // *OpenGL* to use OpenGl to view the current event. - // Note that OpenGL cannot be used across the network. - // Before using OpenGL, load the GL libraries - // by executing the macro GL.C (in $ROOTSYS/macros/GL.C. - // Once in GL, click the HELP button of the GL canvas. - // *X3D* to use X3D to view the current event (Unix only). - // Once in X3D, type M to see the list of all possible options. - // for example type J to zoom, K to unzoom - // use the mouse to rotate. - // *Pick* Select this option to be able to point on a track with the - // mouse. Once on the track, use the right button to select - // an action. For example, select SetMarkerAttributes to - // change the marker type/color/size for the track. - // *Zoom* Select this option (default) if you want to zoom. - // To zoom, simply select the selected area with the left button. - // *UnZoom* To revert to the previous picture size. - // - // slider R On the left side, the vertical slider can be used to - // set the default picture size. - // slider pcut At the top of the canvas, a slider can be used to change - // the momentum cut (or range) to display tracks. - // slider eta On the right side of the canvas, a vertical slider can be used - // to specify a rapidity range for the tracks. - // - // When you are in Zoom mode, you can click on the black part of the canvas - // to select special options with the right mouse button. - // This will display a pop-up menu with items like: - // *Disable detector* - // *Enable detector*, etc. - // For example select "Disable detector". You get a dialog box. - // Diable detector TRD for example. - // - // When you are in pick mode, you can "Inspect" the object pointed by the mouse. - // When you are on a track, select the menu item "InspectParticle" - // to display the current particle attributes. - // - // You can activate the Root browser by selecting the Inspect menu - // in the canvas tool bar menu. Then select "Start Browser" - // This will open a new canvas with the browser. At this point, you may want - // to display some histograms (from the Trees). Go to the "File" menu - // of the browser and click on "New canvas". - // In the browser, click on item "ROOT files" in the left pane. - // Click on galice.root. - // Click on TH - // Click on TPC for example - // Click on any variable (eg TPC.fX) to histogram the variable. - // - // If you are lost, you can click on HELP in any Root canvas or browser. - //Begin_Html - /* - - */ - //End_Html - +// Create an event display object. +// A canvas named "edisplay" is created with a vertical size in pixels +// +// A QUICK Overview of the Event Display functions +// =============================================== +// +// The event display can ve invoked by executing the macro "display.C" +// A canvas like in the picture below will appear. +// +// On the left side of the canvas, the following buttons appear: +// *Next* to move to the next event +// *Previous* to move to the previous event +// *Top View* to display a top view of the current event +// *Side View* to display a side view of the current event +// *Front View* to display a front view of the current event +// *All Views* to display front/side/top/30-30 views of the current event +// *OpenGL* to use OpenGl to view the current event. +// Note that OpenGL cannot be used across the network. +// Before using OpenGL, load the GL libraries +// by executing the macro GL.C (in $ROOTSYS/macros/GL.C. +// Once in GL, click the HELP button of the GL canvas. +// *X3D* to use X3D to view the current event (Unix only). +// Once in X3D, type M to see the list of all possible options. +// for example type J to zoom, K to unzoom +// use the mouse to rotate. +// *Pick* Select this option to be able to point on a track with the +// mouse. Once on the track, use the right button to select +// an action. For example, select SetMarkerAttributes to +// change the marker type/color/size for the track. +// *Zoom* Select this option (default) if you want to zoom. +// To zoom, simply select the selected area with the left button. +// *UnZoom* To revert to the previous picture size. +// +// slider R On the left side, the vertical slider can be used to +// set the default picture size. +// slider pcut At the top of the canvas, a slider can be used to change +// the momentum cut (or range) to display tracks. +// slider eta On the right side of the canvas, a vertical slider can be used +// to specify a rapidity range for the tracks. +// +// When you are in Zoom mode, you can click on the black part of the canvas +// to select special options with the right mouse button. +// This will display a pop-up menu with items like: +// *Disable detector* +// *Enable detector*, etc. +// For example select "Disable detector". You get a dialog box. +// Diable detector TRD for example. +// +// When you are in pick mode, you can "Inspect" the object pointed by the mouse. +// When you are on a track, select the menu item "InspectParticle" +// to display the current particle attributes. +// +// You can activate the Root browser by selecting the Inspect menu +// in the canvas tool bar menu. Then select "Start Browser" +// This will open a new canvas with the browser. At this point, you may want +// to display some histograms (from the Trees). Go to the "File" menu +// of the browser and click on "New canvas". +// In the browser, click on item "ROOT files" in the left pane. +// Click on galice.root. +// Click on TH +// Click on TPC for example +// Click on any variable (eg TPC.fX) to histogram the variable. +// +// If you are lost, you can click on HELP in any Root canvas or browser. +//Begin_Html +/* + +*/ +//End_Html + gAlice->SetDisplay(this); // Initialize display default parameters SetRange(); SetPTcut(); - // Set front view by default - // Create display canvas Int_t ysize = size; if (ysize < 100) ysize = 750; Int_t xsize = Int_t(size*830./ysize); fCanvas = new TCanvas("Canvas", "ALICE Event Display",14,47,xsize,ysize); fCanvas->ToggleEventStatus(); - + // Create main display pad fPad = new TPad("viewpad", "Alice display",0.15,0,0.97,0.96); fPad->Draw(); fPad->Modified(); fPad->SetFillColor(1); fPad->SetBorderSize(2); - + // Create user interface control pad DisplayButtons(); fCanvas->cd(); - + // Create Range and mode pad Float_t dxtr = 0.15; Float_t dytr = 0.45; @@ -222,12 +219,10 @@ AliDisplay::AliDisplay(Int_t size): fTrigPad->cd(); fTrigPad->SetFillColor(22); fTrigPad->SetBorderSize(2); - fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98); fRangeSlider->SetObject(this); char pickmode[] = "gAlice->Display()->SetPickMode()"; Float_t db = 0.09; - fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db); fPickButton->SetFillColor(38); fPickButton->Draw(); @@ -243,7 +238,6 @@ AliDisplay::AliDisplay(Int_t size): button->SetFillColor(38); button->Draw(); AppendPad(); // append display object as last object to force selection - // Create momentum cut slider pad fCanvas->cd(); fCutPad = new TPad("cutSlider", "pcut slider pad",dxtr,.96,1,1); @@ -251,7 +245,6 @@ AliDisplay::AliDisplay(Int_t size): fCutPad->cd(); fCutPad->SetFillColor(22); fCutPad->SetBorderSize(2); - fCutSlider = new TSlider("pcut","Momentum cut",0,0,1,1); fCutSlider->SetRange(fPTcut/kptcutmax,1); fCutSlider->SetObject(this); @@ -265,16 +258,13 @@ AliDisplay::AliDisplay(Int_t size): cutaxis->SetTitleOffset(0.5); cutaxis->SetTitle("pcut . "); fCutSlider->GetListOfPrimitives()->AddFirst(cutaxis); - // Create rapidity cut slider pad fCanvas->cd(); - fEtaPad = new TPad("EtaSlider", "Eta slider pad",0.97,0,1,0.96); fEtaPad->Draw(); fEtaPad->cd(); fEtaPad->SetFillColor(22); fEtaPad->SetBorderSize(2); - fEtaSlider = new TSlider("etacut","Rapidity cut",0,0,1,1); fEtaSlider->SetObject(this); fEtaSlider->SetFillColor(45); @@ -288,12 +278,12 @@ AliDisplay::AliDisplay(Int_t size): cutaxis->SetTitle("Etacut . "); fEtaSlider->GetListOfPrimitives()->AddFirst(etaaxis); fCanvas->cd(); - + fTrigPad->SetEditable(kFALSE); fButtons->SetEditable(kFALSE); fTracksToDisplay =0; fNTracksToDisplay =0; - + fCanvas->cd(); fCanvas->Update(); } @@ -820,28 +810,50 @@ void AliDisplay::LoadPoints() TIter next(gAlice->Modules()); AliModule *module; Int_t ntracks = gAlice->GetNtrack(); - + + while((module = (AliModule*)next())) + { + AliDetector* detector = dynamic_cast(module); + if(detector) detector->SetTreeAddress(); + } + next.Reset(); + // load only wanted tracks - if (fNTracksToDisplay>0){ - Int_t nprim = gAlice->Stack()->GetNprimary(); - for (Int_t track=0; track0) + { + Int_t nprim = gAlice->Stack()->GetNprimary(); + for (Int_t track=0; trackResetHits(); + Int_t nev = nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]); + while((module = (AliModule*)next())) + { + AliDetector* detector = dynamic_cast(module); + if(detector) + { + detector->TreeH()->GetEvent(nev); + module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); + } + } + next.Reset(); + } + } + else + { + + for (Int_t track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); - while((module = dynamic_cast(next()))) { - module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); + while((module = (AliModule*)next())) { + AliDetector* detector = dynamic_cast(module); + if(detector) + { + detector->TreeH()->GetEvent(track); + detector->LoadPoints(track); + } } next.Reset(); } } - else - for (Int_t track=0; trackResetHits(); - gAlice->TreeH()->GetEvent(track); - while((module = dynamic_cast(next()))) { - module->LoadPoints(track); - } - next.Reset(); - } } //_____________________________________________________________________________ @@ -927,11 +939,14 @@ void AliDisplay::ShowNextEvent(Int_t delta) // delta = -1 show previous event if (delta) { - gAlice->Clear(); - Int_t currentEvent = gAlice->GetHeader()->GetEvent(); +// gAlice->Clear(); + //Int_t currentEvent = gAlice->GetHeader()->GetEvent();//event number is not filled correctly + Int_t currentEvent = gAlice->GetRunLoader()->GetEventNumber(); Int_t newEvent = currentEvent + delta; gAlice->GetEvent(newEvent); - if (!gAlice->TreeH()) return; + cout<<"AliDisplay::ShowNextEvent: delta = "<cd(); +// AliCopy(gFileHits,fileSDigits); +// gFileHits->cd(); } // ITS @@ -85,8 +81,8 @@ Int_t AliHits2SDigits(TString fileNameSDigits="sdigits.root", iITS = 0; cerr<<"AliITS object not found on file." << endl; } else if (!ITS->GetITSgeom()) { - iITS = 0; cerr<<"AliITSgeom not found." << endl; + iITS = 0; } } @@ -110,14 +106,10 @@ Int_t AliHits2SDigits(TString fileNameSDigits="sdigits.root", // PHOS AliPHOSSDigitizer *sdPHOS; if (iPHOS) { - sdPHOS = new AliPHOSSDigitizer(fileNameHits.Data()); + sdPHOS = new AliPHOSSDigitizer(fileName.Data()); } -// TOF - AliTOFSDigitizer *sdTOF; - if (iTOF) { - sdTOF = new AliTOFSDigitizer(fileNameHits.Data(),firstEvent,nEvents); - } + // // loop over events @@ -125,52 +117,59 @@ Int_t AliHits2SDigits(TString fileNameSDigits="sdigits.root", TStopwatch timer; timer.Start(); for (Int_t iEvent = firstEvent;iEventGetEvent(iEvent); - if (!gAlice->TreeS()) gAlice->MakeTree("S",fileSDigits); + rl->GetEvent(iEvent); +// gAlice->MakeTree("S",fileSDigits); // ITS if (iITS) { if (gDEBUG) {cout<<" Create ITS sdigits: ";} - ITS->MakeBranch("S"); - ITS->SetTreeAddress(); - ITS->Hits2SDigits(); - if (gDEBUG) {cout<<"done"<GetLoader("ITSLoader"); + if (loader) + { + loader->LoadHits("read"); + loader->LoadSDigits("update"); + ITS->SetTreeAddress(); + ITS->Hits2SDigits(); + loader->UnloadHits(); + loader->UnloadSDigits(); + if (gDEBUG) {cout<<"done"<SetActiveSectors(1); - if (gDEBUG) {cout<<"All TPC sectors set active."<SetActiveSectors(0); - if (gDEBUG) { - printf("\nActive sectors\n"); - Int_t iActive = 0; - for (Int_t i=0;i<72;i++) { - if (TPC->IsSectorActive(i)) { - printf("%2d ",i); - iActive++; - if (iActive%10 == 0) printf("\n"); - } - } - printf("\n"); - } - } - TPC->Hits2SDigits2(iEvent); - if (gDEBUG) {cout<<"done"<GetLoader("TPCLoader"); + if (loader) + { + loader->LoadHits("read"); + loader->LoadSDigits("update"); + + TPC->SetActiveSectors(1); + TPC->Hits2SDigits2(iEvent); + loader->UnloadHits(); + loader->UnloadSDigits(); + if (gDEBUG) {cout<<"done"<InitOutput(fileSDigits, iEvent); - sdTRD->MakeDigits(); - sdTRD->WriteDigits(); - if (gDEBUG) {cout<<"done"<GetLoader("TRDLoader"); + if (loader) + { + loader->LoadHits("read"); + loader->LoadSDigits("update"); + sdTRD->MakeDigits(); + sdTRD->WriteDigits(); + loader->UnloadHits(); + loader->UnloadSDigits(); + if (gDEBUG) {cout<<"done"<ExecuteTask("deb all"); } -// TOF does its own loop - if (iTOF) { - sdTOF->Exec(""); - } - - // // finish // timer.Stop(); timer.Print(); - if (iTRD) { - fileSDigits->cd(); - sdTRD->GetParameter()->Write(); - } - - gFileHits->cd(); - delete gAlice; - gAlice = 0; - if (!gSameFiles) { - gFileHits->Close(); - delete gFileHits; - } - + delete rl; } //////////////////////////////////////////////////////////////////////// -TFile* Init(TString fileNameSDigits, TString fileNameHits) { +AliRunLoader* Init(TString fileName) + { // open input file, read in gAlice, prepare output file if (gAlice) delete gAlice; gAlice = 0; - - Bool_t gSameFiles = kFALSE; - if (fileNameSDigits == fileNameHits || fileNameSDigits == "") gSameFiles = kTRUE; - - TString fileMode = "read"; - if (gSameFiles) fileMode = "update"; - - gFileHits = TFile::Open(fileNameHits.Data(),fileMode.Data()); - if (!gFileHits->IsOpen()) { - cerr<<"Can't open "<InitTreeFile("S",fileNameSDigits.Data()); - return gFileHits; - + AliRunLoader*rl = AliRunLoader::Open(fileName); + if (rl == 0x0) return 0x0; + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + return rl; + } -//////////////////////////////////////////////////////////////////////// -TFile* OpenFile(TString fileName) { -// open file fileName - TFile *file = TFile::Open(fileName.Data()); - if (!file->IsOpen()) { - cerr<<"Can't open "<Get("gAlice"); - if (!gAlice) return kFALSE; - return kTRUE; -} //////////////////////////////////////////////////////////////////////// AliTRDdigitizer *InitTRDdigitizer() { // initialization of TRD digitizer AliTRDdigitizer *sdTRD = new AliTRDdigitizer("TRDdigitizer" - ,"TRD digitizer class"); + ,"TRD digitizer class"); sdTRD->SetDebug(0); sdTRD->SetSDigits(kTRUE); AliTRDparameter *TRDparam = new AliTRDparameter("TRDparameter" - ,"TRD parameter class"); + ,"TRD parameter class"); sdTRD->SetParameter(TRDparam); sdTRD->InitDetector(); @@ -267,7 +223,7 @@ AliTRDdigitizer *InitTRDdigitizer() { return sdTRD; } //////////////////////////////////////////////////////////////////////// -void AliCopy(TFile *inputFile, TFile *outputFile) { +/*void AliCopy(TFile *inputFile, TFile *outputFile) { // copy some objects // copy gAlice @@ -302,3 +258,4 @@ void AliCopy(TFile *inputFile, TFile *outputFile) { if (gDEBUG) cout<<"done"< + +//Root includes +#include +#include +#include +#include +#include +#include +#include + +//AliRoot includes +#include +#include +#include +#include +#include + +Int_t AliLoader::fgDebug = 0; + +const TString AliLoader::fgkDefaultHitsContainerName("TreeH"); +const TString AliLoader::fgkDefaultDigitsContainerName = "TreeD"; +const TString AliLoader::fgkDefaultSDigitsContainerName = "TreeS"; +const TString AliLoader::fgkDefaultRecPointsContainerName = "TreeR"; +const TString AliLoader::fgkDefaultTracksContainerName = "TreeT"; +const TString AliLoader::fgkDefaultRecParticlesContainerName = "TreeP"; +const TString AliLoader::fgkLoaderBaseName("Loader"); + +ClassImp(AliLoader) +//___________________________________________________________________ +///////////////////////////////////////////////////////////////////// +// // +// class AliLoader // +// // +// Base class for Loaders. // +// Loader provides base I/O fascilities for "standard" data. // +// Each detector has a laoder data member // +// loader is accessible via folder structure as well // +// // +///////////////////////////////////////////////////////////////////// + +/*****************************************************************************/ + +AliLoader::AliLoader(): + fDataLoaders(0x0), + fDetectorName(""), + fEventFolder(0x0), + fDataFolder(0x0), + fDetectorDataFolder(0x0), + fModuleFolder(0x0), + fTasksFolder(0x0), + fQAFolder(0x0) + { +//default constructor + + } +/******************************************************************/ + +AliLoader::AliLoader(const Char_t* detname,const Char_t* eventfoldername): + fDataLoaders(new TObjArray(kNDataTypes)), + fDetectorName(""), + fEventFolder(0x0), + fDataFolder(0x0), + fDetectorDataFolder(0x0), + fModuleFolder(0x0), + fTasksFolder(0x0), + fQAFolder(0x0) +{ + //ctor + if (GetDebug()) Info("AliLoader(const Char_t* detname,const Char_t* eventfoldername)", + "detname = %s eventfoldername = %s",detname,eventfoldername); + + //try to find folder eventfoldername in top alice folder + //safe because GetTopFolder will abort in case of failure + + fDetectorName = detname; + fName = fDetectorName+"Loader"; + InitDefaults(); + + TObject* fobj = GetTopFolder()->FindObject(eventfoldername); + fEventFolder = (fobj)?dynamic_cast(fobj):0x0;//in case FindObject returns NULL dynamic cast cause seg. fault + SetEventFolder(fEventFolder); + + } +/*****************************************************************************/ + +AliLoader::AliLoader(const Char_t * detname,TFolder* eventfolder): + fDataLoaders(new TObjArray(kNDataTypes)), + fDetectorName(detname), + fEventFolder(0x0), + fDataFolder(0x0), + fDetectorDataFolder(0x0), + fModuleFolder(0x0), + fTasksFolder(0x0), + fQAFolder(0x0) +{ +//constructor + fDetectorName = detname; + fName = fDetectorName+"Loader"; + InitDefaults(); + SetEventFolder(eventfolder); + //fileoption's don't need to initialized because default TString ctor does it correctly +} +/*****************************************************************************/ + +AliLoader::~AliLoader() +{ +//detructor + if (fDataLoaders) fDataLoaders->SetOwner(); + delete fDataLoaders; +} +/*****************************************************************************/ + +void AliLoader::InitDefaults() +{ + // H I T S + AliDataLoader* dl; + dl = new AliDataLoader(fDetectorName + ".Hits.root",fgkDefaultHitsContainerName, "Hits" ); + fDataLoaders->AddAt(dl,kHits); + + + // S U M M A B L E D I G I T S + dl = new AliDataLoader(fDetectorName + ".SDigits.root",fgkDefaultSDigitsContainerName, "Summable Digits"); + AliTaskLoader* tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetSDigitizerTaskName(), + dl,AliRunLoader::GetRunSDigitizer(),kTRUE); + dl->SetBaseTaskLoader(tl); + fDataLoaders->AddAt(dl,kSDigits); + + // D I G I T S + dl = new AliDataLoader(fDetectorName + ".Digits.root",fgkDefaultDigitsContainerName, "Digits"); + tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetDigitizerTaskName(), + dl,AliRunLoader::GetRunDigitizer(),kTRUE); + dl->SetBaseTaskLoader(tl); + fDataLoaders->AddAt(dl,kDigits); + + // R E C O N S T R U C T E D P O I N T S aka C L U S T E R S + dl = new AliDataLoader(fDetectorName + ".RecPoints.root",fgkDefaultRecPointsContainerName, "Reconstructed Points"); + tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetReconstructionerTaskName(), + dl,AliRunLoader::GetRunReconstructioner(),kTRUE); + dl->SetBaseTaskLoader(tl); + fDataLoaders->AddAt(dl,kRecPoints); + + // T R A C K S + dl = new AliDataLoader(fDetectorName + ".Tracks.root",fgkDefaultTracksContainerName, "Tracks"); + tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetTrackerTaskName(), + dl,AliRunLoader::GetRunTracker(),kTRUE); + dl->SetBaseTaskLoader(tl); + fDataLoaders->AddAt(dl,kTracks); + + // R E C O N S T R U C T E D P O I N T S aka C L U S T E R S + dl = new AliDataLoader(fDetectorName + ".RecParticles.root",fgkDefaultRecParticlesContainerName, "Reconstructed Particles"); + tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetPIDTaskName(), + dl,AliRunLoader::GetRunPIDTask(),kTRUE); + dl->SetBaseTaskLoader(tl); + fDataLoaders->AddAt(dl,kRecParticles); + + } +/*****************************************************************************/ + +AliDataLoader* AliLoader::GetDataLoader(const char* name) +{ +//returns Data Loader with specified name + return dynamic_cast(fDataLoaders->FindObject(name)); +} +/*****************************************************************************/ + +Int_t AliLoader::SetEvent() +{ + //basically the same that GetEvent but do not post data to folders + TIter next(fDataLoaders); + AliDataLoader* dl; + while ((dl = (AliDataLoader*)next())) + { + dl->SetEvent(); + } + return 0; +} +/******************************************************************/ + +Int_t AliLoader::GetEvent() +{ + //changes to proper root directory and tries to load data from files to folders + // event number is defined in RunLoader + // + //returns: + // 0 - in case of no error + // 1 - event not found + // + + Int_t retval; + TIter next(fDataLoaders); + AliDataLoader* dl; + while ((dl = (AliDataLoader*)next())) + { + retval = dl->GetEvent(); + if (retval) + { + Error("GetEvent","Error occured while GetEvent for %s",dl->GetName()); + return retval; + } + } + + return 0; +} + +/******************************************************************/ + +TFolder* AliLoader::GetTopFolder() +{ +//returns TOP aliroot folder, just a simple interface to AliConfig (gives shorter notation) + return AliConfig::Instance()->GetTopFolder(); +} + +/******************************************************************/ + +TFolder* AliLoader::GetEventFolder() +{ +//get EVENT folder (data that are changing from event to event, even in single run) + return fEventFolder; +} +/******************************************************************/ +TFolder* AliLoader::GetDataFolder() +{ +//returns the folder speciofic to given detector e.g. /Folders/Event/Data/ + if (!fDataFolder) + { + fDataFolder = dynamic_cast(GetEventFolder()->FindObject(AliConfig::fgkDataFolderName)); + + if (!fDataFolder) + { + Fatal("GetDataFolder","Can not find AliRoot data folder. Aborting"); + return 0x0; + } + } + return fDataFolder; +} + +/*****************************************************************************/ + +TFolder* AliLoader::GetTasksFolder() +{ +//Returns pointer to Folder with Alice Tasks + if (!fTasksFolder) + { + fTasksFolder = dynamic_cast(GetTopFolder()->FindObject(AliConfig::fgkTasksFolderName)); + + if (!fTasksFolder) + { + Fatal("GetTasksFolder","Can not find tasks folder. Aborting"); + return 0x0; + } + } + return fTasksFolder; + +} +/*****************************************************************************/ + +TFolder* AliLoader::GetModulesFolder() +{ + if (!fModuleFolder) + { + fModuleFolder = dynamic_cast(GetEventFolder()->FindObjectAny(AliConfig::GetModulesFolderName())); + + if (!fModuleFolder) + { + Fatal("GetModulesFolder","Can not find modules folder. Aborting"); + return 0x0; + } + } + return fModuleFolder; + +} +/*****************************************************************************/ + +TFolder* AliLoader::GetQAFolder() +{ + //returns folder with Quality assurance + if (fQAFolder == 0x0) + { + TObject *obj = GetEventFolder()->FindObjectAny(AliConfig::Instance()->GetQAFolderName()); + fQAFolder = (obj)?dynamic_cast(obj):0x0; + + if (fQAFolder == 0x0) + { + Fatal("GetQAFolder","Can not find Quality Assurance folder. Aborting"); + return 0x0; + } + } + return fQAFolder; + +} +/*****************************************************************************/ +TTask* AliLoader::SDigitizer() +{ +//returns SDigitizer task for this detector + return GetSDigitsDataLoader()->GetBaseTaskLoader()->Task(); + +} +/*****************************************************************************/ + +AliDigitizer* AliLoader::Digitizer() +{ +//returns Digitizer task for this detector + return dynamic_cast(GetDigitsDataLoader()->GetBaseTaskLoader()->Task()); +} +/*****************************************************************************/ + +TTask* AliLoader::Reconstructioner() +{ +//returns Recontructioner (Cluster Finder, Cluster Maker, +//or whatever you want to call it) task for this detector + return GetRecPointsDataLoader()->GetBaseTaskLoader()->Task(); +} +/*****************************************************************************/ + +TTask* AliLoader::Tracker() +{ +//returns tracker + return dynamic_cast(GetTracksDataLoader()->GetBaseTaskLoader()->Task()); +} + +/*****************************************************************************/ +TTask* AliLoader::PIDTask() +{ +//returns tracker + return dynamic_cast(GetRecParticlesDataLoader()->GetBaseTaskLoader()->Task()); +} + +/*****************************************************************************/ + +TTask* AliLoader::QAtask(const char* name) +{ + TTask* qat = AliRunLoader::GetRunQATask(); + if ( qat == 0x0 ) + { + Error("QAtask","Can not get RunQATask. (Name:%s)",GetName()); + return 0x0; + } + + TString dqatname(fDetectorName + AliConfig::Instance()->GetQATaskName()); + TTask* dqat = dynamic_cast(qat->GetListOfTasks()->FindObject(dqatname)); + + if ( dqat == 0x0 ) + { + Error("QAtask","Can not find QATask in RunQATask for %s",GetDetectorName().Data()); + return 0x0; + } + + if (strlen(name) == 0) return dqat; + + TList* list = dqat->GetListOfTasks(); + + TIter it(list) ; + TTask * task = 0 ; + while((task = static_cast(it.Next()) )) + { + TString taskname(task->GetName()) ; + if(taskname.BeginsWith(name)) + return task ; + } + Error("QAtask","Can not find sub-task with name starting with %s in task %s",name,dqat->GetName()); + return 0x0; +} +/*****************************************************************************/ + +TDirectory* AliLoader::ChangeDir(TFile* file, Int_t eventno) +{ +//changes the root directory in "file" to "dirname" which corresponds to event 'eventno' +//in case of success returns the pointer to directory +//else NULL + + if (file == 0x0) + { + ::Error("AliLoader::ChangeDir","File is null"); + return 0x0; + } + if (file->IsOpen() == kFALSE) + { + ::Error("AliLoader::ChangeDir","File is not opened"); + return 0x0; + } + + TString dirname("Event"); + dirname+=eventno; + if (AliLoader::fgDebug > 1) + ::Info("AliLoader::ChangeDir","Changing Dir to %s in file %s.",dirname.Data(),file->GetName()); + + Bool_t result; + + TDirectory* dir = dynamic_cast(file->Get(dirname)); + + if (dir == 0x0) + { + if (AliLoader::fgDebug > 1) + ::Info("AliLoader::ChangeDir","Can not find directory %s in file %s, creating...", + dirname.Data(),file->GetName()); + + if (file->IsWritable() == kFALSE) + { + ::Error("AliLoader::ChangeDir","Can not create directory. File %s in not writable.", + file->GetName()); + return 0x0; + } + + TDirectory* newdir = file->mkdir(dirname); + if (newdir == 0x0) + { + ::Error("AliLoader::ChangeDir","Failed to create new directory in file %s.", + file->GetName()); + return 0x0; + } + result = file->cd(dirname); + if (result == kFALSE) + { + return 0x0; + } + } + else + { + file->cd();//make a file active + file->cd(dirname);//cd event dir + } + + return gDirectory; +} +/*****************************************************************************/ + +TString AliLoader::GetUnixDir() + { + //This Method will manage jumping through unix directories in case of + //run with more events per run than defined in gAlice + + TString dir; + + return dir; + } +/*****************************************************************************/ +/************************************************************/ + +void AliLoader::MakeTree(Option_t *option) + { +//Makes a tree depending on option +// H: - Hits +// D: - Digits +// S: - Summable Digits +// R: - Reconstructed Points (clusters) +// T: - Tracks (tracklets) + + const char *oH = strstr(option,"H"); + const char *oD = strstr(option,"D"); + const char *oS = strstr(option,"S"); + const char *oR = strstr(option,"R"); + const char *oT = strstr(option,"T"); + const char *oP = strstr(option,"P"); + + if (oH) MakeHitsContainer(); + if (oD) MakeDigitsContainer(); + if (oS) MakeSDigitsContainer(); + if (oR) MakeRecPointsContainer(); + if (oT) MakeTracksContainer(); + if (oP) MakeRecParticlesContainer(); + } + +/*****************************************************************************/ +Int_t AliLoader::WriteHits(Option_t* opt) + { + AliDataLoader* dl = GetHitsDataLoader(); + Int_t ret = dl->WriteData(opt); + return ret; + } +/*****************************************************************************/ + +Int_t AliLoader::WriteSDigits(Option_t* opt) + { + AliDataLoader* dl = GetSDigitsDataLoader(); + Int_t ret = dl->WriteData(opt); + return ret; + } + +/*****************************************************************************/ + +Int_t AliLoader::PostSDigitizer(TTask* sdzer) +{ + return GetSDigitsDataLoader()->GetBaseTaskLoader()->Post(sdzer); +} +/*****************************************************************************/ + +Int_t AliLoader::PostDigitizer(AliDigitizer* task) + { + return GetDigitsDataLoader()->GetBaseTaskLoader()->Post(task); + } +/*****************************************************************************/ + +Int_t AliLoader::PostReconstructioner(TTask* task) + { + return GetRecPointsDataLoader()->GetBaseTaskLoader()->Post(task); + } +/*****************************************************************************/ + +Int_t AliLoader::PostTracker(TTask* task) + { + return GetTracksDataLoader()->GetBaseTaskLoader()->Post(task); + } +/*****************************************************************************/ + +Int_t AliLoader::PostPIDTask(TTask* task) + { + return GetRecParticlesDataLoader()->GetBaseTaskLoader()->Post(task); + } +/*****************************************************************************/ + +TObject** AliLoader::GetDetectorDataRef(TObject *obj) +{ + if (obj == 0x0) + { + return 0x0; + } + return GetDetectorDataFolder()->GetListOfFolders()->GetObjectRef(obj) ; +} +/*****************************************************************************/ + +TObject** AliLoader::SDigitizerRef() +{ + TTask* rsd = AliRunLoader::GetRunSDigitizer(); + if (rsd == 0x0) + { + return 0x0; + } + return rsd->GetListOfTasks()->GetObjectRef(SDigitizer()); +} +/*****************************************************************************/ + +TObject** AliLoader::DigitizerRef() +{ + TTask* rd = AliRunLoader::GetRunDigitizer(); + if (rd == 0x0) + { + return 0x0; + } + return rd->GetListOfTasks()->GetObjectRef(Digitizer()) ; +} +/*****************************************************************************/ + +TObject** AliLoader::ReconstructionerRef() +{ + TTask* rrec = AliRunLoader::GetRunReconstructioner(); + if (rrec == 0x0) + { + return 0x0; + } + return rrec->GetListOfTasks()->GetObjectRef(Reconstructioner()); +} +/*****************************************************************************/ + +TObject** AliLoader::TrackerRef() +{ + TTask* rrec = AliRunLoader::GetRunTracker(); + if (rrec == 0x0) + { + return 0x0; + } + return rrec->GetListOfTasks()->GetObjectRef(Tracker()); +} +/*****************************************************************************/ + +TObject** AliLoader::PIDTaskRef() +{ + TTask* rrec = AliRunLoader::GetRunPIDTask(); + if (rrec == 0x0) + { + return 0x0; + } + return rrec->GetListOfTasks()->GetObjectRef(PIDTask()); +} + +/*****************************************************************************/ +void AliLoader::CleanFolders() + { + //Cleans all posted objects == removes from folders and deletes them + TIter next(fDataLoaders); + AliDataLoader* dl; + while ((dl = (AliDataLoader*)next())) + { + if (GetDebug()) Info("CleanFolders","name = %s cleaning",dl->GetName()); + dl->Clean(); + } + } +/*****************************************************************************/ + +/*****************************************************************************/ + +void AliLoader::CleanSDigitizer() +{ +//removes and deletes detector task from Run Task + TTask* task = AliRunLoader::GetRunSDigitizer(); + if (task == 0x0) + { + Error("CleanSDigitizer","Can not get RunSDigitizer from folder. Can not clean"); + return; + } + + if (GetDebug()) Info("CleanSDigitizer","Attempting to delete S Digitizer"); + delete task->GetListOfTasks()->Remove(SDigitizer()); //TTList::Remove does not delete object +} +/*****************************************************************************/ + +void AliLoader::CleanDigitizer() +{ +//removes and deletes detector task from Run Task + TTask* task = AliRunLoader::GetRunDigitizer(); + if (task == 0x0) + { + Error("CleanDigitizer","Can not get RunDigitizer from folder. Can not clean"); + return; + } + + if (GetDebug()) + Info("CleanDigitizer","Attempting to delete Digitizer %X", + task->GetListOfTasks()->Remove(Digitizer())); + delete task->GetListOfTasks()->Remove(Digitizer()); //TTList::Remove does not delete object +} +/*****************************************************************************/ + +void AliLoader::CleanReconstructioner() +{ +//removes and deletes detector Reconstructioner from Run Reconstructioner + TTask* task = AliRunLoader::GetRunReconstructioner(); + if (task == 0x0) + { + Error("CleanReconstructioner","Can not get RunReconstructioner from folder. Can not clean"); + return; + } + + if (GetDebug()) + Info("CleanReconstructioner","Attempting to delete Reconstructioner"); + delete task->GetListOfTasks()->Remove(Reconstructioner()); //TTList::Remove does not delete object +} +/*****************************************************************************/ + +void AliLoader::CleanTracker() +{ +//removes and deletes detector tracker from Run Tracker + TTask* task = AliRunLoader::GetRunTracker(); + if (task == 0x0) + { + Error("CleanTracker","Can not get RunTracker from folder. Can not clean"); + return; + } + + if (GetDebug()) + Info("CleanTracker","Attempting to delete Tracker %X", + task->GetListOfTasks()->Remove(Tracker())); + delete task->GetListOfTasks()->Remove(Tracker()); //TTList::Remove does not delete object +} +/*****************************************************************************/ + +void AliLoader::CleanPIDTask() +{ +//removes and deletes detector Reconstructioner from Run Reconstructioner + TTask* task = AliRunLoader::GetRunPIDTask(); + if (task == 0x0) + { + Error("CleanPIDTask","Can not get Run PID Task from folder. Can not clean"); + return; + } + + if (GetDebug()) + Info("CleanPIDTask","Attempting to delete PID Task"); + delete task->GetListOfTasks()->Remove(PIDTask()); //TTList::Remove does not delete object +} +/*****************************************************************************/ + +Int_t AliLoader::ReloadAll() +{ + TIter next(fDataLoaders); + AliDataLoader* dl; + + while((dl = (AliDataLoader*)next())) + { + Int_t err = dl->Reload(); + if (err) + { + Error("ReloadAll","Reload returned error for %s",dl->GetName()); + return err; + } + } + return 0; +} +/*****************************************************************************/ + +void AliLoader::CloseFiles() +{ +//close files for data loaders + TIter next(fDataLoaders); + AliDataLoader* dl; + while((dl = (AliDataLoader*)next())) + { + dl->CloseFile(); + } +} +/*****************************************************************************/ + +Int_t AliLoader::SetEventFolder(TFolder* eventfolder) +{ + if (eventfolder == 0x0) + { + Error("SetEventFolder","Stupid joke. Argument is NULL"); + return 1; + } + + fEventFolder = eventfolder; + TIter next(fDataLoaders); + AliDataLoader* dl; + + while((dl = (AliDataLoader*)next())) + { + dl->SetEventFolder(fEventFolder); + dl->SetFolder(GetDetectorDataFolder()); //Must exists - ensure register is called before + } + + return 0; +}//sets the event folder +/*****************************************************************************/ + +Int_t AliLoader::Register(TFolder* eventFolder) +{ +//triggers creation of subfolders for a given detector +//this method is called when session is read from disk +// +//warning: AliDetector in constructor (not default) calls +//creation of folder structure as well (some detectors needs folders +//alrady in constructors) + + if (GetDebug()) Info("Register","Name is %s.",GetName()); + if (eventFolder == 0x0) + { + Error("Register","Event folder is not set."); + return 1; + } + Int_t retval = AliConfig::Instance()->AddDetector(eventFolder,fDetectorName,fDetectorName); + if(retval) + { + Error("SetEventFolder","Can not create tasks and/or folders for %s. Event folder name is %s", + fDetectorName.Data(),eventFolder->GetName()); + return retval; + } + SetEventFolder(eventFolder); + return 0; +} +/*****************************************************************************/ +AliRunLoader* AliLoader::GetRunLoader() +{ +//gets the run-loader from event folder + AliRunLoader* rg = 0x0; + TObject * obj = GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + if (obj) rg = dynamic_cast(obj); + return rg; +} +/*****************************************************************************/ +Bool_t AliLoader::TestFileOption(Option_t* opt) +{ +//tests the TFile::Option +//if file is truncated at opening moment ("recreate", "new" or "create") returns kFALSE; +//else kTRUE (means opened with "read" or "update" mode) + TString option(opt); + if (option.CompareTo("recreate",TString::kIgnoreCase) == 0) return kFALSE; + if (option.CompareTo("new",TString::kIgnoreCase) == 0) return kFALSE; + if (option.CompareTo("create",TString::kIgnoreCase) == 0) return kFALSE; + return kTRUE; +} +/*****************************************************************************/ +void AliLoader::SetDirName(TString& dirname) +{ +//adds "dirname/" to each file + TIter next(fDataLoaders); + AliDataLoader* dl; + while((dl = (AliDataLoader*)next())) + { + dl->SetDirName(dirname); + } +} + +/*****************************************************************************/ + +void AliLoader::SetDigitsFileNameSuffix(const TString& suffix) +{ + //adds the suffix before ".root", + //e.g. TPC.Digits.root -> TPC.DigitsMerged.root + //made on Jiri Chudoba demand + GetDigitsDataLoader()->SetFileNameSuffix(suffix); +} +/*****************************************************************************/ + +void AliLoader::SetCompressionLevel(Int_t cl) +{ +//sets comression level for data defined by di + TIter next(fDataLoaders); + AliDataLoader* dl; + while((dl = (AliDataLoader*)next())) + { + dl->SetCompressionLevel(cl); + } +} +/*****************************************************************************/ + +void AliLoader::Clean() +{ +//Cleans all data loaders + TIter next(fDataLoaders); + AliDataLoader* dl; + while((dl = (AliDataLoader*)next())) + { + dl->Clean(); + } +} +/*****************************************************************************/ + +void AliLoader::Clean(const TString& name) +{ + TObject* obj = GetDetectorDataFolder()->FindObject(name); + if(obj) + { + if (GetDebug()) + Info("Clean(const TString&)","name=%s, cleaning %s.",GetName(),name.Data()); + GetDetectorDataFolder()->Remove(obj); + delete obj; + } +} + +/*****************************************************************************/ + +Bool_t AliLoader::IsOptionWritable(const TString& opt) +{ + if (opt.CompareTo("recreate",TString::kIgnoreCase)) return kTRUE; + if (opt.CompareTo("new",TString::kIgnoreCase)) return kTRUE; + if (opt.CompareTo("create",TString::kIgnoreCase)) return kTRUE; + if (opt.CompareTo("update",TString::kIgnoreCase)) return kTRUE; + return kFALSE; +} +/*****************************************************************************/ + +void AliLoader::SetTAddrInDet() +{ + //calls SetTreeAddress for corresponding detector + AliRunLoader* rl = GetRunLoader(); + if (rl == 0x0) return; + AliRun* ar = rl->GetAliRun(); + if (ar == 0x0) return; + AliDetector* det = ar->GetDetector(fDetectorName); + if (det == 0x0) return; + det->SetTreeAddress(); +} +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ + diff --git a/STEER/AliLoader.h b/STEER/AliLoader.h new file mode 100644 index 00000000000..29a6dc5b054 --- /dev/null +++ b/STEER/AliLoader.h @@ -0,0 +1,314 @@ +#ifndef ALILOADER_H +#define ALILOADER_H + +#include +#include + +#include +#include "AliDataLoader.h" + +class TString; +class TFile; +class TTree; +class TTask; +class AliRunLoader; +class AliDigitizer; +class TDirectory; + + +//___________________________________________________________________ +///////////////////////////////////////////////////////////////////// +// // +// class AliLoader // +// // +// Base class for Loaders. // +// Loader provides base I/O fascilities for "standard" data. // +// Each detector has a laoder data member. // +// Loader is always accessible via folder structure as well // +// // +///////////////////////////////////////////////////////////////////// + +class AliLoader: public TNamed + { + public: + AliLoader(); + AliLoader(const Char_t *detname,const Char_t *eventfoldername); //contructor with name of the top folder of the tree + AliLoader(const Char_t *detname,TFolder* eventfolder); + + virtual ~AliLoader();//----------------- + + virtual Int_t GetEvent();//changes to root directory + //relies on the event number defined in gAlice + virtual Int_t SetEvent();//basically the same that GetEvent but do not post data to folders + virtual void MakeTree(Option_t* opt); + + //these methods are responsible for reading data + // 1. Opens the file (accordingly to gAlice->GetEvNumber()/Nevents per File + // 2. Changes to proper ROOT directory + // 3. Retrives data and posts to folders + //options: + // "" - readonly file + // "update" - update file + // "recreate" + AliDataLoader* GetHitsDataLoader() const {return (AliDataLoader*)fDataLoaders->At(kHits);} + AliDataLoader* GetSDigitsDataLoader() const {return (AliDataLoader*)fDataLoaders->At(kSDigits);} + AliDataLoader* GetDigitsDataLoader() const {return (AliDataLoader*)fDataLoaders->At(kDigits);} + AliDataLoader* GetRecPointsDataLoader()const {return (AliDataLoader*)fDataLoaders->At(kRecPoints);} + AliDataLoader* GetTracksDataLoader() const {return (AliDataLoader*)fDataLoaders->At(kTracks);} + AliDataLoader* GetRecParticlesDataLoader()const {return (AliDataLoader*)fDataLoaders->At(kRecParticles);} + + AliDataLoader* GetDataLoader(const char* name); + + + Int_t SetEventFolder(TFolder* eventfolder);//sets the event folder + Int_t Register(TFolder* eventFolder);//triggers creation of subfolders for a given detector + + TFolder* GetTopFolder(); //returns top aliroot folder + TFolder* GetEventFolder();//returns the folder that event is sitting + TFolder* GetDataFolder(); //returns the folder that hits, sdigits, etc are sitting (this contains folders named like detectors) + TFolder* GetDetectorDataFolder();//returns the folder that hits, sdigits, etc + //are sitting for a given detector (subfolder of Data Folder) + TFolder* GetModulesFolder(); + TFolder* GetTasksFolder(); + TFolder* GetQAFolder(); + + TTask* SDigitizer();//return detector SDigitizer() + AliDigitizer* Digitizer(); + TTask* Reconstructioner(); + TTask* Tracker(); + TTask* PIDTask(); + TTask* QAtask(const char* name = 0x0); + + TObject** SDigitizerRef(); + TObject** DigitizerRef(); + TObject** ReconstructionerRef(); + TObject** TrackerRef(); + TObject** PIDTaskRef(); + + virtual void MakeHitsContainer(){GetHitsDataLoader()->MakeTree();SetTAddrInDet();} + virtual void MakeSDigitsContainer(){GetSDigitsDataLoader()->MakeTree();SetTAddrInDet();} + virtual void MakeDigitsContainer(){GetDigitsDataLoader()->MakeTree();SetTAddrInDet();} + virtual void MakeRecPointsContainer(){GetRecPointsDataLoader()->MakeTree();} + virtual void MakeTracksContainer(){GetTracksDataLoader()->MakeTree();} + virtual void MakeRecParticlesContainer(){GetRecParticlesDataLoader()->MakeTree();} + + virtual void CleanFolders(); + virtual void CloseFiles(); + + virtual Int_t PostSDigitizer(TTask* sdzer);//adds it to Run SDigitizer + virtual Int_t PostDigitizer(AliDigitizer* task); + virtual Int_t PostReconstructioner(TTask* task); + virtual Int_t PostTracker(TTask* task); + virtual Int_t PostPIDTask(TTask* task); + + virtual Int_t WriteSDigitizer(Option_t* opt=""){return GetSDigitsDataLoader()->GetBaseTaskLoader()->WriteData(opt);} + virtual Int_t WriteDigitizer(Option_t* opt=""){return GetDigitsDataLoader()->GetBaseTaskLoader()->WriteData(opt);} + virtual Int_t WriteReconstructioner(Option_t* opt=""){return GetRecPointsDataLoader()->GetBaseTaskLoader()->WriteData(opt);} + virtual Int_t WriteTracker(Option_t* opt=""){return GetTracksDataLoader()->GetBaseTaskLoader()->WriteData(opt);} + virtual Int_t WritePIDTask(Option_t* opt=""){return GetRecParticlesDataLoader()->GetBaseTaskLoader()->WriteData(opt);} + + TTree* TreeH(){return GetHitsDataLoader()->Tree();} //returns the tree from folder; shortcut method + TTree* TreeS(){return GetSDigitsDataLoader()->Tree();} //returns the tree from folder; shortcut method + TTree* TreeD(){return GetDigitsDataLoader()->Tree();} //returns the tree from folder; shortcut method + TTree* TreeR(){return GetRecPointsDataLoader()->Tree();} //returns the tree from folder; shortcut method + TTree* TreeT(){return GetTracksDataLoader()->Tree();} //returns the tree from folder; shortcut method + TTree* TreeP(){return GetRecParticlesDataLoader()->Tree();} //returns the tree from folder; shortcut method + + Int_t LoadHits(Option_t* opt=""){return GetHitsDataLoader()->Load(opt);SetTAddrInDet();} + Int_t LoadSDigits(Option_t* opt=""){return GetSDigitsDataLoader()->Load(opt);SetTAddrInDet();} + Int_t LoadDigits(Option_t* opt=""){return GetDigitsDataLoader()->Load(opt);SetTAddrInDet();} + Int_t LoadRecPoints(Option_t* opt=""){return GetRecPointsDataLoader()->Load(opt);} + Int_t LoadTracks(Option_t* opt=""){return GetTracksDataLoader()->Load(opt);} + Int_t LoadRecParticles(Option_t* opt=""){return GetRecParticlesDataLoader()->Load(opt);} + + Int_t LoadSDigitizer(Option_t* opt=""){return GetSDigitsDataLoader()->GetBaseTaskLoader()->Load(opt);} + Int_t LoadDigitizer(Option_t* opt=""){return GetDigitsDataLoader()->GetBaseTaskLoader()->Load(opt);} + Int_t LoadReconstructioner(Option_t* opt=""){return GetRecPointsDataLoader()->GetBaseTaskLoader()->Load(opt);} + Int_t LoadTracker(Option_t* opt=""){return GetTracksDataLoader()->GetBaseTaskLoader()->Load(opt);} + Int_t LoadPIDTask(Option_t* opt=""){return GetRecParticlesDataLoader()->GetBaseTaskLoader()->Load(opt);} + + void UnloadHits(){GetHitsDataLoader()->Unload();} + void UnloadSDigits(){GetSDigitsDataLoader()->Unload();} + void UnloadDigits(){GetDigitsDataLoader()->Unload();} + void UnloadRecPoints(){GetRecPointsDataLoader()->Unload();} + void UnloadTracks(){GetTracksDataLoader()->Unload();} + void UnloadRecParticles(){GetRecParticlesDataLoader()->Unload();} + + virtual Int_t ReloadHits(){return GetHitsDataLoader()->Reload();} //unload and load again Hits + virtual Int_t ReloadSDigits(){return GetSDigitsDataLoader()->Reload();} //unload and load again + virtual Int_t ReloadDigits(){return GetDigitsDataLoader()->Reload();} //unload and load again + virtual Int_t ReloadRecPoints(){return GetRecPointsDataLoader()->Reload();} //unload and load again + virtual Int_t ReloadTracks(){return GetTracksDataLoader()->Reload();} //unload and load again + virtual Int_t ReloadRecParticles(){return GetRecParticlesDataLoader()->Reload();} //unload and load again + virtual Int_t ReloadAll(); //unload and load again everything that was loaded + + //these methods writes object from folder to proper file + virtual Int_t WriteHits(Option_t* opt=""); + virtual Int_t WriteSDigits(Option_t* opt=""); + virtual Int_t WriteDigits(Option_t* opt=""){return GetDigitsDataLoader()->WriteData(opt);} + virtual Int_t WriteRecPoints(Option_t* opt=""){return GetRecPointsDataLoader()->WriteData(opt);} + virtual Int_t WriteTracks(Option_t* opt=""){return GetTracksDataLoader()->WriteData(opt);} + virtual Int_t WriteRecParticles(Option_t* opt=""){return GetRecParticlesDataLoader()->WriteData(opt);} + + + //void SetTopFolder(TString& str){}; //Sets root top folder for the run + + void SetHitsFileName(const TString& fname){GetHitsDataLoader()->SetFileName(fname);} + void SetSDigitsFileName(const TString& fname){GetSDigitsDataLoader()->SetFileName(fname);} + void SetDigitsFileName(const TString& fname){GetDigitsDataLoader()->SetFileName(fname);} + void SetRecPointsFileName(const TString& fname){GetRecPointsDataLoader()->SetFileName(fname);} + void SetTracksFileName(const TString& fname){GetTracksDataLoader()->SetFileName(fname);} + void SetRecParticlesFileName(const TString& fname){GetRecParticlesDataLoader()->SetFileName(fname);} + + const TString& GetHitsFileName(){return GetHitsDataLoader()->GetFileName();} + const TString& GetSDigitsFileName(){return GetSDigitsDataLoader()->GetFileName();} + const TString& GetDigitsFileName(){return GetDigitsDataLoader()->GetFileName();} + const TString& GetRecPointsFileName(){return GetRecPointsDataLoader()->GetFileName();} + const TString& GetTracksFileName(){return GetTracksDataLoader()->GetFileName();} + const TString& GetRecParticlesFileName(){return GetRecParticlesDataLoader()->GetFileName();} + + virtual void CleanHits() {GetHitsDataLoader()->Clean();} //cleans hits from folder + virtual void CleanSDigits() {GetSDigitsDataLoader()->Clean();} //cleans digits from folder + virtual void CleanDigits() {GetDigitsDataLoader()->Clean();} //cleans sdigits from folder + virtual void CleanRecPoints(){GetRecPointsDataLoader()->Clean();} //cleans rec. points from folder + virtual void CleanTracks() {GetTracksDataLoader()->Clean();} //cleans tracks from folder + + virtual void CleanSDigitizer(); //cleans SDigitizer from folder + virtual void CleanDigitizer(); //cleans Digitizer from folder + virtual void CleanReconstructioner(); //cleans Reconstructions (clusterizer) from folder + virtual void CleanTracker(); //cleans tracker from folder + virtual void CleanPIDTask(); //cleans Reconstructions (clusterizer) from folder + + virtual void SetHitsFileOption(Option_t* newopt){GetHitsDataLoader()->SetFileOption(newopt);} //Sets Hits File Option in open + virtual void SetSDigitsFileOption(Option_t* newopt){GetSDigitsDataLoader()->SetFileOption(newopt);} //Sets S. Digits File Option in open + virtual void SetDigitsFileOption(Option_t* newopt){GetDigitsDataLoader()->SetFileOption(newopt);} //Sets Digits File Option in open + virtual void SetRecPointsFileOption(Option_t* newopt){GetRecPointsDataLoader()->SetFileOption(newopt);}//Sets Rec Ponoints File Option in open + virtual void SetTracksFileOption(Option_t* newopt){GetTracksDataLoader()->SetFileOption(newopt);} //Sets Tracks File Option in open + virtual void SetRecParticlesFileOption(Option_t* newopt){GetRecParticlesDataLoader()->SetFileOption(newopt);}//Sets Rec Ponoints File Option in open + + virtual void SetHitsComprLevel(Int_t cl){GetHitsDataLoader()->SetCompressionLevel(cl);} + virtual void SetDigitsComprLevel(Int_t cl){GetSDigitsDataLoader()->SetCompressionLevel(cl);} + virtual void SetSDigitsComprLevel(Int_t cl){GetDigitsDataLoader()->SetCompressionLevel(cl);} + virtual void SetRecPointsComprLevel(Int_t cl){GetRecPointsDataLoader()->SetCompressionLevel(cl);} + virtual void SetTracksComprLevel(Int_t cl){GetTracksDataLoader()->SetCompressionLevel(cl);} + virtual void SetRecParticlesComprLevel(Int_t cl){GetRecParticlesDataLoader()->SetCompressionLevel(cl);} + + virtual void SetCompressionLevel(Int_t cl);//Sets compression level in all the files + void SetDirName(TString& name);//sets the directory name for all the I/O environment + + const TString& GetDetectorName() const{return fDetectorName;}//returns the name of the detector + AliRunLoader* GetRunLoader();//gets the run-getter from event folder + + void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root", + //e.g. TPC.Digits.root -> TPC.DigitsMerged.root + //made on Jiri Chudoba demand + protected: + + /*********************************************/ + /************ PROTECTED **************/ + /********* M E T H O D S ***********/ + /*********************************************/ + enum EDataTypes{kHits = 0,kSDigits,kDigits,kRecPoints,kTracks,kRecParticles,kNDataTypes}; + + //Opens hits file and jumps to directory cooresponding to current event. + //If dir does not exists try to create it + //opt is passed to TFile::Open + //reads data from the file and posts them into folder + + + virtual Int_t PostHits(){return GetHitsDataLoader()->GetBaseLoader(0)->Load();} + virtual Int_t PostSDigits(){return GetSDigitsDataLoader()->GetBaseLoader(0)->Load();} + virtual Int_t PostDigits(){return GetDigitsDataLoader()->GetBaseLoader(0)->Load();} + virtual Int_t PostRecPoints(){return GetRecPointsDataLoader()->GetBaseLoader(0)->Load();} + virtual Int_t PostTracks(){return GetTracksDataLoader()->GetBaseLoader(0)->Load();} + virtual Int_t PostRecParticles(){return GetRecParticlesDataLoader()->GetBaseLoader(0)->Load();} + + void Clean();//calls clean for data loaders + void Clean(const TString& name);//removes and deletes object from data folder + + + TString GetUnixDir(); + TObject* GetDetectorData(const char* name){return GetDetectorDataFolder()->FindObject(name);} + TObject** GetDetectorDataRef(TObject* obj); + + void InitDefaults(); + void ResetDataInfo(); + + void SetTAddrInDet();//Call SetTreeAddress for corresponding detector + + /**********************************************/ + /************ PROTECTED ***************/ + /********* D A T A ************/ + /**********************************************/ + + // array with data loaders each corresponds to + // one data type (Hits, Digits, ...) + TObjArray* fDataLoaders; + + TString fDetectorName;//detector name that this loader belongs to + + TFolder* fEventFolder; //! Folder with data that changes from event to event, even in single run + TFolder* fDataFolder; //! Folder with data (hits, sdigits, etc, grouped in folders named like detectors + TFolder* fDetectorDataFolder;//!Folder that contains the detector data + TFolder* fModuleFolder; //!Folder that contains the modules + + TFolder* fTasksFolder; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner) + TFolder* fQAFolder; //!Folder that contains the QA objects + + // file option varible was introduced because if TFile is created with "recreate" + // stored option in TFile is "CREATE". We need to remeber "recreate" for + // Max events per file functionality + + static const TString fgkDefaultHitsContainerName;//default name of conatiner (TREE) for hits + static const TString fgkDefaultDigitsContainerName;//default name of conatiner (TREE) for digits + static const TString fgkDefaultSDigitsContainerName;//default name of conatiner (TREE) for Sdigits + static const TString fgkDefaultRecPointsContainerName;//default name of conatiner (TREE) for Rec Points + static const TString fgkDefaultTracksContainerName;//default name of conatiner (TREE) for Tracks + static const TString fgkDefaultRecParticlesContainerName;//default name of conatiner (TREE) for Reconstructed Particles + static const TString fgkLoaderBaseName;//base name of Loader: fDetectorName+fgkLoaderBaseName. i.e. PHOSLoader + + private: + //descendant classes should + //use protected interface methods to access these folders + + /**********************************************/ + /*********** P U B L I C **************/ + /********* S T A T I C ************/ + /********* METHODS ************/ + /********* They are used by ************/ + /*********** AliRunLoader as well**************/ + /**********************************************/ + public: + static TDirectory* ChangeDir(TFile* file, Int_t eventno); //changes the root directory in "file" to directory corresponing to eventno + static Bool_t TestFileOption(Option_t* opt);//checks is file is created from scratch + static Bool_t IsOptionWritable(const TString& opt); + + static Int_t GetDebug() {return fgDebug;} + static void SetDebug(Int_t deb = 1){fgDebug = deb;}//Sets debugging information + static Int_t fgDebug; //debug flag for loaders + + ClassDef(AliLoader,2) + }; +/******************************************************************/ +/************************ I N L I N E S ***************************/ +/******************************************************************/ + +inline TFolder* AliLoader::GetDetectorDataFolder() + { + //helper function which returns the folder of name "name" in data folder + if(!fDetectorDataFolder) + { + fDetectorDataFolder = dynamic_cast(GetDataFolder()->FindObject(fDetectorName.Data())); + if(!fDetectorDataFolder) + { + Fatal("GetDetectorDataFolder", + "Can not find folder %s in folder %s. Aborting", + fDetectorName.Data(),GetDataFolder()->GetName()); + return 0x0; + } + + } + return fDetectorDataFolder; + } + +#endif diff --git a/STEER/AliMCQA.cxx b/STEER/AliMCQA.cxx index 27f1a05a3c1..0d62808dd68 100644 --- a/STEER/AliMCQA.cxx +++ b/STEER/AliMCQA.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -176,30 +175,34 @@ void AliMCQA::Copy(AliMCQA &) const //_______________________________________________________________________ AliMCQA::~AliMCQA() -{ + { // // Destructor // gROOT->GetListOfBrowsables()->Remove(this); + //if program crashes here - it probobly means that + //one of added browsables was deleted and not removed previously from that list + //skowron + if (fQAList) { fQAList->Delete(); delete fQAList; - fQAList=0; + fQAList = 0; } if (fQAHist) { fQAHist->Delete(); delete fQAHist; - fQAHist=0; + fQAHist = 0; } if (fVolNames) { fVolNames->Delete(); delete fVolNames; - fVolNames=0; + fVolNames = 0; } if (fModNames) { fModNames->Delete(); delete fModNames; - fModNames=0; + fModNames = 0; } delete [] fDetDone; delete fMPaveLabel; diff --git a/STEER/AliMagF.h b/STEER/AliMagF.h index 1639d872475..5b53ee9c901 100644 --- a/STEER/AliMagF.h +++ b/STEER/AliMagF.h @@ -41,29 +41,6 @@ protected: //ZDC part ------------------------------------------------------------------- -// ************************ LHC optics v6.2 ***************************** -/*static const Float_t kG1=20.443; -static const Float_t kFDIP=-37.96; -static const Float_t kFCORN2=-9.14; -// -// ZBEG Beginning of the inner triplet -// D1BEG Beginning of separator dipole 1 -// D2BEG Beginning of separator dipole 2 -// CORBEG Corrector dipole beginning (because of dimuon arm) -// -static const Float_t kCORBEG2=1921.6,kCOREND2=kCORBEG2+170., kCOR2RA2=4.5*4.5; -// -static const Float_t kZBEG=2300.; -static const Float_t kZ1BEG=kZBEG+ 0.,kZ1END=kZ1BEG+630.,kZ1RA2=3.5*3.5; -static const Float_t kZ2BEG=kZBEG+ 880.,kZ2END=kZ2BEG+550.,kZ2RA2=3.5*3.5; -static const Float_t kZ3BEG=kZBEG+1530.,kZ3END=kZ3BEG+550.,kZ3RA2=3.5*3.5; -static const Float_t kZ4BEG=kZBEG+2430.,kZ4END=kZ4BEG+630.,kZ4RA2=3.5*3.5; -static const Float_t kD1BEG=5838.3 ,kD1END=kD1BEG+945.,kD1RA2=4.5*4.5; -static const Float_t kD2BEG=12147.6 ,kD2END=kD2BEG+945.,kD2RA2=4.5*4.5; -// -static const Float_t kXCEN1D2=-9.7 ,kYCEN1D2=0.; -static const Float_t kXCEN2D2=9.7 ,kYCEN2D2=0.;*/ - // ************************ LHC optics v6.4 ***************************** static const Float_t kG1=20.443; static const Float_t kFDIP=-37.85; diff --git a/STEER/AliMagFCM.cxx b/STEER/AliMagFCM.cxx index 56609ff3b95..b11a19e9514 100644 --- a/STEER/AliMagFCM.cxx +++ b/STEER/AliMagFCM.cxx @@ -21,6 +21,7 @@ // Author: //----------------------------------------------------------------------- #include "TSystem.h" + #include "TVector.h" #include "AliMagFCM.h" diff --git a/STEER/AliMagFMaps.cxx b/STEER/AliMagFMaps.cxx index 36efb43f784..97a9fa22a38 100644 --- a/STEER/AliMagFMaps.cxx +++ b/STEER/AliMagFMaps.cxx @@ -126,7 +126,6 @@ void AliMagFMaps::ReadField() fFieldMap[2] = dynamic_cast(file->Get("ExtB02")); file->Close(); delete file; - } else if (fMap == k4kG) { if (fL3Option) { fSolenoid = 4.; @@ -224,9 +223,9 @@ void AliMagFMaps::Field(Float_t *x, Float_t *b) return; } } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) { - map = fFieldMap[1]; + map = fFieldMap[1]; } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) { - map = fFieldMap[2]; + map = fFieldMap[2]; } if(map){ diff --git a/STEER/AliMagFMaps.h b/STEER/AliMagFMaps.h index 3ea263a2784..eafcd1e9277 100644 --- a/STEER/AliMagFMaps.h +++ b/STEER/AliMagFMaps.h @@ -47,10 +47,3 @@ protected: }; #endif - - - - - - - diff --git a/STEER/AliModule.cxx b/STEER/AliModule.cxx index bcbc0075de2..e99faa66525 100644 --- a/STEER/AliModule.cxx +++ b/STEER/AliModule.cxx @@ -32,6 +32,7 @@ //End_Html // // /////////////////////////////////////////////////////////////////////////////// + #include #include #include @@ -39,10 +40,11 @@ #include #include +#include "AliConfig.h" +#include "AliLoader.h" +#include "AliMagF.h" #include "AliModule.h" #include "AliRun.h" -#include "AliMagF.h" -#include "AliConfig.h" #include "AliTrackReference.h" ClassImp(AliModule) @@ -101,16 +103,15 @@ AliModule::AliModule(const char* name,const char *title): } // // Add this Module to the list of Modules - gAlice->Modules()->Add(this); - // - // + + gAlice->AddModule(this); + SetMarkerColor(3); // // Clear space for tracking media and material indexes for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0; - AliConfig::Instance()->Add(this); SetDebug(gAlice->GetDebug()); } @@ -175,6 +176,7 @@ AliModule::~AliModule() // Delete TArray objects delete fIdtmed; delete fIdmate; + } //_______________________________________________________________________ @@ -688,10 +690,15 @@ AliTrackReference* AliModule::FirstTrackReference(Int_t track) // while if track<0 the first hit of the current // track is returned // - if(track>=0) { - gAlice->ResetTrackReferences(); - gAlice->TreeTR()->GetEvent(track); - } + if(track>=0) + { + AliRunLoader* rl = AliRunLoader::GetRunLoader(); + + rl->GetAliRun()->ResetTrackReferences(); + rl->TreeTR()->GetEvent(track); + if (rl == 0x0) + Fatal("FirstTrackReference","AliRunLoader not initialized. Can not proceed"); + } // fMaxIterTrackRef = fTrackReferences->GetEntriesFast(); fCurrentIterTrackRef = 0; @@ -711,7 +718,7 @@ AliTrackReference* AliModule::NextTrackReference() else return 0; } else { - printf("* AliDetector::NextTrackReference * TrackReference Iterator called without calling FistTrackReference before\n"); + printf("* AliModule::NextTrackReference * TrackReference Iterator called without calling FistTrackReference before\n"); return 0; } } @@ -727,24 +734,43 @@ void AliModule::ResetTrackReferences() if (fTrackReferences) fTrackReferences->Clear(); } +//_____________________________________________________________________________ + +AliLoader* AliModule::MakeLoader(const char* topfoldername) + { + return 0x0; + }//skowron +//PH Merged with v3-09-08 | +// V +//_____________________________________________________________________________ void AliModule::SetTreeAddress() { // - // Set branch address for the Hits and Digits Trees + // Set branch address for track reference Tree // - TBranch *branch; - char branchname[20]; - sprintf(branchname,"%s",GetName()); - // Branch address for track reference tree - TTree *treeTR = gAlice->TreeTR(); - if (treeTR && fTrackReferences) { - branch = treeTR->GetBranch(branchname); - if (branch) branch->SetAddress(&fTrackReferences); - } + + TBranch *branch; + + // Branch address for track reference tree + TTree *treeTR = TreeTR(); + + if (treeTR && fTrackReferences) { + branch = treeTR->GetBranch(GetName()); + if (branch) + { + if(GetDebug()) Info("SetTreeAddress","(%s) Setting for TrackRefs",GetName()); + branch->SetAddress(&fTrackReferences); + } + else + { + Warning("SetTreeAddress","(%s) Failed for Track References. Can not find branch in tree.",GetName()); + } + } } +//_____________________________________________________________________________ void AliModule::AddTrackReference(Int_t label){ // // add a trackrefernce to the list @@ -758,36 +784,44 @@ void AliModule::AddTrackReference(Int_t label){ } -void AliModule::MakeBranchTR(Option_t *option, const char *file) +//_____________________________________________________________________________ +void AliModule::MakeBranchTR(Option_t *option) { // // Makes branch in treeTR // - char name[10]; - sprintf(name,"%s",GetName()); - - if (GetDebug()>1) - printf("* MakeBranch * Making Branch %s \n",name); - - TDirectory *cwd = gDirectory; - TBranch *branch = 0; - TTree* tree = gAlice->TreeTR(); - if (tree) { - branch = tree->Branch(name, &fTrackReferences, 1600); - if (file) { - char * outFile = new char[strlen(gAlice->GetBaseFile())+strlen(file)+2]; - sprintf(outFile,"%s/%s",gAlice->GetBaseFile(),file); - branch->SetFile(outFile); - TIter next( branch->GetListOfBranches()); - while ((branch=dynamic_cast(next()))) { - branch->SetFile(outFile); - } - delete outFile; - - cwd->cd(); - - if (GetDebug()>1) - printf("* MakeBranch * Diverting Branch %s to file %s\n",name,file); - } + if(GetDebug()) Info("MakeBranchTR","Making Track Refs. Branch for %s",GetName()); + TTree * tree = TreeTR(); + if (fTrackReferences && tree) + { + TBranch *branch = tree->GetBranch(GetName()); + if (branch) + { + if(GetDebug()) Info("MakeBranch","Branch %s is already in tree.",GetName()); + return; + } + + branch = tree->Branch(GetName(),&fTrackReferences); + } + else + { + if(GetDebug()) + Info("MakeBranchTR","FAILED for %s: tree=%#x fTrackReferences=%#x", + GetName(),tree,fTrackReferences); } } + +//_____________________________________________________________________________ +TTree* AliModule::TreeTR() +{ + AliRunLoader* rl = AliRunLoader::GetRunLoader(); + + if ( rl == 0x0) + { + Error("TreeTR","Can not get the run loader"); + return 0x0; + } + + TTree* tree = rl->TreeTR(); + return tree; +} diff --git a/STEER/AliModule.h b/STEER/AliModule.h index 1e43c3629c4..ce7efac4296 100644 --- a/STEER/AliModule.h +++ b/STEER/AliModule.h @@ -17,8 +17,11 @@ class TClonesArray; class TBrowser; class TArrayI; class TFile; +class TTree; +class AliLoader; class AliTrackReference; + class AliModule : public TNamed , public TAttLine, public TAttMarker, public AliRndm { public: @@ -52,24 +55,25 @@ public: Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t *buf=0, Int_t nwbuf=0) const; virtual void AliGetMaterial(Int_t imat, char* name, Float_t &a, - Float_t &z, Float_t &dens, Float_t &radl, - Float_t &absl) const; + Float_t &z, Float_t &dens, Float_t &radl, + Float_t &absl) const; virtual void AliMixture(Int_t imat, const char *name, Float_t *a, - Float_t *z, Float_t dens, Int_t nlmat, - Float_t *wmat) const; + Float_t *z, Float_t dens, Int_t nlmat, + Float_t *wmat) const; virtual void AliMedium(Int_t numed, const char *name, Int_t nmat, - Int_t isvol, Int_t ifield, Float_t fieldm, - Float_t tmaxfd, Float_t stemax, Float_t deemax, - Float_t epsil, Float_t stmin, Float_t *ubuf=0, - Int_t nbuf=0) const; + Int_t isvol, Int_t ifield, Float_t fieldm, + Float_t tmaxfd, Float_t stemax, Float_t deemax, + Float_t epsil, Float_t stmin, Float_t *ubuf=0, + Int_t nbuf=0) const; virtual void AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1, - Float_t theta2, Float_t phi2, Float_t theta3, - Float_t phi3) const; + Float_t theta2, Float_t phi2, Float_t theta3, + Float_t phi3) const; // Virtual methods virtual void BuildGeometry() {}; virtual Int_t IsVersion() const =0; - + + // Other methods virtual void AddDigit(Int_t*, Int_t*){ Error("AddDigit","Digits cannot be added to module %s\n",fName.Data());} @@ -91,10 +95,18 @@ public: virtual void FinishEvent() {} virtual void FinishRun() {} virtual void FinishPrimary() {} - //virtual void Hits2Digits() {} virtual void Init() {} virtual void LoadPoints(Int_t ) {} - virtual void MakeBranch(Option_t *, const char* =0 ) {} + + + + virtual void MakeBranch(Option_t * opt =" ") {} + virtual void MakeTree(Option_t *) {}//skowron + + virtual AliLoader* MakeLoader(const char* topfoldername);//skowron + virtual AliLoader* GetLoader() const {return 0x0;} //skowron + + virtual void Paint(Option_t *) {} virtual void ResetDigits() {} virtual void ResetSDigits() {} @@ -110,17 +122,18 @@ public: virtual Float_t ZMin() const; virtual Float_t ZMax() const; virtual void SetEuclidFile(char *material,char *geometry=0); - virtual void ReadEuclid(const char *filnam, char *topvol); - virtual void ReadEuclidMedia(const char *filnam); + virtual void ReadEuclid(const char *filnam, char *topvol); + virtual void ReadEuclidMedia(const char *filnam); // Track reference related TClonesArray *TrackReferences() const {return fTrackReferences;} virtual void RemapTrackHitIDs(Int_t *) {} virtual void RemapTrackReferencesIDs(Int_t *map); //remaping track references MI virtual void ResetTrackReferences(); - virtual void AddTrackReference(Int_t label); + virtual void AddTrackReference(Int_t label); virtual AliTrackReference * FirstTrackReference(Int_t track); virtual AliTrackReference * NextTrackReference(); - virtual void MakeBranchTR(Option_t *option, const char *file); + virtual void MakeBranchTR(Option_t *opt=" "); + TTree* TreeTR(); //shorcut method for accessing treeTR from folder // AliModule& operator=(const AliModule &mod) @@ -147,6 +160,6 @@ protected: TClonesArray *fTrackReferences; //!list of track references - for one primary track only -MI Int_t fMaxIterTrackRef; //!for track refernce iterator routines Int_t fCurrentIterTrackRef; //!for track refernce iterator routines - ClassDef(AliModule,3) //Base class for ALICE Modules + ClassDef(AliModule,4) //Base class for ALICE Modules }; #endif diff --git a/STEER/AliRndm.cxx b/STEER/AliRndm.cxx index 5be1bb3d886..facdc8ee62d 100644 --- a/STEER/AliRndm.cxx +++ b/STEER/AliRndm.cxx @@ -17,7 +17,6 @@ /////////////////////////////////////////////////////////////////////////////// // // -// Wrapper for the root random number generator // // // /////////////////////////////////////////////////////////////////////////////// @@ -78,13 +77,13 @@ void AliRndm::ReadRandom(const char *filename) // Reads saved random generator status from filename // char *fntmp = gSystem->ExpandPathName(filename); - TFile *file = new TFile(fntmp,"read"); + TFile *file = new TFile(fntmp,"r"); delete [] fntmp; if(!file) { printf("AliRndm:: Could not open file %s\n",filename); } else { if(!fRandom) fRandom = new TRandom(); - fRandom->Read(fRandom->GetName()); + fRandom->Read("Random"); file->Close(); delete file; } @@ -97,7 +96,7 @@ void AliRndm::WriteRandom(const char *filename) const // Writes random generator status to filename // char *fntmp = gSystem->ExpandPathName(filename); - TFile *file = new TFile(fntmp,"update"); + TFile *file = new TFile(fntmp,"new"); delete [] fntmp; if(!file) { printf("AliRndm:: Could not open file %s\n",filename); diff --git a/STEER/AliRndm.h b/STEER/AliRndm.h index f6ee3c840df..8049843ae75 100644 --- a/STEER/AliRndm.h +++ b/STEER/AliRndm.h @@ -17,7 +17,7 @@ class AliRndm { public: AliRndm(); - AliRndm(const AliRndm &rnd); + AliRndm(const AliRndm &); virtual ~AliRndm() {fRandom=0;} AliRndm & operator=(const AliRndm& rn) {rn.Copy(*this); return (*this);} diff --git a/STEER/AliRun.cxx b/STEER/AliRun.cxx index 9a88b014bd3..2f4444da7c1 100644 --- a/STEER/AliRun.cxx +++ b/STEER/AliRun.cxx @@ -40,37 +40,45 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include #include #include #include -#include "Riostream.h" -#include "TBRIK.h" -#include "TBrowser.h" -#include "TCint.h" -#include "TFile.h" -#include "TFolder.h" -#include "TGeometry.h" -#include "TNode.h" -#include "TParticle.h" -#include "TRandom3.h" -#include "TROOT.h" -#include "TSystem.h" -#include "TTree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "AliConfig.h" #include "AliDetector.h" #include "AliDisplay.h" +#include "AliGenEventHeader.h" #include "AliGenerator.h" #include "AliHeader.h" +#include "AliHit.h" #include "AliLego.h" #include "AliLegoGenerator.h" +#include "AliLoader.h" #include "AliMCQA.h" #include "AliMagFC.h" #include "AliMagFCM.h" #include "AliMagFDM.h" #include "AliPDG.h" #include "AliRun.h" +#include "AliRunLoader.h" #include "AliStack.h" AliRun *gAlice; @@ -84,13 +92,6 @@ AliRun::AliRun(): fEventNrInRun(0), fEventsPerRun(0), fDebug(0), - fHeader(0), - fTreeD(0), - fTreeS(0), - fTreeH(0), - fTreeTR(0), - fTreeE(0), - fTreeR(0), fModules(0), fGeometry(0), fDisplay(0), @@ -113,18 +114,13 @@ AliRun::AliRun(): fRandom(0), fMCQA(0), fTransParName("\0"), - fBaseFileName("\0"), - fStack(0), - fTreeDFileName(""), - fTreeDFile(0), - fTreeSFileName(""), - fTreeSFile(0), - fTreeRFileName(""), - fTreeRFile(0) + fRunLoader(0x0) { // // Default constructor for AliRun // + AliConfig::Instance();//skowron 29 Feb 2002 + //ensures that the folder structure is build } //_______________________________________________________________________ @@ -135,13 +131,6 @@ AliRun::AliRun(const AliRun& arun): fEventNrInRun(0), fEventsPerRun(0), fDebug(0), - fHeader(0), - fTreeD(0), - fTreeS(0), - fTreeH(0), - fTreeTR(0), - fTreeE(0), - fTreeR(0), fModules(0), fGeometry(0), fDisplay(0), @@ -164,14 +153,7 @@ AliRun::AliRun(const AliRun& arun): fRandom(0), fMCQA(0), fTransParName("\0"), - fBaseFileName("\0"), - fStack(0), - fTreeDFileName(""), - fTreeDFile(0), - fTreeSFileName(""), - fTreeSFile(0), - fTreeRFileName(""), - fTreeRFile(0) + fRunLoader(0x0) { // // Copy constructor for AliRun @@ -187,13 +169,6 @@ AliRun::AliRun(const char *name, const char *title): fEventNrInRun(0), fEventsPerRun(0), fDebug(0), - fHeader(new AliHeader()), - fTreeD(0), - fTreeS(0), - fTreeH(0), - fTreeTR(0), - fTreeE(0), - fTreeR(0), fModules(new TObjArray(77)), // Support list for the Detectors fGeometry(0), fDisplay(0), @@ -216,14 +191,7 @@ AliRun::AliRun(const char *name, const char *title): fRandom(new TRandom3()), fMCQA(0), fTransParName("\0"), - fBaseFileName("\0"), - fStack(new AliStack(10000)), //Particle stack - fTreeDFileName(""), - fTreeDFile(0), - fTreeSFileName(""), - fTreeSFile(0), - fTreeRFileName(""), - fTreeRFile(0) + fRunLoader(0x0) { // // Constructor for the main processor. @@ -243,7 +211,6 @@ AliRun::AliRun(const char *name, const char *title): // Add to list of browsable gROOT->GetListOfBrowsables()->Add(this,name); - // Create the TNode geometry for the event display BuildSimpleGeometry(); @@ -267,8 +234,20 @@ AliRun::~AliRun() // // Default AliRun destructor // - TFile *curfil =0; - if(fTreeE)curfil=fTreeE->GetCurrentFile(); + gROOT->GetListOfBrowsables()->Remove(this); + + if (fRunLoader) + { + TFolder* evfold = fRunLoader->GetEventFolder(); + TFolder* modfold = dynamic_cast(evfold->FindObjectAny(AliConfig::GetModulesFolderName())); + TIter next(fModules); + AliModule *mod; + while((mod = (AliModule*)next())) + { + modfold->Remove(mod); + } + } + delete fImedia; delete fField; // delete fMC; @@ -277,53 +256,19 @@ AliRun::~AliRun() delete fDisplay; delete fGenerator; delete fLego; - delete fTreeD; - delete fTreeH; - delete fTreeTR; - delete fTreeE; - delete fTreeR; - delete fTreeS; if (fModules) { fModules->Delete(); delete fModules; } - delete fStack; + delete fHitLists; delete fPDGDB; delete fMCQA; - delete fHeader; - // avoid to delete TFile objects not owned by this object - // avoid multiple deletions - if(curfil == fTreeDFile) fTreeDFile=0; - if(curfil == fTreeSFile) fTreeSFile=0; - if(curfil == fTreeRFile) fTreeRFile=0; - if(fTreeSFile == fTreeDFile) fTreeSFile=0; - if(fTreeRFile == fTreeDFile) fTreeRFile=0; - if(fTreeRFile == fTreeSFile) fTreeRFile=0; - if(fTreeDFile){ - if(fTreeDFile->IsOpen())fTreeDFile->Close(); - delete fTreeDFile; - } - if(fTreeSFile){ - if(fTreeSFile->IsOpen())fTreeSFile->Close(); - delete fTreeSFile; - } - if(fTreeRFile){ - if(fTreeRFile->IsOpen())fTreeRFile->Close(); - delete fTreeRFile; - } - if (gROOT->GetListOfBrowsables()) - gROOT->GetListOfBrowsables()->Remove(this); - - gAlice=0; } //_______________________________________________________________________ void AliRun::Copy(AliRun &) const { - // - // Copy method ... not implemented - // Fatal("Copy","Not implemented!\n"); } @@ -355,22 +300,7 @@ void AliRun::Browse(TBrowser *b) // of the Root browser. // It displays the Root Trees and all detectors. // - if(!fStack) fStack=fHeader->Stack(); - TTree* pTreeK = fStack->TreeK(); - - if (pTreeK) b->Add(pTreeK,pTreeK->GetName()); - if (fTreeH) b->Add(fTreeH,fTreeH->GetName()); - if (fTreeTR) b->Add(fTreeTR,fTreeH->GetName()); - if (fTreeD) b->Add(fTreeD,fTreeD->GetName()); - if (fTreeE) b->Add(fTreeE,fTreeE->GetName()); - if (fTreeR) b->Add(fTreeR,fTreeR->GetName()); - if (fTreeS) b->Add(fTreeS,fTreeS->GetName()); - - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - b->Add(detector,detector->GetName()); - } + //detectors are in folders anyway b->Add(fMCQA,"AliMCQA"); } @@ -404,11 +334,7 @@ void AliRun::CleanDetectors() // // Clean Detectors at the end of event // - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->FinishEvent(); - } + fRunLoader->CleanDetectors(); } //_______________________________________________________________________ @@ -427,7 +353,8 @@ void AliRun::DumpPart (Int_t i) const // // Dumps particle i in the stack // - fStack->DumpPart(i); + if (fRunLoader->Stack()) + fRunLoader->Stack()->DumpPart(i); } //_______________________________________________________________________ @@ -436,7 +363,8 @@ void AliRun::DumpPStack () const // // Dumps the particle stack // - fStack->DumpPStack(); + if (fRunLoader->Stack()) + fRunLoader->Stack()->DumpPStack(); } //_______________________________________________________________________ @@ -473,62 +401,69 @@ void AliRun::SetField(Int_t type, Int_t version, Float_t scale, Warning("SetField","Invalid map %d\n",version); } } - -//_______________________________________________________________________ + +//_____________________________________________________________________________ + +void AliRun::InitLoaders() +{ + //creates list of getters + if (GetDebug()) Info("InitLoaders",""); + TIter next(fModules); + AliModule *mod; + while((mod = (AliModule*)next())) + { + AliDetector *det = dynamic_cast(mod); + if (det) + { + if (GetDebug()) Info("InitLoaders"," Adding %s ",det->GetName()); + fRunLoader->AddLoader(det); + } + } + if (GetDebug()) Info("InitLoaders","Done"); +} +//_____________________________________________________________________________ + void AliRun::FinishRun() { // // Called at the end of the run. // - - // - if(fLego) fLego->FinishRun(); + + + if(fLego) + { + if (GetDebug()) Info("FinishRun"," Finish Lego"); + fRunLoader->CdGAFile(); + fLego->FinishRun(); + } // Clean detector information TIter next(fModules); AliModule *detector; while((detector = dynamic_cast(next()))) { + if (GetDebug()) Info("FinishRun"," %s->FinishRun()",detector->GetName()); detector->FinishRun(); } //Output energy summary tables + if (GetDebug()) Info("FinishRun"," EnergySummary()"); EnergySummary(); - - TFile *file = fTreeE->GetCurrentFile(); - - file->cd(); - - fTreeE->Write(0,TObject::kOverwrite); - // Write AliRun info and all detectors parameters - Write(0,TObject::kOverwrite); + if (GetDebug()) Info("FinishRun"," fRunLoader->WriteHeader(OVERWRITE)"); + fRunLoader->WriteHeader("OVERWRITE"); + // Write AliRun info and all detectors parameters + fRunLoader->CdGAFile(); + Write(0,TObject::kOverwrite);//write AliRun + fRunLoader->Write(0,TObject::kOverwrite);//write RunLoader itself + // Clean tree information + if (GetDebug()) Info("FinishRun"," fRunLoader->Stack()->FinishRun()"); + fRunLoader->Stack()->FinishRun(); - fStack->FinishRun(); - - if (fTreeH) { - delete fTreeH; fTreeH = 0; - } - if (fTreeTR) { - delete fTreeTR; fTreeTR = 0; - } - if (fTreeD) { - delete fTreeD; fTreeD = 0; - } - if (fTreeR) { - delete fTreeR; fTreeR = 0; - } -// if (fTreeE) { -// delete fTreeE; fTreeE = 0; -// } - if (fTreeS) { - delete fTreeS; fTreeS = 0; - } + // Clean detector information + if (GetDebug()) Info("FinishRun"," fGenerator->FinishRun()"); fGenerator->FinishRun(); - - // Close output file - file->Write(); } //_______________________________________________________________________ @@ -536,7 +471,7 @@ void AliRun::FlagTrack(Int_t track) { // Delegate to stack // - fStack->FlagTrack(track); + fRunLoader->Stack()->FlagTrack(track); } //_______________________________________________________________________ @@ -551,7 +486,7 @@ void AliRun::EnergySummary() Float_t ed, ed2; Int_t kn, i, left, j, id; const Float_t kzero=0; - Int_t ievent=fHeader->GetEvent()+1; + Int_t ievent=fRunLoader->GetHeader()->GetEvent()+1; // // Energy loss information if(ievent) { @@ -616,7 +551,7 @@ void AliRun::Announce() const printf("%6s","*");printf("%64s","*\n"); printf("%6s","*"); - printf(" You are running AliRoot version v3-09-07\n"); + printf(" You are running AliRoot version NewIO\n"); printf("%6s","*"); printf(" The cvs tag for the current program is $Name$\n"); @@ -659,152 +594,43 @@ Int_t AliRun::GetModuleID(const char *name) const //_______________________________________________________________________ Int_t AliRun::GetEvent(Int_t event) { - // - // Connect the Trees Kinematics and Hits for event # event - // Set branch addresses - // - - // Reset existing structures +// +// Reloads data containers in folders # event +// Set branch addresses +// + if (fRunLoader == 0x0) + { + Error("GetEvent","RunLoader is not set. Can not load data."); + return -1; + } +/*****************************************/ +/**** P R E R E L O A D I N G ****/ +/*****************************************/ +// Reset existing structures ResetHits(); ResetTrackReferences(); ResetDigits(); ResetSDigits(); - - // Delete Trees already connected - if (fTreeH) { delete fTreeH; fTreeH = 0;} - if (fTreeTR) { delete fTreeTR; fTreeTR = 0;} - if (fTreeD) { delete fTreeD; fTreeD = 0;} - if (fTreeR) { delete fTreeR; fTreeR = 0;} - if (fTreeS) { delete fTreeS; fTreeS = 0;} - - // Create the particle stack - if (fHeader) delete fHeader; - fHeader = 0; - - // Get header from file - if(fTreeE) { - fTreeE->SetBranchAddress("Header", &fHeader); - - if (!fTreeE->GetEntry(event)) { - Error("GetEvent","Cannot find event:%d\n",event); - return -1; - } - } - else { - Error("GetEvent","Cannot find Header Tree (TE)\n"); - return -1; - } - - // Get the stack from the header, set fStack to 0 if it - // fails to get event - // - TFile *file = fTreeE->GetCurrentFile(); - char treeName[20]; - - file->cd(); - - if (fStack) delete fStack; - fStack = fHeader->Stack(); - if (fStack) { - if (!fStack->GetEvent(event)) fStack = 0; - } - // Get Hits Tree header from file - sprintf(treeName,"TreeH%d",event); - fTreeH = dynamic_cast(gDirectory->Get(treeName)); - if (!fTreeH) { - Warning("GetEvent","cannot find Hits Tree for event:%d\n",event); - } - - // Get TracReferences Tree header from file - sprintf(treeName,"TreeTR%d",event); - fTreeTR = dynamic_cast(gDirectory->Get(treeName)); - if (!fTreeTR) { - Warning("GetEvent","cannot find TrackReferences Tree for event:%d\n",event); - } +/*****************************************/ +/**** R E L O A D ****/ +/*****************************************/ - // get current file name and compare with names containing trees S,D,R - TString curfilname=static_cast(fTreeE->GetCurrentFile()->GetName()); - if(fTreeDFileName==curfilname)fTreeDFileName=""; - if(fTreeSFileName==curfilname)fTreeSFileName=""; - if(fTreeRFileName==curfilname)fTreeRFileName=""; + fRunLoader->GetEvent(event); - // Get Digits Tree header from file - sprintf(treeName,"TreeD%d",event); - - if (!fTreeDFile && fTreeDFileName != "") { - InitTreeFile("D",fTreeDFileName); - } - if (fTreeDFile) { - fTreeD = dynamic_cast(fTreeDFile->Get(treeName)); - } else { - fTreeD = dynamic_cast(file->Get(treeName)); - } - if (!fTreeD) { - // Warning("GetEvent","cannot find Digits Tree for event:%d\n",event); - } - if(fTreeDFileName != ""){ - if(fTreeDFileName==fTreeSFileName) { - fTreeSFileName = ""; - fTreeSFile = fTreeDFile; - } - if(fTreeDFileName==fTreeRFileName) { - fTreeRFileName = ""; - fTreeRFile = fTreeDFile; - } - } +/*****************************************/ +/**** P O S T R E L O A D I N G ****/ +/*****************************************/ - file->cd(); - - // Get SDigits Tree header from file - sprintf(treeName,"TreeS%d",event); - if (!fTreeSFile && fTreeSFileName != "") { - InitTreeFile("S",fTreeSFileName); - } - if (fTreeSFile) { - fTreeS = dynamic_cast(fTreeSFile->Get(treeName)); - } else { - fTreeS = dynamic_cast(gDirectory->Get(treeName)); - } - if (!fTreeS) { - // Warning("GetEvent","cannot find SDigits Tree for event:%d\n",event); - } - - if(fTreeSFileName != ""){ - if(fTreeSFileName==fTreeRFileName){ - fTreeRFileName = ""; - fTreeRFile = fTreeSFile; - } - } - - file->cd(); - - // Get Reconstruct Tree header from file - sprintf(treeName,"TreeR%d",event); - if (!fTreeRFile && fTreeRFileName != "") { - InitTreeFile("R",fTreeRFileName); - } - if(fTreeRFile) { - fTreeR = dynamic_cast(fTreeRFile->Get(treeName)); - } else { - fTreeR = dynamic_cast(gDirectory->Get(treeName)); - } - if (!fTreeR) { - // printf("WARNING: cannot find Reconstructed Tree for event:%d\n",event); - } - - file->cd(); - // Set Trees branch addresses TIter next(fModules); AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->SetTreeAddress(); - } - - fEvent=event; //MI change - - return fHeader->GetNtrack(); + while((detector = dynamic_cast(next()))) + { + detector->SetTreeAddress(); + } + + return fRunLoader->GetHeader()->GetNtrack(); } //_______________________________________________________________________ @@ -842,7 +668,7 @@ Int_t AliRun::GetPrimary(Int_t track) const // // return number of primary that has generated track // - return fStack->GetPrimary(track); + return fRunLoader->Stack()->GetPrimary(track); } //_______________________________________________________________________ @@ -852,6 +678,7 @@ void AliRun::MediaTable() // Built media table to get from the media number to // the detector id // + Int_t kz, nz, idt, lz, i, k, ind; // Int_t ibeg; TObjArray &dets = *gAlice->Detectors(); @@ -1051,110 +878,92 @@ void AliRun::ReadTransPar() } } } +//_____________________________________________________________________________ - -//_______________________________________________________________________ -void AliRun::MakeTree(Option_t *option, const char *file) +void AliRun::BeginEvent() { // - // Create the ROOT trees - // Loop on all detectors to create the Root branch (if any) - // - - char hname[30]; - // - // Analyse options - const char *oK = strstr(option,"K"); - const char *oH = strstr(option,"H"); - const char *oTR = strstr(option,"T"); - const char *oE = strstr(option,"E"); - const char *oD = strstr(option,"D"); - const char *oR = strstr(option,"R"); - const char *oS = strstr(option,"S"); - // - - TDirectory *cwd = gDirectory; + // Clean-up previous event + // Energy scores + if (GetDebug()) + { + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent"," BEGINNING EVENT "); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } + + /*******************************/ + /* Clean after eventual */ + /* previous event */ + /*******************************/ - TBranch *branch = 0; - if (oK) fStack->MakeTree(fEvent, file); - - if (oE && !fTreeE) { - fTreeE = new TTree("TE","Header"); - // branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0); - branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0); - branch->SetAutoDelete(kFALSE); - TFolder *folder = dynamic_cast(gROOT->FindObjectAny("/Folders/RunMC/Event/Header")); - if (folder) folder->Add(fHeader); -// branch = fTreeE->Branch("Stack","AliStack", &fStack, 4000, 0); -// branch->SetAutoDelete(kFALSE); -// if (folder) folder->Add(fStack); - fTreeE->Write(0,TObject::kOverwrite); - } - - if (file && branch) { - char * outFile = new char[strlen(gAlice->GetBaseFile())+strlen(file)+2]; - sprintf(outFile,"%s/%s",GetBaseFile(),file); - branch->SetFile(outFile); - TIter next( branch->GetListOfBranches()); - while ((branch=dynamic_cast(next()))) { - branch->SetFile(outFile); - } - if (GetDebug()>1) - printf("* MakeBranch * Diverting Branch %s to file %s\n", branch->GetName(),file); - cwd->cd(); - delete outFile; - } + //Set the next event in Run Loader -> Cleans trees (TreeK and all trees in detectors), + fRunLoader->SetEventNumber(++fEventNrInRun);// sets new files, cleans the previous event stuff, if necessary, etc., + if (GetDebug()) Info("BeginEvent","EventNr is %d",fEventNrInRun); + + fEventEnergy.Reset(); + // Clean detector information - if (oH && !fTreeH) { - sprintf(hname,"TreeH%d",fEvent); - fTreeH = new TTree(hname,"Hits"); - fTreeH->SetAutoSave(1000000000); //no autosave - fTreeH->Write(0,TObject::kOverwrite); - } + if (fRunLoader->Stack()) + fRunLoader->Stack()->Reset();//clean stack -> tree is unloaded + else + fRunLoader->MakeStack();//or make a new one + + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(K)"); + fRunLoader->MakeTree("K"); + if (GetDebug()) Info("BeginEvent"," gMC->SetStack(fRunLoader->Stack())"); + gMC->SetStack(fRunLoader->Stack());//Was in InitMC - but was moved here + //because we don't have guarantee that + //stack pointer is not going to change from event to event + //since it bellobgs to header and is obtained via RunLoader + // + // Reset all Detectors & kinematics & make/reset trees + // + + fRunLoader->GetHeader()->Reset(fRun,fEvent,fEventNrInRun); +// fRunLoader->WriteKinematics("OVERWRITE"); is there any reason to rewrite here since MakeTree does so - if (oTR && !fTreeTR) { - sprintf(hname,"TreeTR%d",fEvent); - fTreeTR = new TTree(hname,"TrackReferences"); - fTreeTR->SetAutoSave(1000000000); //no autosave - fTreeTR->Write(0,TObject::kOverwrite); - } + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTrackRefsContainer()"); + fRunLoader->MakeTrackRefsContainer();//for insurance - if (oD && !fTreeD) { - sprintf(hname,"TreeD%d",fEvent); - fTreeD = new TTree(hname,"Digits"); - fTreeD->Write(0,TObject::kOverwrite); - } - if (oS && !fTreeS) { - sprintf(hname,"TreeS%d",fEvent); - fTreeS = new TTree(hname,"SDigits"); - fTreeS->Write(0,TObject::kOverwrite); - } - if (oR && !fTreeR) { - sprintf(hname,"TreeR%d",fEvent); - fTreeR = new TTree(hname,"Reconstruction"); - fTreeR->Write(0,TObject::kOverwrite); - } + if (GetDebug()) Info("BeginEvent"," ResetHits()"); + ResetHits(); + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(H)"); + fRunLoader->MakeTree("H"); // - // Create a branch for hits/digits for each detector - // Each branch is a TClonesArray. Each data member of the Hits classes - // will be in turn a subbranch of the detector master branch + if(fLego) + { + fLego->BeginEvent(); + return; + } + + //create new branches and SetAdresses TIter next(fModules); AliModule *detector; - while((detector = dynamic_cast(next()))) { - if (oH) detector->MakeBranch(option,file); - if (oTR) detector->MakeBranchTR(option,file); - } + while((detector = (AliModule*)next())) + { + if (GetDebug()) Info("BeginEvent"," %s->MakeBranch(H)",detector->GetName()); + detector->MakeBranch("H"); + if (GetDebug()) Info("BeginEvent"," %s->MakeBranchTR()",detector->GetName()); + detector->MakeBranchTR(); + if (GetDebug()) Info("BeginEvent"," %s->SetTreeAddress()",detector->GetName()); + detector->SetTreeAddress(); + } } //_______________________________________________________________________ TParticle* AliRun::Particle(Int_t i) const { - // - // Returns particle i on the simulation stack - // - return fStack->Particle(i); + if (fRunLoader) + if (fRunLoader->Stack()) + return fRunLoader->Stack()->Particle(i); + return 0x0; } //_______________________________________________________________________ @@ -1195,8 +1004,8 @@ void AliRun::ResetHits() detector->ResetHits(); } } - //_______________________________________________________________________ + void AliRun::ResetTrackReferences() { // @@ -1208,8 +1017,8 @@ void AliRun::ResetTrackReferences() detector->ResetTrackReferences(); } } - //_______________________________________________________________________ + void AliRun::ResetPoints() { // @@ -1221,14 +1030,13 @@ void AliRun::ResetPoints() detector->ResetPoints(); } } - //_______________________________________________________________________ + void AliRun::InitMC(const char *setup) { // // Initialize the Alice setup // - Announce(); if(fInitDone) { @@ -1241,7 +1049,16 @@ void AliRun::InitMC(const char *setup) // Register MC in configuration AliConfig::Instance()->Add(gMC); - gMC->SetStack(fStack); + + InitLoaders(); + + fRunLoader->MakeTree("E"); + fRunLoader->LoadKinematics("RECREATE"); + fRunLoader->LoadTrackRefs("RECREATE"); + fRunLoader->LoadHits("all","RECREATE"); + + + fRunLoader->CdGAFile(); gMC->DefineParticles(); //Create standard MC particles AliPDG::AddParticlesToPdgDataBase(); @@ -1257,16 +1074,17 @@ void AliRun::InitMC(const char *setup) // Added also after in case of interactive initialisation of modules fNdets = fModules->GetLast()+1; - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->SetTreeAddress(); - objlast = gDirectory->GetList()->Last(); + TIter next(fModules); + AliModule *detector; + while((detector = dynamic_cast(next()))) + { + objlast = gDirectory->GetList()->Last(); - // Add Detector histograms in Detector list of histograms - if (objlast) objfirst = gDirectory->GetList()->After(objlast); - else objfirst = gDirectory->GetList()->First(); - while (objfirst) { + // Add Detector histograms in Detector list of histograms + if (objlast) objfirst = gDirectory->GetList()->After(objlast); + else objfirst = gDirectory->GetList()->First(); + while (objfirst) + { detector->Histograms()->Add(objfirst); objfirst = gDirectory->GetList()->After(objfirst); } @@ -1284,19 +1102,20 @@ void AliRun::InitMC(const char *setup) gMC->BuildPhysics(); //Write Geometry object to current file. - fGeometry->Write(); + fRunLoader->WriteGeometry(); fInitDone = kTRUE; fMCQA = new AliMCQA(fNdets); - AliConfig::Instance(); // // Save stuff at the beginning of the file to avoid file corruption Write(); + fEventNrInRun = -1; //important - we start Begin event from increasing current number in run } //_______________________________________________________________________ + void AliRun::RunMC(Int_t nevent, const char *setup) { // @@ -1306,20 +1125,12 @@ void AliRun::RunMC(Int_t nevent, const char *setup) // a positive number of events will cause the finish routine // to be called // - fEventsPerRun = nevent; + fEventsPerRun = nevent; // check if initialisation has been done if (!fInitDone) InitMC(setup); // Create the Root Tree with one branch per detector - - MakeTree("ESDRT"); - - if (gSystem->Getenv("CONFIG_SPLIT_FILE")) { - MakeTree("K","Kine.root"); - MakeTree("H","Hits.root"); - } else { - MakeTree("KH"); - } + //Hits moved to begin event -> now we are crating separate tree for each event gMC->ProcessRun(nevent); @@ -1333,14 +1144,14 @@ void AliRun::RunReco(const char *selected, Int_t first, Int_t last) // // Main function to be called to reconstruct Alice event // - cout << "Found "<< gAlice->TreeE()->GetEntries() << "events" << endl; + Int_t nev = fRunLoader->GetNumberOfEvents(); + if (GetDebug()) Info("RunReco","Found %d events",nev); Int_t nFirst = first; - Int_t nLast = (last < 0)? static_cast(gAlice->TreeE()->GetEntries()) : last; + Int_t nLast = (last < 0)? nev : last; for (Int_t nevent = nFirst; nevent <= nLast; nevent++) { - cout << "Processing event "<< nevent << endl; + if (GetDebug()) Info("RunReco","Processing event %d",nevent); GetEvent(nevent); - // MakeTree("R"); Digits2Reco(selected); } } @@ -1354,7 +1165,6 @@ void AliRun::Hits2Digits(const char *selected) // for (Int_t nevent=0; neventTreeE()->GetEntries(); nevent++) { GetEvent(nevent); - // MakeTree("D"); Hits2SDigits(selected); SDigits2Digits(selected); } @@ -1387,53 +1197,51 @@ void AliRun::Tree2Tree(Option_t *option, const char *selected) AliDetector *detector = 0; - TDirectory *cwd = gDirectory; - - TObject *obj; - - char outFile[32]; - - while((obj = next())) { - if (!dynamic_cast(obj)) - Fatal("Tree2Tree","Wrong type in fModules array\n"); - if (!(detector = dynamic_cast(obj))) continue; + while((detector = dynamic_cast(next()))) { if (selected) if (strcmp(detector->GetName(),selected)) continue; - if (!detector->IsActive()) continue; - if (gSystem->Getenv("CONFIG_SPLIT_FILE")) { - if (oS) { - sprintf(outFile,"SDigits.%s.root",detector->GetName()); - detector->MakeBranch("S",outFile); - } - if (oD) { - sprintf(outFile,"Digits.%s.root",detector->GetName()); - detector->MakeBranch("D",outFile); - } - if (oR) { - sprintf(outFile,"Reco.%s.root",detector->GetName()); - detector->MakeBranch("R",outFile); - } - } else { - detector->MakeBranch(option); - } - - cwd->cd(); - - if (oS) { - cout << "Hits2SDigits: Processing " << detector->GetName() << "..." << endl; - detector->Hits2SDigits(); - } - if (oD) { - cout << "SDigits2Digits: Processing " << detector->GetName() << "..." << endl; - detector->SDigits2Digits(); - } - if (oR) { - cout << "Digits2Reco: Processing " << detector->GetName() << "..." << endl; - detector->Digits2Reco(); - } - - cwd->cd(); - } + if (detector->IsActive()) + { + + AliLoader* loader = detector->GetLoader(); + if (loader == 0x0) continue; + + if (oS) + { + if (GetDebug()) Info("Tree2Tree","Processing Hits2SDigits for %s ...",detector->GetName()); + loader->LoadHits("read"); + if (loader->TreeS() == 0x0) loader->MakeTree("S"); + detector->MakeBranch(option); + detector->SetTreeAddress(); + detector->Hits2SDigits(); + loader->UnloadHits(); + loader->UnloadSDigits(); + } + if (oD) + { + if (GetDebug()) Info("Tree2Tree","Processing SDigits2Digits for %s ...",detector->GetName()); + loader->LoadSDigits("read"); + if (loader->TreeD() == 0x0) loader->MakeTree("D"); + detector->MakeBranch(option); + detector->SetTreeAddress(); + detector->SDigits2Digits(); + loader->UnloadSDigits(); + loader->UnloadDigits(); + } + if (oR) + { + if (GetDebug()) Info("Tree2Tree","Processing Digits2Reco for %s ...",detector->GetName()); + loader->LoadDigits("read"); + if (loader->TreeR() == 0x0) loader->MakeTree("R"); + detector->MakeBranch(option); + detector->SetTreeAddress(); + detector->Digits2Reco(); + loader->UnloadDigits(); + loader->UnloadRecPoints(); + + } + } + } } //_______________________________________________________________________ @@ -1507,7 +1315,7 @@ void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min, gMC->ProcessRun(nc1*nc2); // Create only the Root event Tree - MakeTree("E"); + fRunLoader->MakeTree("E"); // End of this run, close files FinishRun(); @@ -1533,19 +1341,18 @@ void AliRun::SetCurrentTrack(Int_t track) // // Set current track number // - fStack->SetCurrentTrack(track); + fRunLoader->Stack()->SetCurrentTrack(track); } //_______________________________________________________________________ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, - Float_t *vpos, Float_t *polar, Float_t tof, - TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) + Float_t *vpos, Float_t *polar, Float_t tof, + TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) { // Delegate to stack // - - fStack->SetTrack(done, parent, pdg, pmom, vpos, polar, tof, - mech, ntr, weight, is); + fRunLoader->Stack()->SetTrack(done, parent, pdg, pmom, vpos, polar, tof, + mech, ntr, weight, is); } //_______________________________________________________________________ @@ -1557,9 +1364,8 @@ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, { // Delegate to stack // - fStack->SetTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, - polx, poly, polz, mech, ntr, weight, is); - + fRunLoader->Stack()->SetTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, + polx, poly, polz, mech, ntr, weight, is); } //_______________________________________________________________________ @@ -1567,7 +1373,7 @@ void AliRun::SetHighWaterMark(const Int_t nt) { // // Set high water mark for last track in event - fStack->SetHighWaterMark(nt); + fRunLoader->Stack()->SetHighWaterMark(nt); } //_______________________________________________________________________ @@ -1576,7 +1382,7 @@ void AliRun::KeepTrack(const Int_t track) // // Delegate to stack // - fStack->KeepTrack(track); + fRunLoader->Stack()->KeepTrack(track); } // @@ -1593,14 +1399,14 @@ void AliRun::ConstructGeometry() TStopwatch stw; TIter next(fModules); AliModule *detector; - printf("Geometry creation:\n"); + if (GetDebug()) Info("ConstructGeometry","Geometry creation:"); while((detector = dynamic_cast(next()))) { stw.Start(); // Initialise detector materials and geometry detector->CreateMaterials(); detector->CreateGeometry(); printf("%10s R:%.2fs C:%.2fs\n", - detector->GetName(),stw.RealTime(),stw.CpuTime()); + detector->GetName(),stw.RealTime(),stw.CpuTime()); } } @@ -1625,8 +1431,8 @@ void AliRun::InitGeometry() } } - //_______________________________________________________________________ + void AliRun::GeneratePrimaries() { // @@ -1635,76 +1441,8 @@ void AliRun::GeneratePrimaries() Generator()->Generate(); } - //_______________________________________________________________________ -void AliRun::BeginEvent() -{ - // Clean-up previous event - // Energy scores - fEventEnergy.Reset(); - // Clean detector information - CleanDetectors(); - // Reset stack info - fStack->Reset(); - - - // - // Reset all Detectors & kinematics & trees - // - char hname[30]; - // - // Initialise event header - fHeader->Reset(fRun,fEvent,fEventNrInRun); - // - fStack->BeginEvent(fEvent); - // - if(fLego) { - fLego->BeginEvent(); - return; - } - - // - - ResetHits(); - ResetTrackReferences(); - ResetDigits(); - ResetSDigits(); - - - if(fTreeH) { - fTreeH->Reset(); - sprintf(hname,"TreeH%d",fEvent); - fTreeH->SetName(hname); - } - - if(fTreeTR) { - fTreeTR->Reset(); - sprintf(hname,"TreeTR%d",fEvent); - fTreeTR->SetName(hname); - } - - if(fTreeD) { - fTreeD->Reset(); - sprintf(hname,"TreeD%d",fEvent); - fTreeD->SetName(hname); - fTreeD->Write(0,TObject::kOverwrite); - } - if(fTreeS) { - fTreeS->Reset(); - sprintf(hname,"TreeS%d",fEvent); - fTreeS->SetName(hname); - fTreeS->Write(0,TObject::kOverwrite); - } - if(fTreeR) { - fTreeR->Reset(); - sprintf(hname,"TreeR%d",fEvent); - fTreeR->SetName(hname); - fTreeR->Write(0,TObject::kOverwrite); - } -} - -//_______________________________________________________________________ void AliRun::BeginPrimary() { // @@ -1720,17 +1458,14 @@ void AliRun::BeginPrimary() //_______________________________________________________________________ void AliRun::PreTrack() { - // - // Method called before each track - // - TObjArray &dets = *fModules; - AliModule *module; - - for(Int_t i=0; i<=fNdets; i++) - if((module = dynamic_cast(dets[i]))) - module->PreTrack(); - - fMCQA->PreTrack(); + TObjArray &dets = *fModules; + AliModule *module; + + for(Int_t i=0; i<=fNdets; i++) + if((module = dynamic_cast(dets[i]))) + module->PreTrack(); + + fMCQA->PreTrack(); } //_______________________________________________________________________ @@ -1764,15 +1499,12 @@ void AliRun::Stepping() //_______________________________________________________________________ void AliRun::PostTrack() { - // - // Called after a track has been trasported - // - TObjArray &dets = *fModules; - AliModule *module; - - for(Int_t i=0; i<=fNdets; i++) - if((module = dynamic_cast(dets[i]))) - module->PostTrack(); + TObjArray &dets = *fModules; + AliModule *module; + + for(Int_t i=0; i<=fNdets; i++) + if((module = dynamic_cast(dets[i]))) + module->PostTrack(); } //_______________________________________________________________________ @@ -1785,26 +1517,23 @@ void AliRun::FinishPrimary() // static Int_t count=0; // const Int_t times=10; // This primary is finished, purify stack - fStack->PurifyKine(); + fRunLoader->Stack()->PurifyKine(); TIter next(fModules); AliModule *detector; while((detector = dynamic_cast(next()))) { detector->FinishPrimary(); + if(detector->GetLoader()) + { + detector->GetLoader()->TreeH()->Fill(); + } } - // Write out hits if any - if (gAlice->TreeH()) { - gAlice->TreeH()->Fill(); - } - - // Write out hits if any - if (gAlice->TreeTR()) { - gAlice->TreeTR()->Fill(); - } - - // - // if(++count%times==1) gObjectTable->Print(); + // Write out track references if any + if (fRunLoader->TreeTR()) + { + fRunLoader->TreeTR()->Fill(); + } } //_______________________________________________________________________ @@ -1817,60 +1546,78 @@ void AliRun::FinishEvent() // if(fLego) fLego->FinishEvent(); + TIter next(fModules); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + detector->FinishEvent(); + } + //Update the energy deposit tables Int_t i; - for(i=0;iGetHeader(); + AliStack* stack = fRunLoader->Stack(); + if ( (header == 0x0) || (stack == 0x0) ) + {//check if we got header and stack. If not cry and exit aliroot + Fatal("AliRun","Can not get the stack or header from LOADER"); + return;//never reached + } // Update Header information - - fHeader->SetNprimary(fStack->GetNprimary()); - fHeader->SetNtrack(fStack->GetNtrack()); + header->SetNprimary(stack->GetNprimary()); + header->SetNtrack(stack->GetNtrack()); // Write out the kinematics - fStack->FinishEvent(); + stack->FinishEvent(); // Write out the event Header information - if (fTreeE) { - fHeader->SetStack(fStack); - fTreeE->Fill(); - } - - - // Write Tree headers - TTree* pTreeK = fStack->TreeK(); - if (pTreeK) pTreeK->Write(0,TObject::kOverwrite); - if (fTreeH) fTreeH->Write(0,TObject::kOverwrite); - if (fTreeTR) fTreeTR->Write(0,TObject::kOverwrite); + TTree* treeE = fRunLoader->TreeE(); + if (treeE) + { + header->SetStack(stack); + treeE->Fill(); + } + else + { + Error("FinishEvent","Can not get TreeE from RL"); + } - ++fEvent; - ++fEventNrInRun; + fRunLoader->WriteKinematics("OVERWRITE"); + fRunLoader->WriteTrackRefs("OVERWRITE"); + fRunLoader->WriteHits("OVERWRITE"); + + if (GetDebug()) + { + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent"," FINISHING EVENT "); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + } } //_______________________________________________________________________ void AliRun::Field(const Double_t* x, Double_t *b) const { - // - // Returns the magnetic field at point x[3] - // Units are kGauss - // - Float_t xfloat[3]; - for (Int_t i=0; i<3; i++) xfloat[i] = x[i]; - - if (Field()) { - Float_t bfloat[3]; - Field()->Field(xfloat,bfloat); - for (Int_t j=0; j<3; j++) b[j] = bfloat[j]; - } - else { - printf("No mag field defined!\n"); - b[0]=b[1]=b[2]=0.; - } + Float_t xfloat[3]; + for (Int_t i=0; i<3; i++) xfloat[i] = x[i]; + + if (Field()) { + Float_t bfloat[3]; + Field()->Field(xfloat,bfloat); + for (Int_t j=0; j<3; j++) b[j] = bfloat[j]; + } + else { + printf("No mag field defined!\n"); + b[0]=b[1]=b[2]=0.; + } } @@ -1885,18 +1632,9 @@ void AliRun::Streamer(TBuffer &R__b) if (R__b.IsReading()) { if (!gAlice) gAlice = this; - AliRun::Class()->ReadBuffer(R__b, this); - // gROOT->GetListOfBrowsables()->Add(this,"Run"); - fTreeE = dynamic_cast(gDirectory->Get("TE")); - if (fTreeE) { - fTreeE->SetBranchAddress("Header", &fHeader); - } - else Error("Streamer","cannot find Header Tree\n"); - - fTreeE->GetEntry(0); gRandom = fRandom; } else { AliRun::Class()->WriteBuffer(R__b, this); @@ -1909,7 +1647,7 @@ Int_t AliRun::CurrentTrack() const { // // Returns current track // - return fStack->CurrentTrack(); + return fRunLoader->Stack()->CurrentTrack(); } //_______________________________________________________________________ @@ -1917,283 +1655,97 @@ Int_t AliRun::GetNtrack() const { // // Returns number of tracks in stack // - return fStack->GetNtrack(); + return fRunLoader->Stack()->GetNtrack(); } +//_______________________________________________________________________ //_______________________________________________________________________ TObjArray* AliRun::Particles() const { // // Returns pointer to Particles array // - return fStack->Particles(); -} - -//_______________________________________________________________________ -TTree* AliRun::TreeK() const { - // - // Returns pointer to the TreeK array - // - return fStack->TreeK(); + if (fRunLoader) + if (fRunLoader->Stack()) + return fRunLoader->Stack()->Particles(); + return 0x0; } +//___________________________________________________________________________ //_______________________________________________________________________ void AliRun::SetGenEventHeader(AliGenEventHeader* header) { - fHeader->SetGenEventHeader(header); + fRunLoader->GetHeader()->SetGenEventHeader(header); } -//_______________________________________________________________________ -TFile* AliRun::InitFile(TString fileName) -{ -// -// create the file where the whole tree will be saved -// - TDirectory *wd = gDirectory; - TFile* file = TFile::Open(fileName,"update"); - gDirectory = wd; - if (!file->IsOpen()) { - Error("Cannot open file, %s\n",fileName); - return 0; - } - return file; -} - -//_______________________________________________________________________ -TFile* AliRun::InitTreeFile(Option_t *option, TString fileName) -{ - // - // create the file where one of the following trees will be saved - // trees: S,D,R - // WARNING: by default these trees are saved on the file on which - // hits are stored. If you divert one of these trees, you cannot restore - // it to the original file (usually galice.root) in the same aliroot session - Bool_t oS = (strstr(option,"S")!=0); - Bool_t oR = (strstr(option,"R")!=0); - Bool_t oD = (strstr(option,"D")!=0); - Int_t choice[3]; - for (Int_t i=0; i<3; i++) choice[i] = 0; - if(oS)choice[0] = 1; - if(oD)choice[1] = 1; - if(oR)choice[2] = 1; - - TFile *ptr=0; - - if(!(oS || oR || oD))return ptr; - - Int_t active[3]; - for (Int_t i=0; i<3; i++) active[i] = 0; - if(fTreeSFileName != "") active[0] = 1; - if(fTreeDFileName != "") active[1] = 1; - if(fTreeDFileName != "") active[2] = 1; - - Bool_t alreadyopen1 = kFALSE; - Bool_t alreadyopen2 = kFALSE; - - if(oS){ - // if already active and same name with non-null ptr - if(active[0]==1 && fileName == fTreeSFileName && fTreeSFile){ - Warning("InitTreeFile","File %s already opened",fTreeSFileName.Data()); - ptr = fTreeSFile; - } - else { - // if already active with different name with non-null ptr - if(active[0]==1 && fileName != fTreeSFileName && fTreeSFile){ - // close the active files and also the other possible files in option - CloseTreeFile(option); - } - fTreeSFileName = fileName; - alreadyopen1 = - (active[1] == 1 && fTreeDFileName == fTreeSFileName && fTreeDFile); - alreadyopen2 = - (active[2] == 1 && fTreeRFileName == fTreeSFileName && fTreeRFile); - if(!(alreadyopen1 || alreadyopen2)){ - ptr = InitFile(fileName); - fTreeSFile = ptr; - } - else { - if(alreadyopen1){fTreeSFile = fTreeDFile; ptr = fTreeSFile;} - if(alreadyopen2){fTreeSFile = fTreeRFile; ptr = fTreeSFile;} - } - if(choice[1] == 1) { fTreeDFileName = fileName; fTreeDFile = ptr;} - if(choice[2] == 1) { fTreeRFileName = fileName; fTreeRFile = ptr;} - } - return ptr; - } +//___________________________________________________________________________ - if(oD){ - // if already active and same name with non-null ptr - if(active[1]==1 && fileName == fTreeDFileName && fTreeDFile){ - Warning("InitTreeFile","File %s already opened",fTreeDFileName.Data()); - ptr = fTreeDFile; - } - else { - // if already active with different name with non-null ptr - if(active[1]==1 && fileName != fTreeDFileName && fTreeDFile){ - // close the active files and also the other possible files in option - CloseTreeFile(option); - } - fTreeDFileName = fileName; - alreadyopen1 = - (active[0] == 1 && fTreeSFileName == fTreeDFileName && fTreeSFile); - alreadyopen2 = - (active[2] == 1 && fTreeRFileName == fTreeDFileName && fTreeRFile); - if(!(alreadyopen1 || alreadyopen2)){ - ptr = InitFile(fileName); - fTreeDFile = ptr; - } - else { - if(alreadyopen1){fTreeDFile = fTreeSFile; ptr = fTreeDFile;} - if(alreadyopen2){fTreeDFile = fTreeRFile; ptr = fTreeDFile;} - } - if(choice[2] == 1) { fTreeRFileName = fileName; fTreeRFile = ptr;} - } - return ptr; - } +Int_t AliRun::GetEvNumber() const +{ +//Returns number of current event + if (fRunLoader == 0x0) + { + Error("GetEvent","RunLoader is not set. Can not load data."); + return -1; + } - if(oR){ - // if already active and same name with non-null ptr - if(active[2]==1 && fileName == fTreeRFileName && fTreeRFile){ - Warning("InitTreeFile","File %s already opened",fTreeRFileName.Data()); - ptr = fTreeRFile; - } - else { - // if already active with different name with non-null ptr - if(active[2]==1 && fileName != fTreeRFileName && fTreeRFile){ - // close the active files and also the other possible files in option - CloseTreeFile(option); - } - fTreeRFileName = fileName; - alreadyopen1 = - (active[1] == 1 && fTreeDFileName == fTreeRFileName && fTreeDFile); - alreadyopen2 = - (active[0]== 1 && fTreeSFileName == fTreeRFileName && fTreeSFile); - if(!(alreadyopen1 || alreadyopen2)){ - ptr = InitFile(fileName); - fTreeRFile = ptr; - } - else { - if(alreadyopen1){fTreeRFile = fTreeDFile; ptr = fTreeRFile;} - if(alreadyopen2){fTreeRFile = fTreeSFile; ptr = fTreeRFile;} - } - } - return ptr; - } - return 0; + return fRunLoader->GetEventNumber(); } -//_______________________________________________________________________ -void AliRun::PrintTreeFile() -{ - // - // prints the file names and pointer associated to S,D,R trees - // - cout<<"===================================================\n"; - TFile *file = fTreeE->GetCurrentFile(); - TString curfilname=""; - if(file)curfilname=static_cast(file->GetName()); - cout<<" Current tree file name: "<IsOpen()){ - fTreeSFile->Close(); - delete fTreeSFile; - } - } - fTreeSFile = 0; - } - if(oD){ - fTreeDFileName = ""; - if(fTreeDFile){ - if(!((fTreeDFile == fTreeRFile) || (fTreeDFile == fTreeSFile)) && - fTreeDFile->IsOpen()){ - fTreeDFile->Close(); - delete fTreeDFile; - } - } - fTreeDFile = 0; - } - if(oR){ - fTreeRFileName = ""; - if(fTreeRFile){ - if(!((fTreeRFile == fTreeSFile) || (fTreeRFile == fTreeDFile)) && - fTreeRFile->IsOpen()){ - fTreeRFile->Close(); - delete fTreeRFile; + fRunLoader = rloader; + if (fRunLoader == 0x0) return; + + TString evfoldname; + TFolder* evfold = fRunLoader->GetEventFolder(); + if (evfold) evfoldname = evfold->GetName(); + else Warning("SetRunLoader","Did not get Event Folder from Run Loader"); + + if ( fRunLoader->GetAliRun() ) + {//if alrun already exists in folder + if (fRunLoader->GetAliRun() != this ) + {//and is different than this - crash + Fatal("AliRun","AliRun is already in Folder and it is not this object"); + return;//pro forma + }//else do nothing + } + else + { + evfold->Add(this);//Post this AliRun to Folder + } + + TIter next(fModules); + AliModule *module; + while((module = (AliModule*)next())) + { + if (evfold) AliConfig::Instance()->Add(module,evfoldname); + AliDetector* detector = dynamic_cast(module); + if (detector) + { + AliLoader* loader = fRunLoader->GetLoader(detector); + if (loader == 0x0) + { + Error("SetRunLoader","Can not get loader for detector %s",detector->GetName()); + } + else + { + if (GetDebug()) Info("SetRunLoader","Setting loader for detector %s",detector->GetName()); + detector->SetLoader(loader); + } } - } - fTreeRFile = 0; - } + } } -//_______________________________________________________________________ -void AliRun::MakeTree(Option_t *option, TFile *file) +void AliRun::AddModule(AliModule* mod) { - // - // Create some trees in the separate file - // - const char *oD = strstr(option,"D"); - const char *oR = strstr(option,"R"); - const char *oS = strstr(option,"S"); - - TDirectory *cwd = gDirectory; - char hname[30]; - - if (oD) { - delete fTreeD; - sprintf(hname,"TreeD%d",fEvent); - file->cd(); - fTreeD = static_cast(file->Get("hname")); - if (!fTreeD) { - fTreeD = new TTree(hname,"Digits"); - fTreeD->Write(0,TObject::kOverwrite); - } - cwd->cd(); - } - if (oS) { - delete fTreeS; - sprintf(hname,"TreeS%d",fEvent); - file->cd(); - fTreeS = static_cast(file->Get("hname")); - if (!fTreeS) { - fTreeS = new TTree(hname,"SDigits"); - fTreeS->Write(0,TObject::kOverwrite); - } - cwd->cd(); - } + if (mod == 0x0) return; + if (strlen(mod->GetName()) == 0) return; + if (GetModuleID(mod->GetName()) >= 0) return; + + if (GetDebug()) Info("AddModule","%s",mod->GetName()); + if (fRunLoader == 0x0) AliConfig::Instance()->Add(mod); + else AliConfig::Instance()->Add(mod,fRunLoader->GetEventFolder()->GetName()); - if (oR) { - delete fTreeR; - sprintf(hname,"TreeR%d",fEvent); - file->cd(); - fTreeR = static_cast(file->Get("hname")); - if (!fTreeR) { - fTreeR = new TTree(hname,"RecPoint"); - fTreeR->Write(0,TObject::kOverwrite); - } - cwd->cd(); - } + Modules()->Add(mod); } diff --git a/STEER/AliRun.h b/STEER/AliRun.h index df866c0ee87..21e1c09d6db 100644 --- a/STEER/AliRun.h +++ b/STEER/AliRun.h @@ -7,10 +7,11 @@ #include #include +#include #include #include -#include #include +#include #include class TBranch; @@ -23,6 +24,7 @@ class TParticle; class TRandom; class TTree; +#include "AliRunLoader.h" class AliDetector; class AliDisplay; class AliGenEventHeader; @@ -36,6 +38,7 @@ class AliMagF; class AliModule; class AliStack; + enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4}; @@ -68,7 +71,8 @@ public: virtual void FlagTrack(Int_t track); void AddEnergyDeposit(Int_t id, Float_t edep) {fEventEnergy[id]+=edep;} - Int_t GetEvNumber() const {return fEvent;} + void AddModule(AliModule* mod); + Int_t GetEvNumber() const; Int_t GetRunNumber() const {return fRun;} void SetRunNumber(Int_t run) {fRun=run;} void SetEventNrInRun(Int_t event) {fEventNrInRun=event;} @@ -88,7 +92,6 @@ public: virtual const char *GetConfigFunction() const {return fConfigFunction.Data();} TGeometry *GetGeometry(); - AliHeader* GetHeader() const {return fHeader;} virtual void SetGenEventHeader(AliGenEventHeader* header); Int_t GetNtrack() const; virtual Int_t GetPrimary(Int_t track) const; @@ -100,8 +103,6 @@ public: virtual void Init(const char *setup="Config.C") {InitMC(setup);} Bool_t IsFolder() const {return kTRUE;} virtual AliLego* Lego() const {return fLego;} - virtual void MakeTree(Option_t *option="KH", const char *file = 0); - void MakeTree(Option_t *option, TFile *file); TObjArray *Particles() const; TParticle *Particle(Int_t i) const; @@ -114,11 +115,10 @@ public: virtual void SetBaseFile(const char *filename="galice.root"); virtual void ReadTransPar(); virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); - virtual void Run(Int_t nevent=1, const char *setup="Config.C") - {RunMC(nevent,setup);} + virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);} virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, - Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, - Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL); + Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, + Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL); virtual Bool_t IsLegoRun() const {return (fLego!=0);} virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0); virtual void SetCurrentTrack(Int_t track); @@ -147,7 +147,6 @@ public: virtual void ResetGenerator(AliGenerator *generator); virtual void EnergySummary(); virtual TDatabasePDG* PDGDB() const {return fPDGDB;} - virtual void Announce() const; // MC Application // @@ -164,57 +163,41 @@ public: virtual Double_t TrackingZmax() const {return fTrZmax;} virtual Double_t TrackingRmax() const {return fTrRmax;} virtual void Field(const Double_t* x, Double_t* b) const; + // // End of MC Application - TFile* InitTreeFile(Option_t *option, TString fileName); - void PrintTreeFile(); - void CloseTreeFile(Option_t *option); - TString GetTreeDFileName() const {return fTreeDFileName;} - TString GetTreeSFileName() const {return fTreeSFileName;} - TString GetTreeRFileName() const {return fTreeRFileName;} - void SetTreeDFileName(TString fileName){fTreeDFileName=fileName;} - void SetTreeSFileName(TString fileName){fTreeSFileName=fileName;} - void SetTreeRFileName(TString fileName){fTreeRFileName=fileName;} - TFile* GetTreeDFile() const {return fTreeDFile;} - TFile* GetTreeSFile() const {return fTreeSFile;} - TFile* GetTreeRFile() const {return fTreeRFile;} - - - TTree *TreeD() const {return fTreeD;} - TTree *TreeS() const {return fTreeS;} - TTree *TreeE() const {return fTreeE;} - TTree *TreeH() const {return fTreeH;} - TTree *TreeTR() const {return fTreeTR;} - TTree *TreeK() const; - TTree *TreeR() const {return fTreeR;} + TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;} + TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;} + AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;} + AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;} - AliStack *Stack() const {return fStack;} - - static void Deprecated(TObject *obj, const char *method, - const char *replacement) { - if (obj) - ::Warning(Form("%s::%s", obj->ClassName(), method), - "method is depricated\nPlease use: %s", replacement); - else - ::Warning(method, "method is depricated\nPlease use: %s", replacement); - } + TTree *TreeD() {MayNotUse("TreeD"); return 0x0;} + TTree *TreeS() {MayNotUse("TreeS"); return 0x0;} + TTree *TreeR() {MayNotUse("TreeR"); return 0x0;} + + void SetRunLoader(AliRunLoader* rloader); + AliRunLoader* GetRunLoader() const {return fRunLoader;} +// void SetEventFolderName(const char* eventfoldername); + virtual void Announce() const; + + virtual void InitLoaders(); //prepares run (i.e. creates getters) + static void Deprecated(TObject *obj, const char *method, + const char *replacement) { + if (obj) + ::Warning(Form("%s::%s", obj->ClassName(), method), + "method is depricated\nPlease use: %s", replacement); + else + ::Warning(method, "method is depricated\nPlease use: %s", replacement); + } protected: virtual void Tree2Tree(Option_t *option, const char *detector=0); - TFile* InitFile(TString fileName=""); Int_t fRun; //! Current run number Int_t fEvent; //! Current event number (from 1) Int_t fEventNrInRun; //! Current unique event number in run Int_t fEventsPerRun; // Number of events per run Int_t fDebug; // Debug flag - AliHeader *fHeader; // Header information - TTree *fTreeD; //! Pointer to Tree for Digits - TTree *fTreeS; //! Pointer to Tree for SDigits - TTree *fTreeH; //! Pointer to Tree for Hits - TTree *fTreeTR; //! Pointer to Tree for TrackRefernces - TTree *fTreeE; //! Pointer to Tree for Header - TTree *fTreeR; //! Pointer to Tree for Reconstructed Objects TObjArray *fModules; // List of Detectors TGeometry *fGeometry; // Pointer to geometry AliDisplay *fDisplay; //! Pointer to event display @@ -238,19 +221,12 @@ protected: AliMCQA *fMCQA; // Pointer to MC Quality assurance class TString fTransParName; // Name of the transport parameters file TString fBaseFileName; // Name of the base root file - AliStack* fStack; //! Particle Stack - - TString fTreeDFileName; //! name of the file with TreeD - TFile* fTreeDFile; //! file with TreeD - TString fTreeSFileName; //! name of the file with TreeS - TFile* fTreeSFile; //! file with TreeS - TString fTreeRFileName; //! name of the file with TreeR - TFile* fTreeRFile; //! file with TreeR - + + AliRunLoader *fRunLoader; //!run getter - written as a separate object private: void Copy(AliRun &arun) const; - ClassDef(AliRun,7) //Supervisor class for all Alice detectors + ClassDef(AliRun,8) //Supervisor class for all Alice detectors }; R__EXTERN AliRun *gAlice; diff --git a/STEER/AliRunDigitizer.cxx b/STEER/AliRunDigitizer.cxx index a9301e76a44..dd56e37c1fe 100644 --- a/STEER/AliRunDigitizer.cxx +++ b/STEER/AliRunDigitizer.cxx @@ -15,7 +15,7 @@ /* $Id$ */ -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ // // AliRunDigitizer.cxx // @@ -86,7 +86,7 @@ // manager->SetNrOfEventsToWrite(1); // manager->Exec(""); // -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ // system includes @@ -102,250 +102,220 @@ #include "AliDigitizer.h" #include "AliMergeCombi.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliRun.h" #include "AliRunDigitizer.h" #include "AliStream.h" +#include "AliHeader.h" ClassImp(AliRunDigitizer) +const TString AliRunDigitizer::fgkDefOutFolderName("Output"); +const TString AliRunDigitizer::fgkBaseInFolderName("Input"); + + //_______________________________________________________________________ AliRunDigitizer::AliRunDigitizer(): - fkMASKSTEP(0), - fOutputFileName(0), - fOutputDirName(0), - fOutput(0), - fEvent(0), - fNrOfEventsToWrite(0), - fNrOfEventsWritten(0), - fCopyTreesFromInput(0), - fTreeD(0), - fTreeDTPC(0), - fTreeDTRD(0), - fTreeR(0), - fNinputs(0), - fNinputsGiven(0), - fInputStreams(0), - fTreeDTPCBaseName(0), - fTreeTPCSBaseName(0), - fCombi(0), - fCombination(0), - fCombinationFileName(0), - fDebug(0) + fkMASKSTEP(0), + fOutputFileName(0), + fOutputDirName(0), + fEvent(0), + fNrOfEventsToWrite(0), + fNrOfEventsWritten(0), + fCopyTreesFromInput(0), + fNinputs(0), + fNinputsGiven(0), + fInputStreams(0x0), + fOutRunLoader(0x0), + fOutputInitialized(kFALSE), + fCombi(0), + fCombination(0), + fCombinationFileName(0), + fDebug(0) { - // - // default ctor, where no new objects can be created - // do not use this ctor, it is supplied only for root needs - // - for (Int_t i=0;iClear("nodelete"); - - delete fInputStreams; - delete fCombi; + delete fInputStreams; + delete fCombi; + delete fOutRunLoader; } - //_______________________________________________________________________ void AliRunDigitizer::AddDigitizer(AliDigitizer *digitizer) { // add digitizer to the list of active digitizers this->Add(digitizer); } - //_______________________________________________________________________ -void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile) +void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile, TString foldername) { - // - // Sets the name of the input file - // +// +// Sets the name of the input file +// if (i > fInputStreams->GetLast()) { Error("SetInputStream","Input stream number too high"); return; } - static_cast(fInputStreams->At(i))->AddFile(inputFile); + AliStream * stream = static_cast(fInputStreams->At(i)) ; + if ( !foldername.IsNull() ) { + if ( i > 0 ) + foldername += i ; // foldername should stay unchanged for the default output + stream->SetFolderName(foldername) ; + } + stream->AddFile(inputFile); } //_______________________________________________________________________ void AliRunDigitizer::Digitize(Option_t* option) { -// get a new combination of inputs, connect input trees and loop -// over all digitizers +// get a new combination of inputs, loads events to folders // take gAlice from the first input file. It is needed to access // geometry data // If gAlice is already in memory, use it - if (!gAlice) { - if (!static_cast(fInputStreams->At(0))->ImportgAlice()) { - cerr<<"gAlice object not found in the first file of " - <<"the 1st stream"<(fInputStreams->At(0))->ImportgAlice()) + { + Error("Digitize","Error occured while getting gAlice from Input 0"); + return; + } + } + + if (!InitGlobal()) //calls Init() for all (sub)digitizers + { + Error("Digitize","InitGlobal returned error"); + return; + } + Int_t eventsCreated = 0; // loop until there is anything on the input in case fNrOfEventsToWrite < 0 - while ((eventsCreated++ < fNrOfEventsToWrite) || (fNrOfEventsToWrite < 0)) { - if (!ConnectInputTrees()) break; - InitEvent(); -// loop over all registered digitizers and let them do the work - ExecuteTasks(option); - CleanTasks(); - FinishEvent(); - } + while ((eventsCreated++ < fNrOfEventsToWrite) || (fNrOfEventsToWrite < 0)) + { + if (!ConnectInputTrees()) break; + InitEvent();//this must be after call of Connect Input tress. + if (fOutRunLoader) + { + fOutRunLoader->SetEventNumber(eventsCreated-1); + } + ExecuteTasks(option);// loop over all registered digitizers and let them do the work + FinishEvent(); + CleanTasks(); + } FinishGlobal(); } //_______________________________________________________________________ Bool_t AliRunDigitizer::ConnectInputTrees() { -// fill arrays fArrayTreeS, fArrayTreeH and fArrayTreeTPCS with -// pointers to the correct events according fCombination values -// null pointers can be in the output, AliDigitizer has to check it - - TTree *tree; - char treeName[50]; - Int_t serialNr; +//loads events Int_t eventNr[kMaxStreamsToMerge], delta[kMaxStreamsToMerge]; fCombi->Combination(eventNr, delta); - for (Int_t i=0;i(fInputStreams->At(i)); - if (!iStream->NextEventInStream(serialNr)) return kFALSE; - fInputFiles[i]=iStream->CurrentFile(); - sprintf(treeName,"TreeS%d",serialNr); - tree = static_cast(iStream->CurrentFile()->Get(treeName)); - if (fArrayTreeS[i]) { - delete fArrayTreeS[i]; - fArrayTreeS[i] = 0; - } - fArrayTreeS[i] = tree; - sprintf(treeName,"TreeH%d",serialNr); - tree = static_cast(iStream->CurrentFile()->Get(treeName)); - if (fArrayTreeH[i]) { - delete fArrayTreeH[i]; - fArrayTreeH[i] = 0; - } - fArrayTreeH[i] = tree; - sprintf(treeName,"%s%d",fTreeTPCSBaseName,serialNr); - tree = static_cast(iStream->CurrentFile()->Get(treeName)); - if (fArrayTreeTPCS[i]) { - delete fArrayTreeTPCS[i]; - fArrayTreeTPCS[i] = 0; - } - fArrayTreeTPCS[i] = tree; - sprintf(treeName,"TreeS%d_TRD",serialNr); - tree = static_cast(iStream->CurrentFile()->Get(treeName)); - if (fArrayTreeTRDS[i]) { - delete fArrayTreeTRDS[i]; - fArrayTreeTRDS[i] = 0; - } - fArrayTreeTRDS[i] = tree; - } else if (delta[i] != 0) { + for (Int_t i=0;i(fInputStreams->At(i));//gets the "i" defined in combination + if (!iStream->NextEventInStream()) return kFALSE; //sets serial number + } + else if (delta[i] != 0) + { Error("ConnectInputTrees","Only delta 0 or 1 is implemented"); return kFALSE; - } - } + } + } + return kTRUE; } @@ -353,143 +323,165 @@ Bool_t AliRunDigitizer::ConnectInputTrees() Bool_t AliRunDigitizer::InitGlobal() { // called once before Digitize() is called, initialize digitizers and output - - TList* subTasks = GetListOfTasks(); + fOutputInitialized = kFALSE; + TList* subTasks = this->GetListOfTasks(); if (subTasks) { - // subTasks->ForEach(AliDigitizer,Init)(); TIter next(subTasks); while (AliDigitizer * dig = (AliDigitizer *) next()) - dig->Init(); - } + dig->Init(); + } return kTRUE; } //_______________________________________________________________________ + void AliRunDigitizer::SetOutputFile(TString fn) { - // the output will be to separate file, not to the signal file +// the output will be to separate file, not to the signal file + //here should be protection to avoid setting the same file as any input + Info("SetOutputFile","Setting Output File Name %s ",fn.Data()); fOutputFileName = fn; - (static_cast(fInputStreams->At(0)))->ChangeMode("READ"); - InitOutputGlobal(); +// InitOutputGlobal(); } //_______________________________________________________________________ Bool_t AliRunDigitizer::InitOutputGlobal() { // Creates the output file, called by InitEvent() - - TString fn; - fn = fOutputDirName + '/' + fOutputFileName; - fOutput = new TFile(fn,"update"); - if (GetDebug()>2) { - cerr<<"AliRunDigitizer::InitOutputGlobal(): file "<2) Info("InitOutputGlobal","file %s was opened.",fOutputFileName.Data()); + } + fOutputInitialized = kTRUE; + return kTRUE; } - - //_______________________________________________________________________ + void AliRunDigitizer::InitEvent() { -// Creates TreeDxx in the output file, called from Digitize() once for -// each event. xx = fEvent - - if (GetDebug()>2) - cerr<<"AliRunDigitizer::InitEvent: fEvent = "<(fInputStreams->At(0)))->CurrentFile(); - } - fOutput->cd(); - char treeName[30]; - sprintf(treeName,"TreeD%d",fEvent); - fTreeD = static_cast(fOutput->Get(treeName)); - if (!fTreeD) { - fTreeD = new TTree(treeName,"Digits"); - fTreeD->Write(0,TObject::kOverwrite); - } - -// tree for ITS fast points - sprintf(treeName,"TreeR%d",fEvent); - fTreeR = static_cast(fOutput->Get(treeName)); - if (!fTreeR) { - fTreeR = new TTree(treeName,"Reconstruction"); - fTreeR->Write(0,TObject::kOverwrite); - } - -// special tree for TPC - sprintf(treeName,"%s%d",fTreeDTPCBaseName,fEvent); - fTreeDTPC = static_cast(fOutput->Get(treeName)); - if (!fTreeDTPC) { - fTreeDTPC = new TTree(treeName,"TPC_Digits"); - fTreeDTPC->Write(0,TObject::kOverwrite); - } - -// special tree for TRD - sprintf(treeName,"TreeD%d_TRD",fEvent); - fTreeDTRD = static_cast(fOutput->Get(treeName)); - if (!fTreeDTRD) { - fTreeDTRD = new TTree(treeName,"TRD_Digits"); - fTreeDTRD->Write(0,TObject::kOverwrite); - } - +//redirects output properly + if (GetDebug()>2) + { + Info("InitEvent","fEvent = %d",fEvent); + Info("InitEvent","fOutputFileName \"%s\"",fOutputFileName.Data()); + } + if (fOutputInitialized == kFALSE) InitOutputGlobal(); + +// if fOutputFileName was not given, write output to signal directory } - //_______________________________________________________________________ + void AliRunDigitizer::FinishEvent() { // called at the end of loop over digitizers - Int_t i; - fOutput->cd(); - if (fCopyTreesFromInput > -1) { - char treeName[20]; - i = fCopyTreesFromInput; - sprintf(treeName,"TreeK%d",fCombination[i]); - fInputFiles[i]->Get(treeName)->Clone()->Write(); - sprintf(treeName,"TreeH%d",fCombination[i]); - fInputFiles[i]->Get(treeName)->Clone()->Write(); - } + + if (GetOutRunLoader() == 0x0) + { + Error("FinishEvent","fOutRunLoader is null"); + return; + } + fEvent++; fNrOfEventsWritten++; - if (fTreeD) { - delete fTreeD; - fTreeD = 0; - } - if (fTreeR) { - delete fTreeR; - fTreeR = 0; - } - if (fTreeDTPC) { - delete fTreeDTPC; - fTreeDTPC = 0; - } - if (fTreeDTRD) { - delete fTreeDTRD; - fTreeDTRD = 0; - } + + if (fOutRunLoader) + { + AliRunLoader* inrl = AliRunLoader::GetRunLoader(GetInputFolderName(0)); + AliHeader* outheader = fOutRunLoader->GetHeader(); + AliHeader* inheader = inrl->GetHeader(); + if (inheader == 0x0) + { + inrl->LoadHeader(); + inheader = inrl->GetHeader(); + if (inheader == 0x0) Fatal("FinishEvent","Can not get header from input 0"); + } + + outheader->SetNprimary(inheader->GetNprimary()); + outheader->SetNtrack(inheader->GetNtrack()); + outheader->SetEvent(inheader->GetEvent()); + outheader->SetEventNrInRun(inheader->GetEventNrInRun()); + outheader->SetNvertex(inheader->GetNvertex()); + fOutRunLoader->TreeE()->Fill(); + } + + if (fCopyTreesFromInput > -1) + { + //this is sensless since no information would be coherent in case of merging + // + cout<<"Copy trees from input: Copy or link files manually"<cd(); + if (GetOutRunLoader() == 0x0) + { + Error("FinishGlobal","Can not get RunLoader from Output Stream folder"); + return; + } + GetOutRunLoader()->CdGAFile(); this->Write(0,TObject::kOverwrite); - if (fCopyTreesFromInput > -1) { - fInputFiles[fCopyTreesFromInput]->Get("TE")->Clone()->Write(); - gAlice->Write(); - } - fOutput->Write(); + if (fOutRunLoader) + { + fOutRunLoader->WriteHeader("OVERWRITE"); + fOutRunLoader->WriteRunLoader("OVERWRITE"); + TFolder* outfolder = fOutRunLoader->GetEventFolder(); + if (outfolder == 0x0) + { + Error("FinishEvent","Can not get Event Folder"); + return; + } + + AliRunLoader* inRN = AliRunLoader::GetRunLoader(GetInputFolderName(0)); + outfolder->Add(inRN->GetAliRun()); + fOutRunLoader->WriteAliRun("OVERWRITE"); + } + + if (fCopyTreesFromInput > -1) + { + //copy files manually + } } - - //_______________________________________________________________________ + Int_t AliRunDigitizer::GetNParticles(Int_t event) const { // return number of particles in all input files for a given @@ -505,9 +497,9 @@ Int_t AliRunDigitizer::GetNParticles(Int_t event) const } return sum; } - //_______________________________________________________________________ -Int_t AliRunDigitizer::GetNParticles(Int_t /* event */, Int_t /* input */) const + +Int_t AliRunDigitizer::GetNParticles(Int_t event, Int_t input) const { // return number of particles in input file input for a given // event (as numbered in this input file) @@ -517,32 +509,6 @@ Int_t AliRunDigitizer::GetNParticles(Int_t /* event */, Int_t /* input */) cons return -1; -/* - TFile *file = ConnectInputFile(input); - if (!file) { - Error("GetNParticles","Cannot open input file"); - return -1; - } - -// find the header and get Nprimaries and Nsecondaries - TTree* tE = (TTree *)file->Get("TE") ; - if (!tE) { - Error("GetNParticles","input file does not contain TE"); - return -1; - } - AliHeader* header; - header = 0; - tE->SetBranchAddress("Header", &header); - if (!tE->GetEntry(event)) { - Error("GetNParticles","event %d not found",event); - return -1; - } - if (GetDebug()>2) { - cerr<<"Nprimary: "<< header->GetNprimary()<GetNsecondary()<GetNprimary() + header->GetNsecondary(); -*/ } //_______________________________________________________________________ @@ -558,9 +524,8 @@ Int_t* AliRunDigitizer::GetInputEventNumbers(Int_t event) const } return a; } - //_______________________________________________________________________ -Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t /* input */) const +Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input) const { // return an event number of an eventInput from input file input // which was merged to create output event event @@ -568,7 +533,6 @@ Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t /* input */) const // simplified for now, implement later return event; } - //_______________________________________________________________________ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event) const { @@ -580,8 +544,7 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event) const } //_______________________________________________________________________ -TParticle* AliRunDigitizer::GetParticle(Int_t /* i */, Int_t /* input */, - Int_t /* event */) const +TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t input, Int_t event) const { // return pointer to particle with index i in the input file input // (index without mask) @@ -591,53 +554,6 @@ TParticle* AliRunDigitizer::GetParticle(Int_t /* i */, Int_t /* input */, // Must be revised in the version with AliStream return 0; -/* - TFile *file = ConnectInputFile(input); - if (!file) { - Error("GetParticle","Cannot open input file"); - return 0; - } - -// find the header and get Nprimaries and Nsecondaries - TTree* tE = (TTree *)file->Get("TE") ; - if (!tE) { - Error("GetParticle","input file does not contain TE"); - return 0; - } - AliHeader* header; - header = 0; - tE->SetBranchAddress("Header", &header); - if (!tE->GetEntry(event)) { - Error("GetParticle","event %d not found",event); - return 0; - } - -// connect TreeK - char treeName[30]; - sprintf(treeName,"TreeK%d",event); - TTree* tK = static_cast(file->Get(treeName)); - if (!tK) { - Error("GetParticle","input file does not contain TreeK%d",event); - return 0; - } - TParticle *particleBuffer; - particleBuffer = 0; - tK->SetBranchAddress("Particles", &particleBuffer); - - -// algorithmic way of getting entry index -// (primary particles are filled after secondaries) - Int_t entry; - if (iGetNprimary()) - entry = i+header->GetNsecondary(); - else - entry = i-header->GetNprimary(); - Int_t bytesRead = tK->GetEntry(entry); -// new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); - if (bytesRead) - return particleBuffer; - return 0; -*/ } //_______________________________________________________________________ @@ -652,6 +568,37 @@ void AliRunDigitizer::ExecuteTask(Option_t* option) } //_______________________________________________________________________ +const TString& AliRunDigitizer::GetInputFolderName(Int_t i) const +{ + AliStream* stream = dynamic_cast(fInputStreams->At(i)); + if (stream == 0x0) + { + Fatal("GetInputFolderName","Can not get the input stream. Index = %d. Exiting",i); + } + return stream->GetFolderName(); +} +//_______________________________________________________________________ + +const char* AliRunDigitizer::GetOutputFolderName() +{ + return GetOutRunLoader()->GetEventFolder()->GetName(); +} +//_______________________________________________________________________ + +AliRunLoader* AliRunDigitizer::GetOutRunLoader() +{ + if (fOutRunLoader) return fOutRunLoader; + + if ( fOutputFileName.IsNull() ) + {//guard that sombody calls it without settting file name + cout<<"Output file name is empty. Using Input 0 for output\n"; + return AliRunLoader::GetRunLoader(GetInputFolderName(0)); + } +// InitOutputGlobal(); + return fOutRunLoader; +} +//_______________________________________________________________________ + TString AliRunDigitizer::GetInputFileName(const Int_t input, const Int_t order) const { // returns file name of the order-th file in the input stream input diff --git a/STEER/AliRunDigitizer.h b/STEER/AliRunDigitizer.h index a3613221429..829390c411a 100644 --- a/STEER/AliRunDigitizer.h +++ b/STEER/AliRunDigitizer.h @@ -17,15 +17,17 @@ #include "TArrayI.h" #include "TTask.h" -class TClonesArray; +#include "TClonesArray.h" class TFile; class TParticle; class TTree; // --- AliRoot header files --- +#include "AliStream.h" class AliDigitizer; class AliMergeCombi; +class AliRunLoader; static const Int_t kMaxStreamsToMerge = 4; @@ -38,12 +40,20 @@ public: AliRunDigitizer& operator=(const AliRunDigitizer& dig) {dig.Copy(*this); return (*this);} virtual ~AliRunDigitizer(); + + void ExecuteTask(Option_t* option = 0); + void Exec(Option_t *option) {this->Digitize(option);} + void Digitize(Option_t* option = 0); void AddDigitizer(AliDigitizer *digitizer); + void SetOutputFile(TString fn); TString GetOutputFile() const {return fOutputFileName;} + void SetOutputDir(TString dn) {fOutputDirName = dn;} TString GetOutputDir() const {return fOutputDirName;} - void SetInputStream(Int_t stream, const char *inputName); + + void SetInputStream(Int_t stream, const char *inputName, TString foldername = ""); + void SetFirstOutputEventNr(Int_t i) {fEvent = i;} void SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;} void SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;} @@ -51,25 +61,15 @@ public: Int_t GetOutputEventNr() const {return fEvent;} void SetCombinationFileName(TString fn) {fCombinationFileName = fn;} TString GetCombinationFileName() const {return fCombinationFileName;} - Int_t GetNinputs() const {return fNinputs;} Int_t GetMask(Int_t i) const {return fkMASK[i];} - TTree* GetInputTreeS(Int_t i) const {return fArrayTreeS[i];} - TTree* GetInputTreeH(Int_t i) const {return fArrayTreeH[i];} - void SetInputTreeTPCSBaseName(char * name) { - fTreeTPCSBaseName = name;} - TTree* GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];} - TTree* GetInputTreeTRDS(Int_t i) const {return fArrayTreeTRDS[i];} - TTree* GetTreeD() const {return fTreeD;} - void SetTreeDTPCBaseName(char * name) { - fTreeDTPCBaseName = name;} - TTree* GetTreeDTPC() const {return fTreeDTPC;} - TTree* GetTreeDTRD() const {return fTreeDTRD;} - TTree* GetTreeR() const {return fTreeR;} - void Digitize(Option_t* option = 0); - void Exec(Option_t *option) {this->Digitize(option);} - void ExecuteTask(Option_t* option = 0); - + + Int_t GetNinputs() const {return fNinputs;} + const TString& GetInputFolderName(Int_t i) const; + const char* GetOutputFolderName(); + + + // Nr of particles in all input files for a given event // (as numbered in the output file) Int_t GetNParticles(Int_t event) const; @@ -86,6 +86,7 @@ public: // which was merged to create output event event Int_t GetInputEventNumber(Int_t event, Int_t input) const; + AliStream * GetInputStream(const Int_t index) const { return dynamic_cast(fInputStreams->At(index)) ; } // return pointer to particle with index i (index with mask) TParticle* GetParticle(Int_t i, Int_t event) const; @@ -98,7 +99,7 @@ public: Int_t GetDebug() const {return fDebug;} void SetDebug(Int_t level) {fDebug = level;} - + private: void Copy(AliRunDigitizer& dig) const; Bool_t ConnectInputTrees(); @@ -114,33 +115,31 @@ private: // each input file TString fOutputFileName; // output file name TString fOutputDirName; // output dir name - TFile * fOutput; //! pointer to the output file + Int_t fEvent; // output event nr. Int_t fNrOfEventsToWrite; // Nr of events to write Int_t fNrOfEventsWritten; // Nr of events written Int_t fCopyTreesFromInput; // from which input file the trees // should be copied, -1 for no copies - TTree * fTreeD; //! output TreeD - TTree * fTreeDTPC; //! output TreeD for TPC - TTree * fTreeDTRD; //! output TreeD for TRD - TTree * fTreeR; //! output TreeR for ITS fast points Int_t fNinputs; // nr of input streams - can be taken from the TClonesArray dimension Int_t fNinputsGiven; // nr of input streams given by user - TClonesArray * fInputStreams; // input streams - TFile * fInputFiles[kMaxStreamsToMerge]; //! p. to current input files - TTree * fArrayTreeS[kMaxStreamsToMerge]; //! array with p. to TreeS - TTree * fArrayTreeTPCS[kMaxStreamsToMerge]; //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits) - TTree * fArrayTreeTRDS[kMaxStreamsToMerge]; //! array with p. to TreeSx_TRD (TRD Sdigits) - TTree * fArrayTreeH[kMaxStreamsToMerge]; //! array with p. to TreeH - char * fTreeDTPCBaseName; //! basename of output TreeD for TPC - char * fTreeTPCSBaseName; //! basename of output TreeS for TPC + TClonesArray * fInputStreams; // input signal streams + +// AliStream* fOutputStream; + AliRunLoader* fOutRunLoader; //! + Bool_t fOutputInitialized; //indicates if outout was initialized + // AliMergeCombi * fCombi; // pointer to the combination object TArrayI fCombination; //! combination of events from TString fCombinationFileName; // fn with combinations (used // with type 2 of comb.) Int_t fDebug; //! specifies debug level, 0 is min + + AliRunLoader* GetOutRunLoader(); - ClassDef(AliRunDigitizer,4) + static const TString fgkDefOutFolderName;//default name for output foler + static const TString fgkBaseInFolderName;//default name for input foler + ClassDef(AliRunDigitizer,5) }; #endif // ALIRUNDIGITIZER_H diff --git a/STEER/AliRunLoader.cxx b/STEER/AliRunLoader.cxx new file mode 100644 index 00000000000..c3e7f732dca --- /dev/null +++ b/STEER/AliRunLoader.cxx @@ -0,0 +1,1488 @@ +#include "AliRunLoader.h" +//_____________________________________ +///////////////////////////////////////////////////////////////////////////////////// +// +// class AliRunLoader +// +//This class aims to be the only one interface for manging data +//It stores Loaders for all modules which knows the filenames +//of the data files to be stored. +//It aims to substitude AliRun in automatic maging of data positioning +//thus there won't be necessity of loading gAlice from file in order to +//get fast ccess to the data +// +//logical place for putting the Loader specific to the given detector is detector itself +// but, to load detector one need to load gAlice, and by the way all other detectors +// with their geometrieces and so on. +// So, if one need to open TPC clusters there is no principal need to read everything +// +// When RunLoader is read from the file it does not connect to the folder structure +// it must be connected (mounted) manualy in the macro or class code. +// Default event folder is defined by AliConfig::fgkDefaultEventFolderName +// but can be mounted elsewhere. Usefull specially in merging, when more than session +// needs to be loaded +// +////////////////////////////////////////////////////////////////////////////////////// +/**************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliRun.h" +#include "AliConfig.h" +#include "AliLoader.h" +#include "AliHeader.h" +#include "AliStack.h" +#include "TObjArray.h" +#include "AliDetector.h" +#include "AliRunDigitizer.h" + +ClassImp(AliRunLoader) + +AliRunLoader* AliRunLoader::fgRunLoader = 0x0; + +const TString AliRunLoader::fgkRunLoaderName("RunLoader"); + +const TString AliRunLoader::fgkHeaderBranchName("Header"); +const TString AliRunLoader::fgkHeaderContainerName("TE"); +const TString AliRunLoader::fgkKineContainerName("TreeK"); +const TString AliRunLoader::fgkTrackRefsContainerName("TreeTR"); +const TString AliRunLoader::fgkKineBranchName("Particles"); +const TString AliRunLoader::fgkDefaultKineFileName("Kinematics.root"); +const TString AliRunLoader::fgkDefaultTrackRefsFileName("TrackRefs.root"); +const TString AliRunLoader::fgkGAliceName("gAlice"); +/**************************************************************************/ + +AliRunLoader::AliRunLoader(): + fLoaders(0x0), + fEventFolder(0x0), + fCurrentEvent(0), + fGAFile(0x0), + fHeader(0x0), + fStack(0x0), + fKineDataLoader(0x0), + fTrackRefsDataLoader(0x0), + fNEventsPerFile(1), + fUnixDirName(".") +{ + AliConfig::Instance();//force to build the folder structure +} +/**************************************************************************/ + +AliRunLoader::AliRunLoader(const char* eventfoldername): + TNamed(fgkRunLoaderName,fgkRunLoaderName), + fLoaders(new TObjArray()), + fEventFolder(0x0), + fCurrentEvent(0), + fGAFile(0x0), + fHeader(0x0), + fStack(0x0), + fKineDataLoader(new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics")), + fTrackRefsDataLoader(new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References")), + fNEventsPerFile(1), + fUnixDirName(".") +{ +//ctor + SetEventFolderName(eventfoldername); +} +/**************************************************************************/ + +AliRunLoader::~AliRunLoader() +{ + + UnloadHeader(); + UnloadgAlice(); + + if(fLoaders) { + fLoaders->SetOwner(); + delete fLoaders; + } + + delete fKineDataLoader; + delete fTrackRefsDataLoader; + + + RemoveEventFolder(); + + //fEventFolder is deleted by the way of removing - TopAliceFolder owns it + delete fHeader; + delete fStack; + delete fGAFile; +} +/**************************************************************************/ + +AliRunLoader::AliRunLoader(TFolder* topfolder):TNamed(fgkRunLoaderName,fgkRunLoaderName) +{ + if(topfolder == 0x0) + { + Fatal("AliRunLoader(TFolder*)","Parameter is NULL"); + return; + } + fEventFolder = topfolder; + + TObject* obj = fEventFolder->FindObject(fgkRunLoaderName); + if (obj) + { //if it is, then sth. is going wrong... exits aliroot session + Fatal("AliRunLoader(const char*)", + "In Event Folder Named %s object named %s already exists. I am confused ...", + fEventFolder->GetName(),fgkRunLoaderName.Data()); + return;//never reached + } + + fLoaders = new TObjArray(); + fEventFolder->Add(this);//put myself to the folder to accessible for all + +} +/**************************************************************************/ + +Int_t AliRunLoader::GetEvent(Int_t evno) +{ +//Gets event number evno +//Reloads all data properly + if (fCurrentEvent == evno) return 0; + + if (evno < 0) + { + Error("GetEvent","Can not give the event with negative number"); + return 4; + } + + if (evno >= GetNumberOfEvents()) + { + Error("GetEvent","There is no event with number %d",evno); + return 3; + } + + if (GetDebug()) + { + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("GetEvent"," GETTING EVENT %d",evno); + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } + + fCurrentEvent = evno; + + Int_t retval; + + //Reload header (If header was loaded) + if (GetHeader()) + { + retval = TreeE()->GetEvent(fCurrentEvent); + if ( retval == 0) + { + Error("GetEvent","Cannot find event: %d\n ",fCurrentEvent); + return 5; + } + } + //Reload stack (If header was loaded) + if (TreeE()) fStack = GetHeader()->Stack(); + //Set event folder in stack (it does not mean that we read kinematics from file) + if (fStack) + { + fStack->SetEventFolderName(fEventFolder->GetName()); + } + else + { + Warning("GetEvent","Stack not found in header"); + } + + retval = SetEvent(); + if (retval) + { + Error("GetEvent","Error occured while setting event %d",evno); + return 1; + } + + //Post Track References + retval = fTrackRefsDataLoader->GetEvent(); + if (retval) + { + Error("GetEvent","Error occured while GetEvent for Track References. Event %d",evno); + return 2; + } + + //Read Kinematics if loaded + fKineDataLoader->GetEvent(); + if (retval) + { + Error("GetEvent","Error occured while GetEvent for Kinematics. Event %d",evno); + return 2; + } + + if (fStack && fKineDataLoader->GetBaseLoader(0)->IsLoaded()) fStack->GetEvent(); + + //Trigger data reloading in all loaders + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + retval = loader->GetEvent(); + if (retval) + { + Error("GetEvent","Error occured while getting event for %s. Event %d.", + loader->GetDetectorName().Data(), evno); + return 3; + } + } + + SetDetectorAddresses(); + + return 0; +} +/**************************************************************************/ +Int_t AliRunLoader::SetEvent() +{ + //if kinematocs was loaded Cleans folder data + //change + Int_t retval; + + retval = fKineDataLoader->SetEvent(); + if (retval) + { + Error("SetEvent","SetEvent for Kinamtics Data Loader retutned error."); + return retval; + } + retval = fTrackRefsDataLoader->SetEvent(); + if (retval) + { + Error("SetEvent","SetEvent for Track References Data Loader retutned error."); + return retval; + } + + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + retval = loader->SetEvent(); + if (retval) + { + Error("SetEvent","SetEvent for %s Data Loader retutned error.",loader->GetName()); + return retval; + } + } + + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::SetEventNumber(Int_t evno) +{ + //cleans folders and sets the root dirs in files + if (fCurrentEvent == evno) return 0; + fCurrentEvent = evno; + return SetEvent(); +} + +/**************************************************************************/ +AliRunLoader* AliRunLoader::Open + (const char* filename, const char* eventfoldername, Option_t* option) +{ +//Opens a desired file 'filename' +//gets the the run-Loader and mounts it desired folder +//returns the pointer to run Loader which can be further used for accessing data +//in case of error returns NULL + + static const TString webaddress("http://alisoft.cern.ch/people/skowron/codedoc/split/index.html"); + if (AliLoader::fgDebug) + ::Info("AliRunLoader::Open", + "\n\n\nNew I/O strcture: See more info:\n %s\n\n\n",webaddress.Data()); + + AliRunLoader* result = 0x0; + + /* ************************************************ */ + /* Chceck if folder with given name already exists */ + /* ************************************************ */ + + TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername); + if(obj) + { + TFolder* fold = dynamic_cast(obj); + if (fold == 0x0) + { + ::Error("AliRunLoader::Open","Such a obejct already exists in top alice folder and it is not a folder."); + return 0x0; + } + + //check if we can get RL from that folder + result = AliRunLoader::GetRunLoader(eventfoldername); + if (result == 0x0) + { + ::Error("AliRunLoader::Open", + "Folder %s already exists, and can not find session there. Can not mount.",eventfoldername); + return 0x0; + } + + if (result->GetFileName().CompareTo(filename) != 0) + { + ::Error("AliRunLoader::Open","Other file is mounted in demanded folder. Can not mount."); + return 0x0; + } + + //check if now is demanded (re)creation + if ( AliLoader::TestFileOption(option) == kFALSE) + { + ::Error("AliRunLoader::Open", + "Session already exists in folder %s and this session option is %s. Unable to proceed.", + eventfoldername,option); + return 0x0; + } + + //check if demanded option is update and existing one + TString tmpstr(option); + if ( (tmpstr.CompareTo("update",TString::kIgnoreCase) == 0) && + (result->fGAFile->IsWritable() == kFALSE) ) + { + ::Error("AliRunLoader::Open", + "Session already exists in folder %s and is not writable while this session option is %s. Unable to proceed.", + eventfoldername,option); + return 0x0; + } + + ::Warning("AliRunLoader::Open","Session is already opened and mounted in demanded folder"); + return result; + } //end of checking in case of existance of object named identically that folder session is being opened + + + TFile * gAliceFile = TFile::Open(filename,option);//open a file + if (!gAliceFile) + {//null pointer returned + ::Error("AliRunLoader::Open","Can not open file %s.",filename); + return 0x0; + } + + if (gAliceFile->IsOpen() == kFALSE) + {//pointer to valid object returned but file is not opened + ::Error("AliRunLoader::Open","Can not open file %s.",filename); + return 0x0; + } + + //if file is "read" or "update" than we try to find AliRunLoader there - if not found cry and exit + //else create new AliRunLoader + if ( AliLoader::TestFileOption(option) ) + { + if (AliLoader::fgDebug) + ::Info("AliRunLoader::Open","Reading RL from file"); + + result = dynamic_cast(gAliceFile->Get(fgkRunLoaderName));//get the run Loader from the file + if (result == 0x0) + {//didn't get + ::Error("AliRunLoader::Open","Can not find run-Loader in file %s.",filename); + delete gAliceFile;//close the file + return 0x0; + } + Int_t tmp = result->SetEventFolderName(eventfoldername);//mount a event folder + if (tmp)//if SetEvent returned error + { + ::Error("AliRunLoader::Open","Can not mount event in folder %s.",eventfoldername); + delete result; //delete run-Loader + delete gAliceFile;//close the file + return 0x0; + } + } + else + { + if (AliLoader::fgDebug) + ::Info("AliRunLoader::Open","Creating new AliRunLoader. Folder name is %s",eventfoldername); + result = new AliRunLoader(eventfoldername); + } + +//procedure for extracting dir name from the file name + TString fname(filename); + Int_t nsl = fname.Last('/');//look for slash in file name + TString dirname; + if (nsl < 0) + {//slash not found + Int_t nsl = fname.Last(':');//look for colon e.g. rfio:galice.root + if (nsl < 0) dirname = ".";//not found + else dirname = fname.Remove(nsl);//found + } + else dirname = fname.Remove(nsl);//slash found + + if (AliLoader::fgDebug) + ::Info("AliRunLoader::Open","Dir name is : %s",dirname.Data()); + + result->SetDirName(dirname); + result->SetGAliceFile(gAliceFile);//set the pointer to gAliceFile + fgRunLoader = result; //PH get access from any place + return result; +} +/**************************************************************************/ +Int_t AliRunLoader::GetNumberOfEvents() +{ + //returns number of events in Run + Int_t retval; + if( TreeE() == 0x0 ) + { + retval = LoadHeader(); + if (retval) + { + Error("GetNumberOfEvents","Error occured while loading header"); + return -1; + } + } + return (Int_t)TreeE()->GetEntries(); +} + +/**************************************************************************/ +void AliRunLoader::MakeHeader() +{ + //Makes header and connects it to header tree (if it exists) + if (GetDebug()) Info("MakeHeader",""); + if(fHeader == 0x0) + { + if (GetDebug()) Info("MakeHeader","Creating new Header Object"); + fHeader= new AliHeader(); + } + TTree* tree = TreeE(); + if (tree) + { + if (GetDebug()) Info("MakeHeader","Got Tree from folder."); + TBranch* branch = tree->GetBranch(fgkHeaderBranchName); + if (branch == 0x0) + { + if (GetDebug()) Info("MakeHeader","Creating new branch"); + branch = tree->Branch(fgkHeaderBranchName, "AliHeader", &fHeader, 4000, 0); + branch->SetAutoDelete(kFALSE); + } + else + { + if (GetDebug()) Info("MakeHeader","Got Branch from Tree"); + branch->SetAddress(&fHeader); + tree->GetEvent(fCurrentEvent); + fStack = fHeader->Stack(); //should be safe - if we created Stack, header returns pointer to the same object + if (fStack) + { + fStack->SetEventFolderName(fEventFolder->GetName()); + if (TreeK()) fStack->GetEvent(); + } + else + { + if (GetDebug()) Info("MakeHeader","Haeder do not have a stack."); + } + } + } + if (GetDebug()) Info("MakeHeader","Exiting MakeHeader method"); +} +/**************************************************************************/ + +void AliRunLoader::MakeStack() +{ +//Creates the stack object - do not connect the tree + if(fStack == 0x0) + { + fStack = new AliStack(10000); + fStack->SetEventFolderName(fEventFolder->GetName()); + } +} + +/**************************************************************************/ + +void AliRunLoader::MakeTree(Option_t *option) +{ +//Creates trees + const char *oK = strstr(option,"K"); //Kine + const char *oE = strstr(option,"E"); //Header + + if(oK && !TreeK()) + { + if (fKineDataLoader->GetBaseLoader(0)->IsLoaded() == kFALSE) + { + Error("MakeTree(\"K\")","Load Kinematics first"); + } + else + { + fKineDataLoader->MakeTree(); + MakeStack(); + fStack->ConnectTree(); + WriteKinematics("OVERWRITE"); + } + } + + if(oE && !TreeE()) + { + fGAFile->cd(); + TTree* tree = new TTree(fgkHeaderContainerName,"Tree with Headers"); + GetEventFolder()->Add(tree); + MakeHeader(); + WriteHeader("OVERWRITE"); + } + + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->MakeTree(option); + } + +} +/**************************************************************************/ + +Int_t AliRunLoader::LoadgAlice() +{ +//Loads gAlice from file + if (GetAliRun()) + { + Warning("LoadgAlice","AliRun is already in folder. Unload first."); + return 0; + } + AliRun* alirun = dynamic_cast(fGAFile->Get(fgkGAliceName)); + if (alirun == 0x0) + { + Error("LoadgAlice"," Can not find gAlice in file %s",fGAFile->GetName()); + return 2; + } + alirun->SetRunLoader(this); + if (gAlice) + { + Warning("LoadgAlice","gAlice already exists. Putting retrived object in folder named %s", + GetEventFolder()->GetName()); + } + else + { + gAlice = alirun; + } + SetDetectorAddresses();//calls SetTreeAddress for all detectors + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::LoadHeader() +{ + if (TreeE()) + { + Warning("LoadHeader","Header is already loaded. Use ReloadHeader to force reload. Nothing done"); + return 0; + } + + if (GetEventFolder() == 0x0) + { + Error("LoadHaeder","Event folder not specified yet"); + return 1; + } + + if (fGAFile == 0x0) + { + Error("LoadHaeder","Session not opened. Use AliRunLoader::Open"); + return 2; + } + + if (fGAFile->IsOpen() == kFALSE) + { + Error("LoadHaeder","Session not opened. Use AliRunLoader::Open"); + return 2; + } + + TTree* tree = dynamic_cast(fGAFile->Get(fgkHeaderContainerName)); + if (tree == 0x0) + { + Fatal("LoadHaeder","Can not find header tree named %s in file %s", + fgkHeaderContainerName.Data(),fGAFile->GetName()); + return 2; + } + + if (tree == TreeE()) return 0; + + CleanHeader(); + GetEventFolder()->Add(tree); + MakeHeader();//creates header object and connects to tree + return 0; + +} +/**************************************************************************/ + +Int_t AliRunLoader::LoadKinematics(Option_t* option) +{ +//Loads the kinematics + Int_t retval = fKineDataLoader->GetBaseLoader(0)->Load(option); + if (retval) + { + Error("LoadKinematics","Error occured while loading kinamatics tree."); + return retval; + } + if (fStack) fStack->GetEvent(); + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl) +{ +//Opens File with kinematics + if (file) + { + if (file->IsOpen() == kFALSE) + {//pointer is not null but file is not opened + Warning("OpenDataFile","Pointer to file is not null, but file is not opened");//risky any way + delete file; + file = 0x0; //proceed with opening procedure + } + else + { + Warning("OpenDataFile","File %s already opened",filename.Data()); + return 0; + } + } +//try to find if that file is opened somewere else + file = (TFile *)( gROOT->GetListOfFiles()->FindObject(filename) ); + if (file) + { + if(file->IsOpen() == kTRUE) + { + Warning("OpenDataFile","File %s already opened by sombody else.",file->GetName()); + return 0; + } + } + + file = TFile::Open(filename,opt); + if (file == 0x0) + {//file is null + Error("LoadKinematics","Can not open file %s",filename.Data()); + return 1; + } + if (file->IsOpen() == kFALSE) + {//file is not opened + Error("LoadKinematics","Can not open file %s",filename.Data()); + return 1; + } + + file->SetCompressionLevel(cl); + + dir = AliLoader::ChangeDir(file,fCurrentEvent); + if (dir == 0x0) + { + Error("OpenKineFile","Can not change to root directory in file %s",filename.Data()); + return 3; + } + return 0; +} +/**************************************************************************/ + +TTree* AliRunLoader::TreeE() const +{ + //returns the tree from folder; shortcut method + TObject *obj = fEventFolder->FindObject(fgkHeaderContainerName); + return (obj)?dynamic_cast(obj):0x0; +} +/**************************************************************************/ + +AliHeader* AliRunLoader::GetHeader() const +{ + return fHeader; +} +/**************************************************************************/ + +TTree* AliRunLoader::TreeK() const +{ + //returns the tree from folder; shortcut method + TObject *obj = GetEventFolder()->FindObject(fgkKineContainerName); + return (obj)?dynamic_cast(obj):0x0; +} +/**************************************************************************/ + +TTree* AliRunLoader::TreeTR() const +{ + //returns the tree from folder; shortcut method + TObject* obj = GetEventFolder()->FindObject(fgkTrackRefsContainerName); + return (obj)?dynamic_cast(obj):0x0; +} +/**************************************************************************/ + +AliRun* AliRunLoader::GetAliRun() const +{ +//returns AliRun which sits in the folder + if (fEventFolder == 0x0) return 0x0; + TObject *obj = fEventFolder->FindObject(fgkGAliceName); + return (obj)?dynamic_cast(obj):0x0; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteGeometry(Option_t* opt) +{ + fGAFile->cd(); + TGeometry* geo = GetAliRun()->GetGeometry(); + if (geo == 0x0) + { + Error("WriteGeometry","Can not get geometry from gAlice"); + return 1; + } + geo->Write(); + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteHeader(Option_t* opt) +{ + if (GetDebug()) Info("WriteHeader"," WRITING HEADER"); + + TTree* tree = TreeE(); + if ( tree == 0x0) + { + Warning("WriteHeader","Can not find Header Tree in Folder"); + return 0; + } + if (fGAFile->IsWritable() == kFALSE) + { + Error("WriteHeader","File %s is not writable",fGAFile->GetName()); + return 1; + } + + TObject* obj = fGAFile->Get(fgkHeaderContainerName); + if (obj) + { //if they exist, see if option OVERWRITE is used + TString tmp(opt); + if(tmp.Contains("OVERWRITE",TString::kIgnoreCase) == 0) + {//if it is not used - give an error message and return an error code + Error("WriteHeader","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data"); + return 3; + } + } + fGAFile->cd(); + tree->SetDirectory(fGAFile); + tree->Write(0,TObject::kOverwrite); + + if (GetDebug()) Info("WriteHeader","WRITTEN\n\n"); + + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteAliRun(Option_t* opt) +{ + fGAFile->cd(); + if (gAlice) gAlice->Write(); + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteKinematics(Option_t* opt) +{ + return fKineDataLoader->GetBaseLoader(0)->WriteData(opt); +} +/**************************************************************************/ +Int_t AliRunLoader::WriteTrackRefs(Option_t* opt) +{ + return fTrackRefsDataLoader->GetBaseLoader(0)->WriteData(opt); +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteHits(Option_t* opt) +{ +//Calls WriteHits for all loaders + Int_t res; + Int_t result = 0; + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + res = loader->WriteHits(opt); + if (res) + { + Error("WriteHits","Failed to write hits for %s (%d)",loader->GetDetectorName().Data(),res); + result = 1; + } + } + return result; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteSDigits(Option_t* opt) +{ + Int_t res; + Int_t result = 0; + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + res = loader->WriteSDigits(opt); + if (res) + { + Error("WriteSDigits","Failed to write summable digits for %s.",loader->GetDetectorName().Data()); + result = 1; + } + } + return result; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteDigits(Option_t* opt) +{ + Int_t res; + Int_t result = 0; + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + res = loader->WriteDigits(opt); + if (res) + { + Error("WriteDigits","Failed to write digits for %s.",loader->GetDetectorName().Data()); + result = 1; + } + } + return result; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteRecPoints(Option_t* opt) +{ + Int_t res; + Int_t result = 0; + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + res = loader->WriteRecPoints(opt); + if (res) + { + Error("WriteRecPoints","Failed to write Reconstructed Points for %s.", + loader->GetDetectorName().Data()); + result = 1; + } + } + return result; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteTracks(Option_t* opt) +{ + Int_t res; + Int_t result = 0; + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + res = loader->WriteTracks(opt); + if (res) + { + Error("WriteTracks","Failed to write Tracks for %s.", + loader->GetDetectorName().Data()); + result = 1; + } + } + return result; +} +/**************************************************************************/ + +Int_t AliRunLoader::WriteRunLoader(Option_t* opt) +{ + CdGAFile(); + this->Write(0,TObject::kOverwrite); + return 0; +} +/**************************************************************************/ + +Int_t AliRunLoader::SetEventFolderName(const TString& name) +{ //sets top folder name for this run; of alread + if (name.IsNull()) + { + Error("SetTopFolderName","Name is empty"); + return 1; + } + + //check if such a folder already exists - try to find it in alice top folder + TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(name); + if(obj) + { + TFolder* fold = dynamic_cast(obj); + if (fold == 0x0) + { + Error("SetTopFolderName","Such a obejct already exists in top alice folder and it is not a folder."); + return 2; + } + //folder which was found is our folder + if (fEventFolder == fold) + { + return 0; + } + else + { + Error("SetTopFolderName","Such a folder already exists in top alice folder. Can not mount."); + return 2; + } + } + + //event is alredy connected, just change name of the folder + if (fEventFolder) + { + fEventFolder->SetName(name); + return 0; + } + + if (fKineDataLoader == 0x0) + fKineDataLoader = new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics"); + + if ( fTrackRefsDataLoader == 0x0) + fTrackRefsDataLoader = new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References"); + + //build the event folder structure + if (GetDebug()) Info("SetEventFolderName","Creating new event folder named %s",name.Data()); + fEventFolder = AliConfig::Instance()->BuildEventFolder(name,"Event Folder"); + fEventFolder->Add(this);//put myself to the folder to accessible for all + + if (Stack()) Stack()->SetEventFolderName(fEventFolder->GetName()); + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->Register(fEventFolder);//build folder structure for this detector + } + + fKineDataLoader->SetEventFolder(GetEventFolder()); + fTrackRefsDataLoader->SetEventFolder(GetEventFolder()); + fKineDataLoader->SetFolder(GetEventFolder()); + fTrackRefsDataLoader->SetFolder(GetEventFolder()); + + fEventFolder->SetOwner(); + return 0; +} +/**************************************************************************/ + +void AliRunLoader::AddLoader(AliLoader* loader) + { + //Adds the Loader for given detector + if (loader == 0x0) //if null shout and exit + { + Error("AddLoader","Parameter is NULL"); + return; + } + loader->SetDirName(fUnixDirName); + if (fEventFolder) loader->SetEventFolder(fEventFolder); //if event folder is already defined, + //pass information to the Loader + fLoaders->Add(loader);//add the Loader to the array + } +/**************************************************************************/ + +void AliRunLoader::AddLoader(AliDetector* det) + { +//Asks module (detector) ro make a Loader and stores in the array + if (det == 0x0) return; + AliLoader* get = det->GetLoader();//try to get loader + if (get == 0x0) get = det->MakeLoader(fEventFolder->GetName());//if did not obtain, ask to make it + + if (get) + { + if (GetDebug()) Info("AddLoader","Detector: %s Loader : %s",det->GetName(),get->GetName()); + AddLoader(get); + } + } + +/**************************************************************************/ + +AliLoader* AliRunLoader::GetLoader(const char* detname) const +{ + return (AliLoader*)fLoaders->FindObject(detname); +} + +/**************************************************************************/ + +AliLoader* AliRunLoader::GetLoader(AliDetector* det) const +{ + if(det == 0x0) return 0x0; + TString getname(det->GetName()); + getname+="Loader"; + if (GetDebug()) Info("GetLoader(AliDetector* det)"," Loader name is %s",getname.Data()); + return GetLoader(getname); +} + +/**************************************************************************/ + +void AliRunLoader::CleanFolders() +{ +// fEventFolder->Add(this);//put myself to the folder to accessible for all + + CleanDetectors(); + CleanHeader(); + CleanKinematics(); +} +/**************************************************************************/ + +void AliRunLoader::CleanDetectors() +{ +//Calls CleanFolders for all detectors + TIter next(fLoaders); + AliLoader *Loader; + while((Loader = (AliLoader*)next())) + { + Loader->CleanFolders(); + } +} +/**************************************************************************/ + +void AliRunLoader::RemoveEventFolder() +{ +//remove all the tree of event +//all the stuff changing EbE stays untached (PDGDB, tasks, etc.) + + if (fEventFolder == 0x0) return; + fEventFolder->SetOwner(kFALSE);//don't we want to deleted while removing the folder that we are sitting in + fEventFolder->Remove(this);//remove us drom folder + + AliConfig::Instance()->GetTopFolder()->SetOwner(); //brings ownership back for fEventFolder since it sits in top folder + AliConfig::Instance()->GetTopFolder()->Remove(fEventFolder); //remove the event tree + delete fEventFolder; +} +/**************************************************************************/ + +void AliRunLoader::SetGAliceFile(TFile* gafile) +{ + fGAFile = gafile; +} + +/**************************************************************************/ + +Int_t AliRunLoader::LoadHits(Option_t* detectors,Option_t* opt) +{ +//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all" + + if (GetDebug()) Info("LoadHits","Loading Hits"); + TObjArray* loaders; + TObjArray arr; + + const char* oAll = strstr(detectors,"all"); + if (oAll) + { + if (GetDebug()) Info("LoadHits","Option is All"); + loaders = fLoaders; + } + else + { + GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option + loaders = &arr;//get the pointer array + } + + if (GetDebug()) Info("LoadHits","For detectors. Number of detectors chosen for loading %d",loaders->GetEntries()); + + TIter next(loaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + if (GetDebug()) Info("LoadHits"," Calling LoadHits(%s) for %s",opt,loader->GetName()); + loader->LoadHits(opt); + } + if (GetDebug()) Info("LoadHits","Done"); + return 0; +} + +/**************************************************************************/ + +Int_t AliRunLoader::LoadSDigits(Option_t* detectors,Option_t* opt) +{ +//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all" + + TObjArray* loaders; + TObjArray arr; + + const char* oAll = strstr(detectors,"all"); + if (oAll) + { + loaders = fLoaders; + } + else + { + GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option + loaders = &arr;//get the pointer array + } + + TIter next(loaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->LoadSDigits(opt); + } + return 0; +} + +/**************************************************************************/ + +Int_t AliRunLoader::LoadDigits(Option_t* detectors,Option_t* opt) +{ +//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all" + + TObjArray* Loaders; + TObjArray arr; + + const char* oAll = strstr(detectors,"all"); + if (oAll) + { + Loaders = fLoaders; + } + else + { + GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option + Loaders = &arr;//get the pointer array + } + + TIter next(Loaders); + AliLoader *Loader; + while((Loader = (AliLoader*)next())) + { + Loader->LoadDigits(opt); + } + return 0; +} + +/**************************************************************************/ + +Int_t AliRunLoader::LoadRecPoints(Option_t* detectors,Option_t* opt) +{ +//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all" + + TObjArray* Loaders; + TObjArray arr; + + const char* oAll = strstr(detectors,"all"); + if (oAll) + { + Loaders = fLoaders; + } + else + { + GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option + Loaders = &arr;//get the pointer array + } + + TIter next(Loaders); + AliLoader *Loader; + while((Loader = (AliLoader*)next())) + { + Loader->LoadRecPoints(opt); + } + return 0; +} + +/**************************************************************************/ + +Int_t AliRunLoader::LoadTracks(Option_t* detectors,Option_t* opt) +{ +//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all" + + TObjArray* Loaders; + TObjArray arr; + + const char* oAll = strstr(detectors,"all"); + if (oAll) + { + Loaders = fLoaders; + } + else + { + GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option + Loaders = &arr;//get the pointer array + } + + TIter next(Loaders); + AliLoader *Loader; + while((Loader = (AliLoader*)next())) + { + Loader->LoadTracks(opt); + } + return 0; +} + +/**************************************************************************/ + +AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername) + { + TFolder* evfold= dynamic_cast(AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername)); + if (evfold == 0x0) + { + return 0x0; + } + AliRunLoader* runget = dynamic_cast(evfold->FindObject(AliRunLoader::fgkRunLoaderName)); + return runget; + + } +/**************************************************************************/ + +void AliRunLoader::CdGAFile() +{ +//sets gDirectory to galice file +//work around + if(fGAFile) fGAFile->cd(); +} + +/**************************************************************************/ + +void AliRunLoader::GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const + { +//this method looks for all Loaders corresponding +//to names (many) specified in namelist i.e. namelist ("ITS TPC TRD") + + char buff[10]; + char dets [200]; + strcpy(dets,namelist);//compiler cries when char* = const Option_t*; + dets[strlen(dets)+1] = '\n';//set endl at the end of string + char* pdet = dets; + Int_t tmp; + for(;;) + { + tmp = sscanf(pdet,"%s",buff);//read the string from the input string pdet into buff + if ( (buff[0] == 0) || (tmp == 0) ) break; //if not read + + pdet = strstr(pdet,buff) + strlen(buff);;//move the input pointer about number of bytes (letters) read + //I am aware that is a little complicated. I don't know the number of spaces between detector names + //so I read the string, than I find where it starts (strstr) and move the pointer about length of a string + //If there is a better way, please write me (Piotr.Skowronski@cern.ch) + //construct the Loader name + TString getname(buff); + getname+="Loader"; + AliLoader* loader = GetLoader(getname);//get the Loader + if (loader) + { + pointerarray.Add(loader); + } + else + { + Error("GetListOfDetectors","Can not find Loader for %s",buff); + } + + buff[0] = 0; + } + } +/*****************************************************************************/ + +void AliRunLoader::Clean(const TString& name) +{ +//removes object with given name from event folder and deletes it + if (GetEventFolder() == 0x0) return; + TObject* obj = GetEventFolder()->FindObject(name); + if(obj) + { + if (GetDebug()) Info("Clean(const TString&)","name=%s, cleaning %s.",GetName(),name.Data()); + GetEventFolder()->Remove(obj); + delete obj; + } +} + +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunDigitizer() +{ +//returns Run Digitizer from folder + + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetDigitizerTaskName()); + return (obj)?dynamic_cast(obj):0x0; +} +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunSDigitizer() +{ +//returns SDigitizer Task from folder + + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetSDigitizerTaskName()); + return (obj)?dynamic_cast(obj):0x0; +} +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunReconstructioner() +{ +//returns Reconstructioner Task from folder + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetReconstructionerTaskName()); + return (obj)?dynamic_cast(obj):0x0; +} +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunTracker() +{ +//returns Tracker Task from folder + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetTrackerTaskName()); + return (obj)?dynamic_cast(obj):0x0; +} +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunPIDTask() +{ +//returns Tracker Task from folder + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetPIDTaskName()); + return (obj)?dynamic_cast(obj):0x0; +} +/*****************************************************************************/ + +TTask* AliRunLoader::GetRunQATask() +{ +//returns Quality Assurance Task from folder + TFolder* topf = AliConfig::Instance()->GetTaskFolder(); + if (topf == 0x0) + { + ::Error("AliRunLoader::GetRunQATask","Can not get task folder from AliConfig"); + return 0x0; + } + TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetQATaskName()); + return (obj)?dynamic_cast(obj):0x0; +} + +/*****************************************************************************/ + +void AliRunLoader::SetCompressionLevel(Int_t cl) +{ +//Sets Compression Level in all files + if (fGAFile) fGAFile->SetCompressionLevel(cl); + SetKineComprLevel(cl); + SetTrackRefsComprLevel(cl); + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->SetCompressionLevel(cl); + } +} +/**************************************************************************/ + +void AliRunLoader::SetKineComprLevel(Int_t cl) +{ +//Sets comression level in Kine File + fKineDataLoader->SetCompressionLevel(cl); +} +/**************************************************************************/ + +void AliRunLoader::SetTrackRefsComprLevel(Int_t cl) +{ +//Sets comression level in Track Refences File + fTrackRefsDataLoader->SetCompressionLevel(cl); +} +/**************************************************************************/ + +void AliRunLoader::UnloadHeader() +{ + //removes TreeE from folder and deletes it + // as well as fHeader object + CleanHeader(); + delete fHeader; + fHeader = 0x0; +} +/**************************************************************************/ + +void AliRunLoader::UnloadKinematics() +{ + fKineDataLoader->GetBaseLoader(0)->Unload(); +} +/**************************************************************************/ + +void AliRunLoader::UnloadTrackRefs() +{ + fTrackRefsDataLoader->GetBaseLoader(0)->Unload(); +} +/**************************************************************************/ + +void AliRunLoader::UnloadgAlice() +{ + if (gAlice == GetAliRun()) + { + if (GetDebug()) Info("UnloadgAlice","Set gAlice = 0x0"); + gAlice = 0x0;//if gAlice is the same that in folder (to be deleted by the way of folder) + } + AliRun* alirun = GetAliRun(); + if (GetEventFolder()) GetEventFolder()->Remove(alirun); + delete alirun; +} +/**************************************************************************/ + +void AliRunLoader::MakeTrackRefsContainer() +{ +// Makes a tree for Track References + fTrackRefsDataLoader->MakeTree(); +} +/**************************************************************************/ + +Int_t AliRunLoader::LoadTrackRefs(Option_t* option) +{ +//Load track references from file (opens file and posts tree to folder) + + return fKineDataLoader->GetBaseLoader(0)->Load(option); +} +/**************************************************************************/ + +void AliRunLoader::SetDirName(TString& dirname) +{ +//sets directory name + if (dirname.IsNull()) return; + fUnixDirName = dirname; + fKineDataLoader->SetDirName(dirname); + fTrackRefsDataLoader->SetDirName(dirname); + + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->SetDirName(dirname); + } + +} +/*****************************************************************************/ + +Int_t AliRunLoader::GetFileOffset() const +{ + return Int_t(fCurrentEvent/fNEventsPerFile); +} + +/*****************************************************************************/ +const TString AliRunLoader::SetFileOffset(const TString& fname) +{ + Long_t offset = (Long_t)GetFileOffset(); + if (offset < 1) return fname; + TString soffset; + soffset += offset;//automatic conversion to string + TString dotroot(".root"); + const TString& offfsetdotroot = offset + dotroot; + TString out = fname; + out = out.ReplaceAll(dotroot,offfsetdotroot); + if (GetDebug()) Info("SetFileOffset"," in=%s out=%s",fname.Data(),out.Data()); + return out; +} +/*****************************************************************************/ + +void AliRunLoader::SetDigitsFileNameSuffix(const TString& suffix) +{ +//adds the suffix before ".root", +//e.g. TPC.Digits.root -> TPC.DigitsMerged.root +//made on Jiri Chudoba demand + + TIter next(fLoaders); + AliLoader *Loader; + while((Loader = (AliLoader*)next())) + { + Loader->SetDigitsFileNameSuffix(suffix); + } +} +/*****************************************************************************/ + +TString AliRunLoader::GetFileName() const +{ +//returns name of galice file + TString result; + if (fGAFile == 0x0) return result; + result = fGAFile->GetName(); + return result; +} +/*****************************************************************************/ + +void AliRunLoader::SetDetectorAddresses() +{ + //calls SetTreeAddress for all detectors + if (GetAliRun()==0x0) return; + TIter next(GetAliRun()->Modules()); + AliModule* mod; + while((mod = (AliModule*)next())) + { + AliDetector* det = dynamic_cast(mod); + if (det) det->SetTreeAddress(); + } +} +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ diff --git a/STEER/AliRunLoader.h b/STEER/AliRunLoader.h new file mode 100644 index 00000000000..e34bc73de68 --- /dev/null +++ b/STEER/AliRunLoader.h @@ -0,0 +1,222 @@ +#ifndef ALIRUNLoader_H +#define ALIRUNLoader_H + +//___________________________________________________________________ +///////////////////////////////////////////////////////////////////// +// // +// class AliRunLoader // +// // +// This class aims to be the only one interface for manging data // +// It stores Loaders for all modules which knows the filenames // +// of the data files to be stored. // +// It aims to substitude AliRun in automatic managing of data // +// positioning thus there won't be necessity of loading gAlice // +// from file in order to get fast access to the data // +// // +// Logical place to put the specific Loader to the given // +// detector is detector itself (i.e ITSLoader in ITS). // +// But, to load detector object one need to load gAlice, and // +// by the way all other detectors with their geometrieces and // +// so on. So, if one need to open TPC clusters there is no // +// principal nedd to read everything. // +// // +///////////////////////////////////////////////////////////////////// + +#include +#include +#include "AliConfig.h" +#include "AliLoader.h" +#include "AliDataLoader.h" + +class TString; +class TFolder; +class TObjArray; +class TTree; +class TTask; +class TParticle; + +class AliRun; +class AliLoader; +class AliDetector; +class AliHeader; +class AliStack; +class AliRunDigitizer; + + +class AliRunLoader: public TNamed +{ + public: + + AliRunLoader(); + AliRunLoader(const char* topfoldername); + AliRunLoader(TFolder* topfolder); + + virtual ~AliRunLoader(); + + static AliRunLoader* Open(const char* filename = "galice.root", + const char* eventfoldername = AliConfig::fgkDefaultEventFolderName, + Option_t* option = "READ"); + + Int_t GetEventNumber() const {return fCurrentEvent;} + + Int_t GetEvent(Int_t evno);//sets the event number and reloads data in folders properly + Int_t GetNextEvent(){return GetEvent(fCurrentEvent+1);}//gets next event + Int_t SetEventNumber(Int_t evno); //cleans folders and sets the root dirs in files (do not reload data) + Int_t SetNextEvent(){return SetEventNumber(fCurrentEvent+1);} + + Int_t GetNumberOfEvents(); + + void MakeTree(Option_t *option); + void MakeHeader(); + void MakeStack(); + + Int_t LoadgAlice(); + Int_t LoadHeader(); + Int_t LoadKinematics(Option_t* option = "READ"); + Int_t LoadTrackRefs(Option_t* option = "READ"); + + void UnloadHeader(); + void UnloadKinematics(); + void UnloadgAlice(); + void UnloadTrackRefs(); + + void SetKineFileName(const TString& fname){fKineDataLoader->SetFileName(fname);} + void SetTrackRefsFileName(const TString& fname){fTrackRefsDataLoader->SetFileName(fname);} + + TTree* TreeE() const; //returns the tree from folder; shortcut method + AliHeader* GetHeader() const; + + AliStack* Stack() const {return fStack;} + + TTree* TreeK() const; //returns the tree from folder; shortcut method + TTree* TreeTR() const; //returns the tree from folder; shortcut method + + AliRun* GetAliRun()const; + + Int_t WriteGeometry(Option_t* opt=""); + Int_t WriteHeader(Option_t* opt=""); + Int_t WriteAliRun(Option_t* opt=""); + Int_t WriteKinematics(Option_t* opt=""); + Int_t WriteTrackRefs(Option_t* opt=""); + Int_t WriteRunLoader(Option_t* opt=""); + + Int_t WriteHits(Option_t* opt=""); + Int_t WriteSDigits(Option_t* opt=""); + Int_t WriteDigits(Option_t* opt=""); + Int_t WriteRecPoints(Option_t* opt=""); + Int_t WriteTracks(Option_t* opt=""); + + Int_t LoadHits(Option_t* detectors = "all",Option_t* opt = "RAED"); + Int_t LoadSDigits(Option_t* detectors = "all",Option_t* opt = "RAED"); + Int_t LoadDigits(Option_t* detectors = "all",Option_t* opt = "RAED"); + Int_t LoadRecPoints(Option_t* detectors = "all",Option_t* opt = "RAED"); + Int_t LoadTracks(Option_t* detectors = "all",Option_t* opt = "RAED"); + + + void AddLoader(AliLoader* loader); + void AddLoader(AliDetector* det); + AliLoader* GetLoader(const char* detname) const; + AliLoader* GetLoader(AliDetector* det) const; + Int_t SetEventFolderName(const TString& name = AliConfig::fgkDefaultEventFolderName);//sets top folder name for this run; of alread + void CleanFolders();//removes all abjects from folder structure + void CleanDetectors(); + void CleanKinematics(){Clean(fgkKineContainerName);} + void CleanTrackRefs(){Clean(fgkTrackRefsContainerName);} + + void RemoveEventFolder(); //remove folder structure from top folder + void SetCompressionLevel(Int_t cl); + void SetKineComprLevel(Int_t cl); + void SetTrackRefsComprLevel(Int_t cl); + + TFolder* GetEventFolder() const {return fEventFolder;} + void CdGAFile(); + + void MakeTrackRefsContainer(); + void SetDirName(TString& dirname); + Int_t GetFileOffset() const; + void SetNumberOfEventsPerFile(Int_t nevpf){fNEventsPerFile = nevpf;} + + void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root", + //e.g. TPC.Digits.root -> TPC.DigitsMerged.root + //made on Jiri Chudoba demand + TString GetFileName() const;//returns name of galice file + const TObjArray* GetArrayOfLoaders() const {return fLoaders;} + Int_t GetDebug() const {return AliLoader::GetDebug();} + void cd(){fgRunLoader = this;} + + protected: + /**********************************************/ + /************ PROTECTED ***************/ + /********* D A T A ************/ + /**********************************************/ + + TObjArray *fLoaders; // List of Detectors + TFolder *fEventFolder; //!top folder for this run + + Int_t fCurrentEvent;//!Number of current event + + TFile *fGAFile;//! pointer to main file with AliRun and Run Loader -> galice.root + AliHeader *fHeader;//! pointer to header + AliStack *fStack; //! pointer to stack + + AliDataLoader *fKineDataLoader;// kinematics data loader + AliDataLoader *fTrackRefsDataLoader;//track reference data loader + + Int_t fNEventsPerFile; //defines number of events stored per one file + TString fUnixDirName; //! name of unix path to directory that contains event + static const TString fgkDefaultKineFileName;//default file name with kinamatics + static const TString fgkDefaultTrackRefsFileName;//default file name with kinamatics + + + /*********************************************/ + /************ PROTECTED **************/ + /********* M E T H O D S ***********/ + /*********************************************/ + + void SetGAliceFile(TFile* gafile);//sets the pointer to gAlice file + Int_t OpenKineFile(Option_t* opt); + Int_t OpenTrackRefsFile(Option_t* opt); + + Int_t OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl); + void SetUnixDir(const TString& udirname); + const TString SetFileOffset(const TString& fname);//adds the proper number before .root + void SetDetectorAddresses(); + + private: + void GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const; + + void CleanHeader(){Clean(fgkHeaderContainerName);} + void Clean(const TString& name); + + Int_t SetEvent(); + + static AliRunLoader* fgRunLoader; + + public: + /******************************************/ + /***** Public S T A T I C Stuff *******/ + /******************************************/ + static AliRunLoader* GetRunLoader(const char* eventfoldername); + static AliRunLoader* GetRunLoader(){return fgRunLoader;} + +// static AliRunDigitizer* GetRunDigitizer(); +// Tasks are supposed to be singletons, that is why following methods are static + static TTask* GetRunDigitizer(); // + static TTask* GetRunSDigitizer(); // + static TTask* GetRunReconstructioner(); // + static TTask* GetRunTracker(); // + static TTask* GetRunPIDTask(); // + static TTask* GetRunQATask(); // + + static const TString fgkRunLoaderName; + static const TString fgkHeaderContainerName; //default name of the kinematics container (TREE) name - TreeE + static const TString fgkKineContainerName; //default name of the kinematics container (TREE) name - TreeK + static const TString fgkTrackRefsContainerName; //default name of the track references container (TREE) name - TreeTR + static const TString fgkHeaderBranchName; + static const TString fgkKineBranchName; + static const TString fgkGAliceName; + + ClassDef(AliRunLoader,1) +}; + +#endif diff --git a/STEER/AliSDigits2Digits.C b/STEER/AliSDigits2Digits.C index d77821d645e..82c27adb45a 100644 --- a/STEER/AliSDigits2Digits.C +++ b/STEER/AliSDigits2Digits.C @@ -25,28 +25,27 @@ //////////////////////////////////////////////////////////////////////// #if !defined(__CINT__) || defined(__MAKECINT__) -#include -#include "AliRun.h" -#include "AliRunDigitizer.h" -#include "AliITSDigitizer.h" -#include "AliITSFDigitizer.h" -#include "AliTPCDigitizer.h" -#include "AliTRDdigitizer.h" -#include "AliPHOSDigitizer.h" -#include "AliMUONDigitizer.h" -#include "AliRICHDigitizer.h" -#include +#include "iostream.h" +#include "STEER/AliRun.h" +#include "STEER/AliRunDigitizer.h" +#include "ITS/AliITSDigitizer.h" +#include "TPC/AliTPCDigitizer.h" +#include "TRD/AliTRDdigitizer.h" +#include "PHOS/AliPHOSDigitizer.h" +#include "MUON/AliMUONDigitizer.h" +#include "RICH/AliRICHDigitizer.h" +#include "TStopwatch.h" #endif #include "AliHits2SDigits.C" void AliCopyN(TString inputFile, TString outputFile); -Int_t AliSDigits2Digits(TString fileNameDigits="digits.root", - TString fileNameSDigits="sdigits.root", - Int_t nEvents = 1, Int_t iITS = 0, Int_t iTPC = 0, - Int_t iTRD = 0, Int_t iPHOS = 0, Int_t iMUON = 0, - Int_t iRICH = 0, Int_t iCopy = 1) +Int_t AliSDigits2Digits(TString output="out/galice.root", + TString input="wrk/galice.root", + Int_t nEvents = 1, Int_t iITS = 0, Int_t iTPC = 1, + Int_t iTRD = 0, Int_t iPHOS = 0, Int_t iMUON = 0, + Int_t iRICH = 0, Int_t iCopy = 0) { // delete the current gAlice object, the one from input file // will be used @@ -56,13 +55,14 @@ Int_t AliSDigits2Digits(TString fileNameDigits="digits.root", gAlice = 0; } // end if gAlice AliRunDigitizer * manager = new AliRunDigitizer(1,1); - manager->SetInputStream(0,fileNameSDigits.Data()); - if (fileNameDigits != "") { - if (iCopy) { - AliCopyN(fileNameSDigits,fileNameDigits); - } - manager->SetOutputFile(fileNameDigits); - } + manager->SetDebug(1000); + manager->SetInputStream(0,input); + if (iCopy) + { +// AliCopyN(fileNameSDigits,fileNameDigits); + } + + manager->SetOutputFile(output); manager->SetNrOfEventsToWrite(nEvents); if (iITS == 1) AliITSDigitizer *dITS = new AliITSDigitizer(manager); if (iITS == 2) AliITSFDigitizer *dITS = new AliITSFDigitizer(manager); @@ -77,7 +77,6 @@ Int_t AliSDigits2Digits(TString fileNameDigits="digits.root", timer.Stop(); timer.Print(); delete manager; - return 0; } @@ -85,19 +84,5 @@ Int_t AliSDigits2Digits(TString fileNameDigits="digits.root", void AliCopyN(TString inputFileName, TString outputFileName) { // copy some objects - TFile *inputFile = OpenFile(inputFileName); - if (!inputFile) return; - - TFile *outputFile = TFile::Open(outputFileName.Data(),"update"); - if (!outputFile->IsOpen()) { - cerr<<"Can't open "<Close(); - delete inputFile; - outputFile->Close(); - delete outputFile; } //////////////////////////////////////////////////////////////////////// diff --git a/STEER/AliStack.cxx b/STEER/AliStack.cxx index 4d1040f7df3..44eee0680b8 100644 --- a/STEER/AliStack.cxx +++ b/STEER/AliStack.cxx @@ -21,20 +21,19 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include +#include +#include #include #include #include #include -#include -#include -#include -#include "AliStack.h" -#include "AliRun.h" -#include "AliModule.h" #include "AliHit.h" +#include "AliModule.h" +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliStack.h" ClassImp(AliStack) @@ -50,7 +49,8 @@ AliStack::AliStack(): fCurrent(-1), fCurrentPrimary(-1), fHgwmk(0), - fLoadPoint(0) + fLoadPoint(0), + fEventFolderName(AliConfig::fgkDefaultEventFolderName) { // // Default constructor @@ -58,7 +58,7 @@ AliStack::AliStack(): } //_______________________________________________________________________ -AliStack::AliStack(Int_t size): +AliStack::AliStack(Int_t size, const char* evfoldname): fParticles(new TClonesArray("TParticle",1000)), fParticleMap(new TObjArray(size)), fParticleFileMap(0), @@ -69,7 +69,8 @@ AliStack::AliStack(Int_t size): fCurrent(-1), fCurrentPrimary(-1), fHgwmk(0), - fLoadPoint(0) + fLoadPoint(0), + fEventFolderName(evfoldname) { // // Constructor @@ -115,7 +116,7 @@ AliStack::~AliStack() delete fParticles; } delete fParticleMap; - delete fTreeK; + //PH??? delete fTreeK; } // @@ -124,8 +125,8 @@ AliStack::~AliStack() //_____________________________________________________________________________ void AliStack::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, - Float_t *vpos, Float_t *polar, Float_t tof, - TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) + Float_t *vpos, Float_t *polar, Float_t tof, + TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) { // // Load a track on the stack @@ -262,56 +263,6 @@ TParticle* AliStack::GetNextTrack(Int_t& itrack) return track; } -/* -//_____________________________________________________________________________ -void AliStack::GetNextTrack(Int_t& itrack, Int_t& pdg, - Double_t& px, Double_t& py, Double_t& pz, Double_t& e, - Double_t& vx, Double_t& vy, Double_t& vz, Double_t& tof, - Double_t& polx, Double_t& poly, Double_t& polz) -{ - // - // Return next track from stack of particles - // - - - TParticle* track = GetNextParticle(); -// cout << "GetNextTrack():" << fCurrent << fNprimary << endl; - - if (track) { - itrack = fCurrent; - pdg = track->GetPdgCode(); - px = track->Px(); - py = track->Py(); - pz = track->Pz(); - e = track->Energy(); - vx = track->Vx(); - vy = track->Vy(); - vz = track->Vz(); - tof = track->T(); - TVector3 pol; - track->GetPolarisation(pol); - polx = pol.X(); - poly = pol.Y(); - polz = pol.Z(); - track->SetBit(kDoneBit); -// cout << "Filled params" << endl; - } - else - itrack = -1; - - // - // stop and start timer when we start a primary track - Int_t nprimaries = fNprimary; - if (fCurrent >= nprimaries) return; - if (fCurrent < nprimaries-1) { - fTimer.Stop(); - track=(TParticle*) fParticleMap->At(fCurrent+1); - // track->SetProcessTime(fTimer.CpuTime()); - } - fTimer.Start(); -} - -*/ //_____________________________________________________________________________ TParticle* AliStack::GetPrimaryForTracking(Int_t i) { @@ -328,7 +279,6 @@ TParticle* AliStack::GetPrimaryForTracking(Int_t i) return 0; } - //_____________________________________________________________________________ void AliStack::PurifyKine() { @@ -356,7 +306,7 @@ void AliStack::PurifyKine() if((part=dynamic_cast(particles.At(i)))) { // // Check of this track should be kept for physics reasons - if (KeepPhysics(part)) KeepTrack(i); + if (KeepPhysics(part)) KeepTrack(i); // part->ResetBit(kDaughtersBit); part->SetFirstDaughter(-1); @@ -438,10 +388,10 @@ void AliStack::PurifyKine() for (i=fHgwmk+1; i(particles.At(i)); - fParticleFileMap[i]=static_cast(fTreeK->GetEntries()); - fTreeK->Fill(); + fParticleFileMap[i]=static_cast(TreeK()->GetEntries()); + TreeK()->Fill(); particles[i]=fParticleBuffer=0; - } + } for (i=nkeep; iGetEntries() ==0) { + if(TreeK()->GetEntries() ==0) { // set the fParticleFileMap size for the first time fParticleFileMap.Set(fHgwmk+1); } @@ -511,8 +459,8 @@ void AliStack::FinishEvent() for(Int_t i=0; iAt(i))) { fParticleBuffer = dynamic_cast(part); - fParticleFileMap[i]= static_cast(fTreeK->GetEntries()); - fTreeK->Fill(); + fParticleFileMap[i]= static_cast(TreeK()->GetEntries()); + TreeK()->Fill(); //PH (*fParticleMap)[i]=fParticleBuffer=0; fParticleBuffer=0; fParticleMap->AddAt(0,i); @@ -521,19 +469,18 @@ void AliStack::FinishEvent() // should be left => to be removed later. if (allFilled) printf("Why != 0 part # %d?\n",i); } - else { + else + { // // printf("Why = 0 part # %d?\n",i); => We know. // break; - // we don't break now in order to be sure there is no - // particle !=0 left. - // To be removed later and replaced with break. - if(!allFilled) allFilled = kTRUE; - } -// cout << "Nof particles: " << fNtrack << endl; - //Reset(); + // we don't break now in order to be sure there is no + // particle !=0 left. + // To be removed later and replaced with break. + if(!allFilled) allFilled = kTRUE; + } } - //_____________________________________________________________________________ + void AliStack::FlagTrack(Int_t track) { // @@ -573,12 +520,13 @@ void AliStack::Reset(Int_t size) // // Resets stack // - + fNtrack=0; fNprimary=0; fHgwmk=0; fLoadPoint=0; fCurrent = -1; + fTreeK = 0x0; ResetArrays(size); } @@ -636,7 +584,7 @@ TParticle* AliStack::Particle(Int_t i) entry, fParticleFileMap[i]); } - fTreeK->GetEntry(entry); + TreeK()->GetEntry(entry); new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); fParticleMap->AddAt((*fParticles)[nentries],i); } @@ -725,8 +673,7 @@ void AliStack::DumpPStack () Int_t i; - printf( - "\n\n=======================================================================\n"); + printf("\n\n=======================================================================\n"); for (i=0;i(fParticleMap->At(i)); if ((particle) && (!particle->TestBit(kDoneBit))) { fCurrent=i; - //cout << "GetNextParticle() - secondary " - // << fNtrack << " " << fHgwmk << " " << fCurrent << endl; return particle; } } @@ -825,88 +769,133 @@ TParticle* AliStack::GetNextParticle() fCurrent = fCurrentPrimary; particle = dynamic_cast(fParticleMap->At(fCurrentPrimary--)); if ((particle) && (!particle->TestBit(kDoneBit))) { - //cout << "GetNextParticle() - primary " - // << fNtrack << " " << fHgwmk << " " << fCurrent << endl; return particle; } } // nothing to be tracked fCurrent = -1; - //cout << "GetNextParticle() - none " - // << fNtrack << " " << fHgwmk << " " << fCurrent << endl; return particle; } +//__________________________________________________________________________________________ +TTree* AliStack::TreeK() +{ +//returns TreeK + if (fTreeK) + { + return fTreeK; + } + else + { + AliRunLoader *rl = AliRunLoader::GetRunLoader(fEventFolderName); + if (rl == 0x0) + { + Fatal("TreeK","Can not get RunLoader from event folder named %s",fEventFolderName.Data()); + return 0x0;//pro forma + } + fTreeK = rl->TreeK(); + if ( fTreeK == 0x0) + { + Error("TreeK","Can not get TreeK from RL. Ev. Folder is %s",fEventFolderName.Data()); + } + else + { + ConnectTree(); + } + } + return fTreeK;//never reached +} //__________________________________________________________________________________________ -void AliStack::MakeTree(Int_t event, const char * /*file*/) + +void AliStack::ConnectTree() { // -// Make Kine tree and creates branch for writing particles -// - TBranch *branch=0; - // Make Kinematics Tree - char hname[30]; - if (!fTreeK) { - sprintf(hname,"TreeK%d",event); - fTreeK = new TTree(hname,"Kinematics"); - // Create a branch for particles - branch = fTreeK->Branch("Particles", "TParticle", &fParticleBuffer, 4000); - fTreeK->Write(0,TObject::kOverwrite); - } +// Creates branch for writing particles +// + if (AliLoader::fgDebug) Info("ConnectTree","Connecting TreeK"); + if (fTreeK == 0x0) + { + if (TreeK() == 0x0) + { + Fatal("ConnectTree","Parameter is NULL");//we don't like such a jokes + return; + } + return;//in this case TreeK() calls back this method (ConnectTree) + //tree after setting fTreeK, the rest was already executed + //it is safe to return now + } + + // Create a branch for particles + + if (AliLoader::fgDebug) + Info("ConnectTree","Tree name is %s",fTreeK->GetName()); + + if (fTreeK->GetDirectory()) + { + if (AliLoader::fgDebug) + Info("ConnectTree","and dir is %s",fTreeK->GetDirectory()->GetName()); + } + else + Warning("ConnectTree","DIR IS NOT SET !!!"); + + TBranch *branch=fTreeK->GetBranch(AliRunLoader::fgkKineBranchName); + if(branch == 0x0) + { + branch = fTreeK->Branch(AliRunLoader::fgkKineBranchName, "TParticle", &fParticleBuffer, 4000); + if (AliLoader::fgDebug) Info("ConnectTree","Creating Branch in Tree"); + } + else + { + if (AliLoader::fgDebug) Info("ConnectTree","Branch Found in Tree"); + branch->SetAddress(&fParticleBuffer); + } + if (branch->GetDirectory()) + { + if (AliLoader::fgDebug) + Info("ConnectTree","Branch Dir Name is %s",branch->GetDirectory()->GetName()); + } + else + Warning("ConnectTree","Branch Dir is NOT SET"); } +//__________________________________________________________________________________________ -//_____________________________________________________________________________ -void AliStack::BeginEvent(Int_t event) + +void AliStack::BeginEvent() { // start a new event -// -// - fNprimary = 0; - fNtrack = 0; - - char hname[30]; - if(fTreeK) { - fTreeK->Reset(); - sprintf(hname,"TreeK%d",event); - fTreeK->SetName(hname); - } + Reset(); } //_____________________________________________________________________________ void AliStack::FinishRun() { // Clean TreeK information - if (fTreeK) { - delete fTreeK; fTreeK = 0; - } } - //_____________________________________________________________________________ -Bool_t AliStack::GetEvent(Int_t event) + +Bool_t AliStack::GetEvent() { // // Get new event from TreeK // Reset/Create the particle stack - if (fTreeK) delete fTreeK; - - // Get Kine Tree from file - char treeName[20]; - sprintf(treeName,"TreeK%d",event); - fTreeK = dynamic_cast(gDirectory->Get(treeName)); + fTreeK = 0x0; - if (fTreeK) - fTreeK->SetBranchAddress("Particles", &fParticleBuffer); - else { - // Error("GetEvent","cannot find Kine Tree for event:%d\n",event); - Warning("GetEvent","cannot find Kine Tree for event:%d\n",event); + if (TreeK() == 0x0) //forces connecting + { + Error("GetEvent","cannot find Kine Tree for current event\n"); return kFALSE; - } -// printf("\n primaries %d", fNprimary); -// printf("\n tracks %d", fNtrack); + } - Int_t size = static_cast(fTreeK->GetEntries()); + Int_t size = (Int_t)TreeK()->GetEntries(); ResetArrays(size); return kTRUE; } +//_____________________________________________________________________________ + +void AliStack::SetEventFolderName(const char* foldname) +{ + //Sets event folder name + fEventFolderName = foldname; +} diff --git a/STEER/AliStack.h b/STEER/AliStack.h index caf71a79cba..729ff171df6 100644 --- a/STEER/AliStack.h +++ b/STEER/AliStack.h @@ -8,18 +8,21 @@ #include #include +#include "AliConfig.h" + class AliHeader; class TClonesArray; class TFile; class TObjArray; class TParticle; class TTree; +class TString; class AliStack : public TVirtualMCStack { public: // creators, destructors - AliStack(Int_t size); + AliStack(Int_t size, const char* evfoldname = AliConfig::fgkDefaultEventFolderName); AliStack(); AliStack(const AliStack& st); virtual ~AliStack(); @@ -27,24 +30,27 @@ class AliStack : public TVirtualMCStack {st.Copy(*this); return(*this);} // methods + virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg, - Float_t *pmom, Float_t *vpos, Float_t *polar, - Float_t tof, TMCProcess mech, Int_t &ntr, - Float_t weight, Int_t is); + Float_t *pmom, Float_t *vpos, Float_t *polar, + Float_t tof, TMCProcess mech, Int_t &ntr, + Float_t weight, Int_t is); + virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg, - Double_t px, Double_t py, Double_t pz, Double_t e, - Double_t vx, Double_t vy, Double_t vz, Double_t tof, - Double_t polx, Double_t poly, Double_t polz, - TMCProcess mech, Int_t &ntr, Double_t weight, - Int_t is); + Double_t px, Double_t py, Double_t pz, Double_t e, + Double_t vx, Double_t vy, Double_t vz, Double_t tof, + Double_t polx, Double_t poly, Double_t polz, + TMCProcess mech, Int_t &ntr, Double_t weight, + Int_t is); + virtual TParticle* GetNextTrack(Int_t& track); virtual TParticle* GetCurrentTrack() {return fCurrentTrack;} virtual TParticle* GetPrimaryForTracking(Int_t i); - void MakeTree(Int_t event, const char *file); - void BeginEvent(Int_t event); + void ConnectTree(); + void BeginEvent(); void FinishRun(); - Bool_t GetEvent(Int_t nevent); + Bool_t GetEvent(); void PurifyKine(); void FinishEvent(); void FlagTrack(Int_t track); @@ -66,7 +72,8 @@ class AliStack : public TVirtualMCStack TObjArray* Particles() const; TParticle* Particle(Int_t id); Int_t GetPrimary(Int_t id); - TTree* TreeK() const {return fTreeK;} + TTree* TreeK(); + void SetEventFolderName(const char* foldname); TParticle* ParticleFromTreeK(Int_t id) const; Int_t TreeKEntry(Int_t id) const; @@ -94,7 +101,8 @@ class AliStack : public TVirtualMCStack Int_t fHgwmk; //! Last track purified Int_t fLoadPoint; //! Next free position in the particle buffer - ClassDef(AliStack,3) //Particles stack + TString fEventFolderName; //! Folder name where event is mounted + ClassDef(AliStack,4) //Particles stack }; // inline diff --git a/STEER/AliStream.cxx b/STEER/AliStream.cxx index acd4d493d45..8b8aa78a463 100644 --- a/STEER/AliStream.cxx +++ b/STEER/AliStream.cxx @@ -13,102 +13,108 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* $Id$ */ +/* +$Log$ +Revision 1.4.4.4 2002/12/11 10:00:34 hristov +Merging with v3-09-04 (P.Skowronski) -//---------------------------------------------------------------------- +Revision 1.4.4.3 2002/11/22 14:19:50 hristov +Merging NewIO-01 with v3-09-04 (part one) (P.Skowronski) + +Revision 1.4.4.2 2002/06/18 10:18:32 hristov +Important update (P.Skowronski) + +Revision 1.4.4.1 2002/05/31 09:37:59 hristov +First set of changes done by Piotr + +Revision 1.5 2002/04/09 13:38:47 jchudoba +Add const to the filename argument + +Revision 1.4 2001/12/03 07:10:13 jchudoba +Default ctor cannot create new objects, create dummy default ctor which leaves object in not well defined state - to be used only by root for I/O + +Revision 1.3 2001/10/15 17:31:56 jchudoba +Bug correction + +Revision 1.2 2001/10/04 15:58:52 jchudoba +Option to open the stream in READ or UPDATE mode + +Revision 1.1 2001/09/19 06:20:50 jchudoba +Class to manage input filenames, used by AliRunDigitizer + +*/ + +//////////////////////////////////////////////////////////////////////// +// // AliStream.cxx +// // - store file names associated with a given stream // - open and close files // - return serial event number of the next event in the stream // and the TFile pointer for a proper file -//---------------------------------------------------------------------- +// +//////////////////////////////////////////////////////////////////////// #include -#include "TFile.h" -#include "TObjString.h" -#include "TROOT.h" #include "TTree.h" +#include "TROOT.h" -#include "AliRun.h" #include "AliStream.h" +#include "AliRun.h" + +#include "TObjString.h" +#include "TArrayI.h" +#include "TClonesArray.h" +#include "TFile.h" +#include "AliLoader.h" ClassImp(AliStream) -//_______________________________________________________________________ AliStream::AliStream(): - fLastEventSerialNr(0), + fLastEventSerialNr(-1), fLastEventNr(0), - fCurrentFileIndex(0), + fCurrentFileIndex(-1), fEvents(0), fMode(0), - fCurrentFile(0), - fFileNames(0) + fFileNames(0x0), + fEventFolderName(0) { - // - // root requires default ctor, where no new objects can be created - // do not use this ctor, it is supplied only for root needs - // +// root requires default ctor, where no new objects can be created +// do not use this ctor, it is supplied only for root needs } - //_______________________________________________________________________ -AliStream::AliStream(Option_t *option): + +AliStream::AliStream(const char* foldername,Option_t *option): fLastEventSerialNr(-1), fLastEventNr(0), fCurrentFileIndex(-1), fEvents(0), fMode(option), - fCurrentFile(0), - fFileNames(new TObjArray(1)) -{ - // - // Default ctor - // -} - -//_______________________________________________________________________ -AliStream::AliStream(const AliStream& str): - TNamed(str), - fLastEventSerialNr(0), - fLastEventNr(0), - fCurrentFileIndex(0), - fEvents(0), - fMode(0), - fCurrentFile(0), - fFileNames(0) + fFileNames(new TObjArray(1)), + fEventFolderName(foldername) { - // - // Copy ctor - // - str.Copy(*this); +// ctor } - //_______________________________________________________________________ -void AliStream::Copy(AliStream& ) const -{ - Fatal("Copy","Not implemented\n"); -} -//_______________________________________________________________________ AliStream::~AliStream() { // default dtor - if (fFileNames) { - fFileNames->Delete(); - delete fFileNames; - } + delete AliRunLoader::GetRunLoader(fEventFolderName); //clear the eventuall session + if (fFileNames) delete fFileNames; } - //_______________________________________________________________________ + void AliStream::AddFile(const char *fileName) { // stores the name of the file TObjString *name = new TObjString(fileName); fFileNames->Add(name); } - //_______________________________________________________________________ -Bool_t AliStream::NextEventInStream(Int_t &serialNr) + +Bool_t AliStream::NextEventInStream() { // returns kFALSE if no more events // returns kTRUE and the serial nr of the next event @@ -116,104 +122,119 @@ Bool_t AliStream::NextEventInStream(Int_t &serialNr) // no files given: if (fFileNames->GetLast() < 0) return kFALSE; - - if (!fCurrentFile) { - if (!OpenNextFile()) return kFALSE; - } - if (fLastEventSerialNr+1 >= fEvents) { - if (!OpenNextFile()) return kFALSE; - } - - fLastEventSerialNr++; -// in some cases the serial number does not start from 0, find the -// number of the next event - char name[20]; - sprintf(name, "TreeS%d", ++fLastEventNr); - while (!fCurrentFile->Get(name) && fLastEventNr < fEvents) - sprintf(name, "TreeS%d", ++fLastEventNr); - serialNr = fLastEventNr; + AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + if (currentloader == 0x0) + { + Info("NextEventInStream", + "Can not get RL from folder named %s. Attempting to open next file", + fEventFolderName.Data()); + Int_t res = OpenNextFile(); + if ( res == 0) return kFALSE; + currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + } + if (fLastEventSerialNr+1 >= fEvents) + { + if (!OpenNextFile()) return kFALSE; + } + Info("NextEventInStream","Trying to get event ",fLastEventSerialNr+1); + currentloader->GetEvent(++fLastEventSerialNr); return kTRUE; } - //_______________________________________________________________________ + void AliStream::ChangeMode(Option_t* option) +// set the mode to READ or UPDATE, reopen file with the new mode +// only change from UPDATE to READ have sense in the current scheme, +// other changes are possible but not usefull { - // set the mode to READ or UPDATE, reopen file with the new mode - // only change from UPDATE to READ have sense in the current scheme, - // other changes are possible but not usefull + fMode = option; - if (fCurrentFile) { - fCurrentFile->Close(); + AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + if (currentloader) { + delete currentloader; fCurrentFileIndex--; OpenNextFile(); } } - //_______________________________________________________________________ + Bool_t AliStream::OpenNextFile() { - // - // Open the next file in the series - // if (++fCurrentFileIndex > fFileNames->GetLast()) { cerr<<"No more files in the stream"<(fFileNames->At(fCurrentFileIndex))->GetName(); + const char* filename = static_cast(fFileNames->At(fCurrentFileIndex))->GetName(); // check if the file was already opened by some other code - TFile *f = dynamic_cast(gROOT->GetListOfFiles()->FindObject(filename)); + TFile *f = (TFile *)(gROOT->GetListOfFiles()->FindObject(filename)); if (f) f->Close(); - if (fCurrentFile) { - if (fCurrentFile->IsOpen()) { - fCurrentFile->Close(); - } - } + AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + + if (currentloader) + { + delete currentloader; + } + + currentloader = AliRunLoader::Open(filename,fEventFolderName,fMode); + - fCurrentFile = TFile::Open(filename,fMode.Data()); - if (!fCurrentFile) { + if (currentloader == 0x0) + { // cannot open file specified on input. Do not skip it silently. - cerr<<"Cannot open file "<(fCurrentFile->Get("TE")); - if (!te) { - Error("OpenNextFile", "input file does not contain TE"); - return kFALSE; - } - fEvents = static_cast(te->GetEntries()); + + if ( AliLoader::TestFileOption(fMode) )//tests if file is opened in read or update mode + { + Int_t res = currentloader->LoadHeader(); + if (res) + { + Error("OpenNextFile","Problems with loading header"); + return kFALSE; + } + fEvents = static_cast(currentloader->TreeE()->GetEntries()); + } + else + { + //if it is new, create or recreate there is no chance to find header in file + fEvents = 0; + } + fLastEventSerialNr = -1; - fLastEventNr = -1; return kTRUE; } - //_______________________________________________________________________ + Bool_t AliStream::ImportgAlice() { - // - // Import AliRun object pointed from gAlice - // if (fFileNames->GetLast() < 0) return kFALSE; - if (!fCurrentFile) { + + AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + if (!currentloader) + { if (!OpenNextFile()) return kFALSE; - } - gAlice = dynamic_cast(fCurrentFile->Get("gAlice")); + currentloader = AliRunLoader::GetRunLoader(fEventFolderName); + } + currentloader->LoadgAlice(); + gAlice = currentloader->GetAliRun(); if (!gAlice) return kFALSE; return kTRUE; } //_______________________________________________________________________ TString AliStream::GetFileName(const Int_t order) const +// returns name of the order-th file +// returns empty string if such file does not exist +// first file in the input stream is 0 { - // returns name of the order-th file - // returns empty string if such file does not exist - // first file in the input stream is 0 TString fileName(""); if (order > fFileNames->GetLast()) return fileName; TObjString *fileNameStored = dynamic_cast(fFileNames->At(order)); diff --git a/STEER/AliStream.h b/STEER/AliStream.h index 215c7b54b4d..ea00fb7a0f7 100644 --- a/STEER/AliStream.h +++ b/STEER/AliStream.h @@ -15,41 +15,41 @@ // --- ROOT system --- #include "TNamed.h" -#include "TObjArray.h" -#include "TString.h" +// --- AliRoot header files --- +//#include + +#include "TObjArray.h" class TFile; -// --- AliRoot header files --- +class TString; class AliStream: public TNamed { public: AliStream(); - AliStream(Option_t *option); - AliStream(const AliStream& str); - AliStream & operator=(const AliStream& str) - {str.Copy(*this); return (*this);} + AliStream(const char* foldername, Option_t *optioneventfoldername); virtual ~AliStream(); - void AddFile(const char *fileName); - Bool_t NextEventInStream(Int_t &eventNr); - Bool_t OpenNextFile(); - Bool_t ImportgAlice(); - TFile* CurrentFile() { return fCurrentFile;} - void ChangeMode(Option_t* option); // reset READ or UPDATE mode - Int_t GetNInputFiles() const {return fFileNames->GetLast()+1;} - TString GetFileName(const Int_t order) const; - + + void AddFile(const char *fileName); + Bool_t NextEventInStream(); + Bool_t OpenNextFile();//returns kFALSE in case of failure + Bool_t ImportgAlice(); + void ChangeMode(Option_t* option); // reset READ or UPDATE mode + + const TString& GetFolderName() const{return fEventFolderName;} + Int_t GetNInputFiles() const {return fFileNames->GetLast()+1;} + TString GetFileName(const Int_t order) const; + void SetFolderName(const TString name) { fEventFolderName = name ; } private: - void Copy(AliStream& str) const; - - Int_t fLastEventSerialNr; // Serial number of the last event - Int_t fLastEventNr; // Number of the last event - Int_t fCurrentFileIndex; // Index of the current file - Int_t fEvents; //! nr. of events in the current file - TString fMode; // = 0 for READONLY, = 1 for READWRITE - TFile *fCurrentFile; //! pointer to current open file - TObjArray * fFileNames; // storage for TStrings with file names + Int_t fLastEventSerialNr; + Int_t fLastEventNr; + Int_t fCurrentFileIndex; + Int_t fEvents; //! nr. of events in the current file + TString fMode; // = 0 for READONLY, = 1 for READWRITE + TObjArray* fFileNames; + + TString fEventFolderName; //Name of the folder where data for this stram will be mounted ClassDef(AliStream,1) }; diff --git a/STEER/AliTrackMapper.cxx b/STEER/AliTrackMapper.cxx index bffa28172ef..cf2c2fb12fd 100644 --- a/STEER/AliTrackMapper.cxx +++ b/STEER/AliTrackMapper.cxx @@ -30,11 +30,14 @@ #include "TTree.h" #include "TFile.h" #include "TStopwatch.h" +#include "TError.h" #include "AliDetector.h" #include "AliTrackMapper.h" #include "AliTrackMap.h" #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliHit.h" ClassImp(AliTrackMapper) @@ -64,23 +67,28 @@ void AliTrackMapper::CreateMap(Int_t nEvents, Int_t firstEventNr, TFile *fileMap=TFile::Open(fnMap,"new"); if (!fileMap->IsOpen()) {cerr<<"Can't open output file "<IsOpen()) {cerr<<"Can't open input file "<(fileHits->Get("gAlice")))) { - cerr<<"gAlice have not been found on galice.root !\n"; + + AliRunLoader* rl = AliRunLoader::Open(fnHits); + if (rl == 0x0) {cerr<<"Can't open input file "<LoadgAlice()) + { + ::Error("AliTrackMapper::CreateMap","Error occured while loading AliRun"); + return; + } + + if (!(gAlice=rl->GetAliRun())) { + cerr<<"gAlice have not been found on session !\n"; return; } + rl->LoadKinematics(); + for (Int_t eventNr = firstEventNr; eventNr < firstEventNr+nEvents; eventNr++) { - CreateMap(eventNr,fileMap); + CreateMap(eventNr,fileMap,rl); } // end loop over events - delete gAlice; - gAlice = 0; - fileHits->Close(); - delete fileHits; + delete rl; fileMap->Close(); delete fileMap; timer.Stop(); @@ -88,20 +96,16 @@ void AliTrackMapper::CreateMap(Int_t nEvents, Int_t firstEventNr, } //_______________________________________________________________________ -Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) const +Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap,AliRunLoader* rl) { // // create an AliTrackMap for a given event // correct gAlice must be already present in memory // - Int_t nGenPrimPlusSecParticles = gAlice->GetEvent(eventNr); - if (fDEBUG > 1) cout<<"nGenPrimPlusSecParticles = "<TreeK(); + rl->GetEvent(eventNr); + + TTree *treeK = rl->TreeK(); if (!treeK) { cerr<<"Error: Event "<TreeH(); - if (!treeH) { - cerr<<"Error: Event "<(treeH->GetEntries()); - if (fDEBUG > 1) cout<<"treeHEntries "<Detectors(); if (!modules) { @@ -125,38 +122,65 @@ Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) const } Int_t nModules = static_cast(modules->GetEntries()); AliHit* hit; - for (Int_t treeHIndex = 0; treeHIndex < treeHEntries; treeHIndex++) { - gAlice->ResetHits(); - treeH->GetEvent(treeHIndex); - for (Int_t iModule = 0; iModule < nModules; iModule++) { - AliDetector * detector = dynamic_cast(modules->At(iModule)); - if (!detector) continue; - // process only detectors with shunt = 0 + for (Int_t iModule = 0; iModule < nModules; iModule++) + { + AliDetector * detector = dynamic_cast(modules->At(iModule)); + if (!detector) continue; + AliLoader* loader = detector->GetLoader(); + if (loader == 0x0) + { + ::Warning("AliTrackMapper::CreateMap", + "Can not get loader from detector %s.",detector->GetName()); + continue; + } + Int_t retval = loader->LoadHits(); + if (retval) { + ::Error("AliTrackMapper::CreateMap", + "Event %d: error occured while loading hits for %s", + eventNr,detector->GetName()); + return -1; + } + + TTree *treeH = loader->TreeH(); + if (!treeH) { + ::Error("AliTrackMapper::CreateMap","Event %d: Can not get TreeH for %s", + eventNr,detector->GetName()); + return -1; + } + Int_t treeHEntries = static_cast(treeH->GetEntries()); + if (fDEBUG > 1) cout<<"treeHEntries "<ResetHits(); + + for (Int_t treeHIndex = 0; treeHIndex < treeHEntries; treeHIndex++) + { // process only detectors with shunt = 0 + treeH->GetEvent(treeHIndex); if (detector->GetIshunt()) continue; hit=dynamic_cast(detector->FirstHit(-1)); Int_t lastLabel=-1, label; for( ; hit; hit=dynamic_cast(detector->NextHit()) ) { - label=hit->Track(); - if (lastLabel != label) { - if (label < 0 || label >= nAllParticles) { - cerr<<"Error: label out of range. "; - cerr<<"Event "<GetName()< 2) cout<<"treeHIndex, label = "<Track(); + if (lastLabel != label) { + if (label < 0 || label >= nAllParticles) { + cerr<<"Error: label out of range. "; + cerr<<"Event "<GetName()< 2) cout<<"treeHIndex, label = "<UnloadHits(); + }//loop over modules if (fDEBUG > 2) { for (Int_t i = 0; i < nAllParticles; i++) { diff --git a/STEER/AliTrackMapper.h b/STEER/AliTrackMapper.h index a5459d14dad..0a9eb7e6caa 100644 --- a/STEER/AliTrackMapper.h +++ b/STEER/AliTrackMapper.h @@ -24,16 +24,17 @@ class TFile; // --- AliRoot header files --- class AliTrackMap; +class AliRunLoader; class AliTrackMapper { public: AliTrackMapper(); virtual ~AliTrackMapper(){} - void CreateMap(Int_t nEvents, Int_t firstEventNr, - const char* fnMap = "trackMap.root", - const char* fnHits ="rfio:galice.root"); - Int_t CreateMap(Int_t eventNr, TFile* fileMap) const; + void CreateMap(Int_t nEvents, Int_t firstEventNr, + const char* fnMap = "trackMap.root", + const char* fnHits ="rfio:galice.root"); + Int_t CreateMap(Int_t eventNr, TFile* fileMap,AliRunLoader* rl); void SetDebug(Int_t level) {fDEBUG = level;} void CheckTrackMap(Int_t eventNr, const char* fnMap = "trackMap.root"); AliTrackMap* LoadTrackMap(Int_t eventNr, const char* fnMap, TFile* &fileMap); diff --git a/STEER/AliTracker.cxx b/STEER/AliTracker.cxx index 61a197bb881..fe08e72cb5b 100644 --- a/STEER/AliTracker.cxx +++ b/STEER/AliTracker.cxx @@ -67,11 +67,9 @@ void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const { Int_t max=0; for (i=0; imax) {max=mx[i]; lab=lb[i];} - max=0; for (i=0; iGetLabel(0)) == lab || - TMath::Abs(c->GetLabel(1)) == lab || + if (TMath::Abs(c->GetLabel(1)) == lab || TMath::Abs(c->GetLabel(2)) == lab ) max++; } diff --git a/STEER/AliTracker.h b/STEER/AliTracker.h index d3edf15508c..5156ebea6ab 100644 --- a/STEER/AliTracker.h +++ b/STEER/AliTracker.h @@ -15,6 +15,7 @@ class AliKalmanTrack; class AliCluster; class TFile; +class AliRunLoader; class AliTracker : public TObject { @@ -25,8 +26,8 @@ public: AliTracker() { fX=fY=fZ=0.; fSigmaX=fSigmaY=fSigmaZ=0.; fEventN=0; fStoreBarrel = 1;} virtual ~AliTracker(){} - virtual Int_t Clusters2Tracks(const TFile *in, TFile *out)=0; - virtual Int_t PropagateBack(const TFile *in, TFile *out)=0; + virtual Int_t Clusters2Tracks()=0; + virtual Int_t PropagateBack()=0; void SetVertex(const Double_t *xyz, const Double_t *ers=0) { fX=xyz[0]; fY=xyz[1]; fZ=xyz[2]; if (ers) { fSigmaX=ers[0]; fSigmaY=ers[1]; fSigmaZ=ers[2]; } diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h index fc65cb19be0..c121df1416d 100644 --- a/STEER/STEERLinkDef.h +++ b/STEER/STEERLinkDef.h @@ -55,6 +55,13 @@ #pragma link C++ class AliMergeCombi+; #pragma link C++ class AliFieldMap-; #pragma link C++ class AliGausCorr+; +#pragma link C++ class AliLoader+; +#pragma link C++ class AliDataLoader+; +#pragma link C++ class AliBaseLoader+; +#pragma link C++ class AliObjectLoader+; +#pragma link C++ class AliTreeLoader+; +#pragma link C++ class AliTaskLoader+; +#pragma link C++ class AliRunLoader+; #pragma link C++ class AliTrackReference+; #pragma link C++ class AliESD+; #pragma link C++ class AliESDtrack+; diff --git a/STEER/libSTEER.pkg b/STEER/libSTEER.pkg index 175fbba1422..a2968116dc7 100644 --- a/STEER/libSTEER.pkg +++ b/STEER/libSTEER.pkg @@ -1,4 +1,4 @@ -SRCS = \ +SRCS = AliRunLoader.cxx AliLoader.cxx AliDataLoader.cxx \ AliDetector.cxx AliHeader.cxx AliMagF.cxx \ AliDigit.cxx AliHit.cxx AliPoints.cxx \ AliDisplay.cxx AliRun.cxx AliGenerator.cxx \ @@ -23,4 +23,5 @@ HDRS:= $(SRCS:.cxx=.h) DHDR= STEERLinkDef.h -EXPORT:=$(SRCS:.cxx=.h) AliConst.h AliCallf77.h +EXPORT:=$(SRCS:.cxx=.h) AliConst.h AliCallf77.h + diff --git a/STRUCT/ABSOConst.h b/STRUCT/ABSOConst.h index 01b6ba55927..671bc084a68 100644 --- a/STRUCT/ABSOConst.h +++ b/STRUCT/ABSOConst.h @@ -1,6 +1,8 @@ #ifndef ABSOCONST_H #define ABSOCONST_H +#include "AliConst.h" + /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */ /* $Id$ */ diff --git a/STRUCT/ABSOSHILConst.h b/STRUCT/ABSOSHILConst.h index e93ff581a4d..4b731639a27 100644 --- a/STRUCT/ABSOSHILConst.h +++ b/STRUCT/ABSOSHILConst.h @@ -1,6 +1,8 @@ #ifndef ABSOSHILCONST_H #define ABSOSHILCONST_H +#include "AliConst.h" + /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */ /* $Id$ */ diff --git a/STRUCT/AliABSOv0.cxx b/STRUCT/AliABSOv0.cxx index 5504ca8ef64..b88f2cadf1a 100644 --- a/STRUCT/AliABSOv0.cxx +++ b/STRUCT/AliABSOv0.cxx @@ -36,9 +36,11 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + #include "AliABSOv0.h" -#include "AliRun.h" #include "AliConst.h" +#include "AliRun.h" ClassImp(AliABSOv0) diff --git a/STRUCT/AliALIFE.cxx b/STRUCT/AliALIFE.cxx index 6f319cdf606..18bb5480e15 100644 --- a/STRUCT/AliALIFE.cxx +++ b/STRUCT/AliALIFE.cxx @@ -20,6 +20,7 @@ // in parallel with Geant geometry definition. // Author: A.Morsch //---------------------------------------------------------------------- + #include ClassImp(AliALIFE) diff --git a/STRUCT/AliBODY.cxx b/STRUCT/AliBODY.cxx index 2bc4a978e2d..2afaa962952 100644 --- a/STRUCT/AliBODY.cxx +++ b/STRUCT/AliBODY.cxx @@ -36,9 +36,11 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include "AliRun.h" -#include "AliMagF.h" +#include + #include "AliBODY.h" +#include "AliMagF.h" +#include "AliRun.h" ClassImp(AliBODY) diff --git a/STRUCT/AliDIPOv1.cxx b/STRUCT/AliDIPOv1.cxx index 4cc125c24ee..13eb6975f82 100644 --- a/STRUCT/AliDIPOv1.cxx +++ b/STRUCT/AliDIPOv1.cxx @@ -35,9 +35,11 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + #include "AliDIPOv1.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliRun.h" ClassImp(AliDIPOv1) diff --git a/STRUCT/AliDIPOv2.cxx b/STRUCT/AliDIPOv2.cxx index 4dbbffd5e51..a6e3ef0fa30 100644 --- a/STRUCT/AliDIPOv2.cxx +++ b/STRUCT/AliDIPOv2.cxx @@ -34,10 +34,12 @@ // // // // +#include + +#include "AliConst.h" #include "AliDIPOv2.h" -#include "AliRun.h" #include "AliMagF.h" -#include "AliConst.h" +#include "AliRun.h" ClassImp(AliDIPOv2) diff --git a/STRUCT/AliFRAMEv1.cxx b/STRUCT/AliFRAMEv1.cxx index a457d2f24b8..0d1132ed716 100644 --- a/STRUCT/AliFRAMEv1.cxx +++ b/STRUCT/AliFRAMEv1.cxx @@ -21,9 +21,10 @@ // Author: //------------------------------------------------------------------------- +#include + #include "AliFRAMEv1.h" #include "AliRun.h" -#include "TSystem.h" ClassImp(AliFRAMEv1) diff --git a/STRUCT/AliFRAMEv2.cxx b/STRUCT/AliFRAMEv2.cxx index bb141b94c8e..7aab0d8725f 100644 --- a/STRUCT/AliFRAMEv2.cxx +++ b/STRUCT/AliFRAMEv2.cxx @@ -21,10 +21,11 @@ // Author: A.Morsch //------------------------------------------------------------------------ +#include + #include "AliFRAMEv2.h" #include "AliMagF.h" #include "AliRun.h" -#include "TSystem.h" ClassImp(AliFRAMEv2) @@ -410,18 +411,12 @@ void AliFRAMEv2::CreateGeometry() dx = rd * TMath::Sin(phi*kdeg2rad); dy = rd * TMath::Cos(phi*kdeg2rad); -// gMC->Gspos("B047", 1, "B076", -dx, dy, dz, idrotm[2004], "ONLY"); -// gMC->Gspos("B047", 2, "B076", -dx, dy, -dz, idrotm[2003], "ONLY"); -// gMC->Gspos("B047", 3, "B076", dx, dy, dz, idrotm[2017], "ONLY"); -// gMC->Gspos("B047", 4, "B076", dx, dy, -dz, idrotm[2018], "ONLY"); gMC->Gspos("B045", 1, "B076", -dx, dy, dz2, idrotm[2019], "ONLY"); gMC->Gspos("B045", 2, "B076", -dx, dy, -dz2, idrotm[2003], "ONLY"); // ? gMC->Gspos("B045", 3, "B076", dx, dy, dz2, idrotm[2020], "ONLY"); gMC->Gspos("B045", 4, "B076", dx, dy, -dz2, idrotm[2027], "ONLY"); -// gMC->Gspos("BM49", 1, "B076", dx, dy, 0., idrotm[2020], "ONLY"); -// gMC->Gspos("BM49", 2, "B076", -dx, dy, 0., idrotm[2019], "ONLY"); // // phi = 60 @@ -430,18 +425,12 @@ void AliFRAMEv2::CreateGeometry() phi = 60; dx = rd * TMath::Sin(phi*kdeg2rad); dy = rd * TMath::Cos(phi*kdeg2rad); -// gMC->Gspos("B047", 5, "B076", -dx, dy, dz, idrotm[2005], "ONLY"); -// gMC->Gspos("B047", 6, "B076", -dx, dy, -dz, idrotm[2006], "ONLY"); -// gMC->Gspos("B047", 7, "B076", dx, dy, dz, idrotm[2016], "ONLY"); -// gMC->Gspos("B047", 8, "B076", dx, dy, -dz, idrotm[2015], "ONLY"); gMC->Gspos("B045", 5, "B076", -dx, dy, dz2, idrotm[2021], "ONLY"); gMC->Gspos("B045", 6, "B076", -dx, dy, -dz2, idrotm[2028], "ONLY"); gMC->Gspos("B045", 7, "B076", dx, dy, dz2, idrotm[2022], "ONLY"); gMC->Gspos("B045", 8, "B076", dx, dy, -dz2, idrotm[2029], "ONLY"); -// gMC->Gspos("BM49", 3, "B076", dx, dy, 0., idrotm[2022], "ONLY"); -// gMC->Gspos("BM49", 4, "B076", -dx, dy, 0., idrotm[2021], "ONLY"); // // phi = 80 // @@ -449,10 +438,6 @@ void AliFRAMEv2::CreateGeometry() phi = 80; dx = rd * TMath::Sin(phi*kdeg2rad); dy = rd * TMath::Cos(phi*kdeg2rad); -// gMC->Gspos("B047", 9, "B076", -dx, dy, dz, idrotm[2009], "ONLY"); -// gMC->Gspos("B047", 10, "B076", -dx, dy, -dz, idrotm[2007], "ONLY"); -// gMC->Gspos("B047", 11, "B076", dx, dy, dz, idrotm[2013], "ONLY"); -// gMC->Gspos("B047", 12, "B076", dx, dy, -dz, idrotm[2014], "ONLY"); gMC->Gspos("B047", 13, "B076", -dx, -dy, dz, idrotm[2008], "ONLY"); gMC->Gspos("B047", 14, "B076", -dx, -dy, -dz, idrotm[2010], "ONLY"); @@ -469,8 +454,6 @@ void AliFRAMEv2::CreateGeometry() gMC->Gspos("B045", 15, "B076", dx, -dy, dz2, idrotm[2025], "ONLY"); gMC->Gspos("B045", 16, "B076", dx, -dy, -dz2, idrotm[2033], "ONLY"); -// gMC->Gspos("BM49", 5, "B076", dx, dy, 0., idrotm[2026], "ONLY"); -// gMC->Gspos("BM49", 6, "B076", -dx, dy, 0., idrotm[2023], "ONLY"); gMC->Gspos("BM49", 7, "B076", dx, -dy, 0., idrotm[2025], "ONLY"); gMC->Gspos("BM49", 8, "B076", -dx, -dy, 0., idrotm[2024], "ONLY"); diff --git a/STRUCT/AliHALL.cxx b/STRUCT/AliHALL.cxx index 182df565b25..431dc62b8ad 100644 --- a/STRUCT/AliHALL.cxx +++ b/STRUCT/AliHALL.cxx @@ -36,10 +36,12 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + +#include "AliConst.h" #include "AliHALL.h" -#include "AliRun.h" #include "AliMagF.h" -#include "AliConst.h" +#include "AliRun.h" ClassImp(AliHALL) @@ -271,27 +273,6 @@ void AliHALL::CreateGeometry() gMC->Gsvolu("HMBS", "PGON", idtmed[1956], ppgon, 10); gMC->Gspos("HMBS", 1, "ALIC", 0., 70., 0., 0, "ONLY"); -/* - ppgon[4] = -1800.; - ppgon[5] = 0.; - ppgon[6] = 150.; - ppgon[7] = -1300.; - ppgon[8] = 0.; - ppgon[9] = 150.; - gMC->Gsvolu("HMBT", "PGON", idtmed[1956], ppgon, 10); - - ppgon[4] = -1800.; - ppgon[5] = 0.; - ppgon[6] = 10.; - ppgon[7] = -1300.; - ppgon[8] = 0.; - ppgon[9] = 10.; - gMC->Gsvolu("HMBU", "PGON", idtmed[1954], ppgon, 10); - - gMC->Gspos("HMBU", 1, "HMBT", 0., -70., 0., 0, "ONLY"); - - gMC->Gspos("HMBT", 1, "ALIC", 0., 70., 0., 0, "ONLY"); -*/ } //_____________________________________________________________________________ diff --git a/STRUCT/AliMAG.cxx b/STRUCT/AliMAG.cxx index f6d176391a9..e8178294f4f 100644 --- a/STRUCT/AliMAG.cxx +++ b/STRUCT/AliMAG.cxx @@ -34,9 +34,11 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + #include "AliMAG.h" -#include "AliRun.h" #include "AliMagF.h" +#include "AliRun.h" ClassImp(AliMAG) diff --git a/STRUCT/AliPIPEv0.cxx b/STRUCT/AliPIPEv0.cxx index ba09c61d74c..dec31b248ee 100644 --- a/STRUCT/AliPIPEv0.cxx +++ b/STRUCT/AliPIPEv0.cxx @@ -21,13 +21,15 @@ // Author: A.Morsch //------------------------------------------------------------------------- -#include "AliPIPEv0.h" -#include "AliRun.h" +#include + +#include +#include + #include "AliConst.h" #include "AliMagF.h" -#include "TSystem.h" - -#include +#include "AliPIPEv0.h" +#include "AliRun.h" ClassImp(AliPIPEv0) diff --git a/STRUCT/AliPIPEv1.cxx b/STRUCT/AliPIPEv1.cxx index 53a83b28afc..c59f7e169c8 100644 --- a/STRUCT/AliPIPEv1.cxx +++ b/STRUCT/AliPIPEv1.cxx @@ -27,9 +27,11 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + +#include "AliMagF.h" #include "AliPIPEv1.h" #include "AliRun.h" -#include "AliMagF.h" ClassImp(AliPIPEv1) diff --git a/STRUCT/AliPIPEv3.cxx b/STRUCT/AliPIPEv3.cxx index aefb50e902a..83ae05f10fd 100644 --- a/STRUCT/AliPIPEv3.cxx +++ b/STRUCT/AliPIPEv3.cxx @@ -27,9 +27,11 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + +#include "AliMagF.h" #include "AliPIPEv3.h" #include "AliRun.h" -#include "AliMagF.h" ClassImp(AliPIPEv3) diff --git a/STRUCT/AliSHILv0.cxx b/STRUCT/AliSHILv0.cxx index db56b68c54e..4d07c5975a5 100644 --- a/STRUCT/AliSHILv0.cxx +++ b/STRUCT/AliSHILv0.cxx @@ -29,9 +29,11 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include "AliSHILv0.h" -#include "AliRun.h" +#include + #include "AliConst.h" +#include "AliRun.h" +#include "AliSHILv0.h" ClassImp(AliSHILv0) diff --git a/THbtp/AliGenHBTprocessor.cxx b/THbtp/AliGenHBTprocessor.cxx index f6be9cd6942..2ee260d3966 100644 --- a/THbtp/AliGenHBTprocessor.cxx +++ b/THbtp/AliGenHBTprocessor.cxx @@ -31,6 +31,22 @@ // A) HBT PROCESSOR NEEDS MORE THAN ONE EVENT TO WORK // AS MORE AS IT BETTER WORKS // B) IT IS ABLE TO "ADD" CORRELATIONS ONLY UP TO TWO PARTICLE TYPES AT ONES +// +// +// Artificial particle dennsity enhancment feature +// HBT Processor is unable to process correctly low multiplicity particles +// even if the high statistics (more events) is supplied. +// For that reason was implemented artificial multiplicity enhancement +// - see also comments in HBT Processor source file (HBTP/hbt_event_processor.f) +// or web page (http://alisoft.cern.ch/people/skowron/hbtprocessor/hbteventprocessor.html) +// concerning trk_accep or SetTrackRejectionFactor method in this class +// Fortran is cheated by masking several events a single one. Number is defined by fEventMerge +// variable. In case it is equal to 1, there is no masking and the feature is off. +// But, for example if it is 5, and we have 100 events, number of events passed to fortran is 100/5=20 +// When fortran asks about multiplcity of event, let sey, 1 - multiplicity of events 5 to 9 is summed up +// and returned. +// +// ////////////////////////////////////////////////////////////////////////////////// // 11.11.2001 Piotr Skowronski @@ -55,31 +71,37 @@ // #include "AliGenHBTprocessor.h" -#include "TROOT.h" -#include + +#include + +#include +#include #include #include +#include +#include "THBTprocessor.h" + #include "AliRun.h" #include "AliStack.h" -#include "TParticle.h" -#include "THBTprocessor.h" #include "AliGenCocktailAfterBurner.h" ClassImp(AliGenHBTprocessor) +Int_t AliGenHBTprocessor::fgDebug = 0; static TRandom* sRandom; AliGenCocktailAfterBurner* GetGenerator(); /*******************************************************************/ -AliGenHBTprocessor::AliGenHBTprocessor(const AliGenHBTprocessor& in) +AliGenHBTprocessor::AliGenHBTprocessor(const AliGenHBTprocessor& in): + fEventMerge(1) { //copy contructor // AliGenHBTprocessor::AliGenHBTprocessor(); } -AliGenHBTprocessor::AliGenHBTprocessor() : AliGenerator() +AliGenHBTprocessor::AliGenHBTprocessor() : AliGenerator(), fEventMerge(1) { // // Standard constructor @@ -248,7 +270,8 @@ void AliGenHBTprocessor::Init() thbtp->SetPxRange(fPxMin,fPxMax); thbtp->SetPyRange(fPyMin,fPyMax); thbtp->SetPzRange(fPzMin,fPzMax); - thbtp->SetPhiRange(fPhiMin*180./TMath::Pi(),fPhiMax*180./TMath::Pi()); + thbtp->SetPhiRange(fPhiMin*180./((Float_t)TMath::Pi())+180.0, //casting is because if fPhiMin = 180.0 then + fPhiMax*180./((Float_t)TMath::Pi())+180.0);//TMath::Pi() != TMath::Pi()*fPhiMin/180.0, thbtp->SetEtaRange(fEtaMin,fEtaMax); thbtp->SetNPtBins(fNPtBins); thbtp->SetNPhiBins(fNPhiBins); @@ -265,6 +288,8 @@ void AliGenHBTprocessor::Init() thbtp->SetNBins3DCoarseMesh(fN3dCoarse); thbtp->SetBinSize3DCoarseMesh(fBinsize3dCoarse); thbtp->SetNBins3DFineProjectMesh(fN3dFineProject); + + thbtp->SetPrintFull(fPrintFull); } /*******************************************************************/ @@ -307,7 +332,7 @@ void AliGenHBTprocessor::GetParticles(TClonesArray * particles) const //practically dumm if (!particles) { - cout<<"Particles has to be initialized"<ImportParticles(particles); @@ -320,16 +345,30 @@ Int_t AliGenHBTprocessor::GetHbtPStatusCode(Int_t part) const //returns the status code of the given particle in the active event //see SetActiveEvent in the bottom of AliGenHBTprocessor.cxx //and in AliCocktailAfterBurner - Int_t activeEvent = GetGenerator()->GetActiveEventNumber(); - return fHbtPStatCodes[activeEvent][part]; + Int_t ev, idx; + GetTrackEventIndex(part,ev,idx); + if ( (ev<0) || (idx<0) ) + { + Error("GetHbtPStatusCode","GetTrackEventIndex returned error"); + return 0; + } + else return fHbtPStatCodes[ev][idx]; + + return 0; } /*******************************************************************/ void AliGenHBTprocessor::SetHbtPStatusCode(Int_t hbtstatcode, Int_t part) { //Sets the given status code to given particle number (part) in the active event - Int_t activeEvent = GetGenerator()->GetActiveEventNumber(); - fHbtPStatCodes[activeEvent][part] = hbtstatcode; + Int_t ev, idx; + GetTrackEventIndex(part,ev,idx); + if ( (ev<0) || (idx<0) ) + { + Error("GetHbtPStatusCode","GetTrackEventIndex returned error"); + return; + } + else fHbtPStatCodes[ev][idx] = hbtstatcode; } /*******************************************************************/ @@ -643,7 +682,7 @@ void AliGenHBTprocessor::SetPhiRange(Float_t phimin, Float_t phimax) //Sets \\Phi range AliGenerator::SetPhiRange(phimin,phimax); - fHBTprocessor->SetPhiRange(phimin,phimax); + fHBTprocessor->SetPhiRange(phimin+180.0,phimax+180.0); } /*******************************************************************/ void AliGenHBTprocessor::SetEtaRange(Float_t etamin, Float_t etamax) @@ -802,11 +841,140 @@ void AliGenHBTprocessor::SetNBins3DFineProjectMesh(Int_t n ) fN3dFineProject = n; fHBTprocessor->SetNBins3DFineProjectMesh(n); } +/*******************************************************************/ +void AliGenHBTprocessor::SetPrintFull(Int_t flag) +{ + fPrintFull = flag; + fHBTprocessor->SetPrintFull(flag); +} + + +/*******************************************************************/ + +Int_t AliGenHBTprocessor::GetNumberOfEvents() +{ + AliGenerator* g = gAlice->Generator(); + AliGenCocktailAfterBurner* cab = (g)?dynamic_cast(g):0x0; + if (cab == 0x0) + { + Fatal("GetNumberOfEvents","Master Generator is not an AliGenCocktailAfterBurner"); + return 0; + } + return (Int_t)TMath::Ceil(cab->GetNumberOfEvents()/((Float_t)fEventMerge)); +} + /*******************************************************************/ +void AliGenHBTprocessor::SetActiveEventNumber(Int_t n) +{ + fActiveStack = n*fEventMerge; + if (fgDebug) + Info("SetActiveEventNumber","Settimg active event %d passed %d", + fActiveStack,n); +} +/*******************************************************************/ +Int_t AliGenHBTprocessor::GetNumberOfTracks() +{ + AliGenerator* g = gAlice->Generator(); + AliGenCocktailAfterBurner* cab = (g)?dynamic_cast(g):0x0; + if (cab == 0x0) + { + Fatal("GetNumberOfEvents","Master Generator is not an AliGenCocktailAfterBurner"); + return 0; + } + Int_t n = 0; + for (Int_t i = fActiveStack;i < fActiveStack+fEventMerge; i++) + { + if (i >= GetNumberOfEvents()) break; //protection not to overshoot nb of events + AliStack* stack = cab->GetStack(i); + if (stack == 0x0) + Error("GetNumberOfTracks","There is no stack %d",i); + + n+=stack->GetNprimary(); + } + return n; +} +/*******************************************************************/ + +void AliGenHBTprocessor::SetNEventsToMerge(Int_t nev) +{ + if (nev > 0 ) fEventMerge = nev; +} +/*******************************************************************/ + +TParticle* AliGenHBTprocessor::GetTrack(Int_t n) +{ +//returns track that hbtp thinks is n in active event + if (fgDebug > 5) Info("GetTrack","n = %d",n); + AliGenerator* g = gAlice->Generator(); + AliGenCocktailAfterBurner* cab = (g)?dynamic_cast(g):0x0; + if (cab == 0x0) + { + Fatal("GetTrackEventIndex","Master Generator is not an AliGenCocktailAfterBurner"); + return 0; + } + + Int_t ev, idx; + GetTrackEventIndex(n,ev,idx); + if (fgDebug > 5) Info("GetTrack","Event = %d Particle = %d",ev,idx); + if ( (ev<0) || (idx<0) ) + { + Error("GetTrack","GetTrackEventIndex returned error"); + return 0x0; + } + else + { + if (fgDebug > 5) Info("GetTrack","Number of Tracks in Event(%d) = %d",ev,cab->GetStack(ev)->GetNprimary()); + return cab->GetStack(ev)->Particle(idx); //safe - in case stack does not exist + } //GetTrackEventIndex would have returned error + return 0x0; +} /*******************************************************************/ +void AliGenHBTprocessor::GetTrackEventIndex(Int_t n, Int_t &evno, Int_t &index) const +{ + //returns event(stack) number and particle index + AliGenerator* g = gAlice->Generator(); + AliGenCocktailAfterBurner* cab = (g)?dynamic_cast(g):0x0; + if (cab == 0x0) + { + Fatal("GetTrackEventIndex","Master Generator is not an AliGenCocktailAfterBurner"); + return; + } + + evno = -1; + index = -1; + for (Int_t i = fActiveStack;i < fActiveStack+fEventMerge; i++) + { + AliStack* stack = cab->GetStack(i); + if (stack == 0x0) + { + Error("GetTrackEventIndex","There is no stack %d",i); + return; + } + + Int_t ntracks = stack->GetNprimary(); + if (fgDebug > 10) Info("GetTrackEventIndex","Event %d has %d tracks. n = %d",i,ntracks,n); + + if ( ntracks > n) + { + evno = i; + index = n; + return ; + } + else + { + n-=ntracks; + continue; + } + } + Error("GetTrackEventIndex","Could not find given track"); +} + +/*******************************************************************/ +/*******************************************************************/ +/*******************************************************************/ @@ -874,18 +1042,18 @@ Int_t AliGenHBTprocessor::PDGFromId(Int_t id) const Double_t AliGenHBTprocessor::ThetaToEta(Double_t arg) { //converts etha(azimuthal angle) to Eta (pseudorapidity). Argument in radians + + if(arg>= TMath::Pi()) return 708.0;//This number is the biggest wich not crashes exp(x) + if(arg<= 0.0) return -708.0;// + if(arg == TMath::Pi()/2.) return 0.0;// - if(arg>= TMath::Pi()) return 709.0;//This number is the biggest wich not crashes exp(x) - if(arg<= 0.0) return -709.0;// - - arg -= TMath::Pi()/2.; if (arg > 0.0) { - return -TMath::Log( TMath::Tan(arg/2.)) ; + return TMath::Log( TMath::Tan(arg/2.)) ; } else - { - return TMath::Log( TMath::Tan(-arg/2.)) ; + { + return -TMath::Log( TMath::Tan(-arg/2.)) ; } } @@ -917,8 +1085,6 @@ Double_t AliGenHBTprocessor::ThetaToEta(Double_t arg) # define type_ofCall _stdcall #endif -#include "AliGenCocktailAfterBurner.h" -#include /*******************************************************************/ AliGenCocktailAfterBurner* GetGenerator() @@ -930,17 +1096,18 @@ AliGenCocktailAfterBurner* GetGenerator() if(!gAlice) { - cout<Fatal("AliGenHBTprocessor.cxx: GetGenerator()", - "\nRunning HBT Processor without gAlice... Exiting \n"); - return 0x0; + ::Error("AliGenHBTprocessor.cxx: GetGenerator()", + "There is NO gALICE! Check what you are doing!"); + ::Fatal("AliGenHBTprocessor.cxx: GetGenerator()", + "Running HBT Processor without gAlice... Exiting \n"); + return 0x0;//pro forma } AliGenerator * gen = gAlice->Generator(); if (!gen) { - gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()", - "\nThere is no generator in gAlice, exiting\n"); + ::Fatal("AliGenHBTprocessor.cxx: GetGenerator()", + "There is no generator in gAlice, exiting\n"); return 0x0; } @@ -955,13 +1122,11 @@ AliGenCocktailAfterBurner* GetGenerator() if (cab == 0x0)//if generator that we got is not AliGenCocktailAfterBurner or its descendant we get null { //then quit with error - gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()", - "\nThe main Generator is not a AliGenCocktailAfterBurner, exiting\n"); + ::Fatal("AliGenHBTprocessor.cxx: GetGenerator()", + "The main Generator is not a AliGenCocktailAfterBurner, exiting\n"); return 0x0; } - // cout<GetCurrentGenerator(); if(g == 0x0) { - gAlice->Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()", + ::Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()", "Can not get the current generator. Exiting"); - return 0x0; + return 0x0;//pro forma } TClass* hbtpclass = AliGenHBTprocessor::Class(); //get AliGenCocktailAfterBurner TClass @@ -984,8 +1149,8 @@ AliGenHBTprocessor* GetAliGenHBTprocessor() AliGenHBTprocessor* hbtp = (AliGenHBTprocessor*)gclass->DynamicCast(hbtpclass,g);//try to cast if (hbtp == 0x0) { - gAlice->Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()", - "\nCurrernt generator in AliGenCocktailAfterBurner is not a AliGenHBTprocessor, exiting\n"); + ::Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()", + "\nCurrernt generator in AliGenCocktailAfterBurner is not a AliGenHBTprocessor, exiting\n"); return 0x0; } return hbtp; @@ -1007,18 +1172,14 @@ extern "C" void type_ofCall alihbtp_initialize() extern "C" void type_ofCall alihbtp_getnumberevents(Int_t &nev) { //passes number of events to the fortran - if(gDebug) cout<<"alihbtp_getnumberevents("<GetNumberOfEvents(); + if(AliGenHBTprocessor::fgDebug) + ::Info("AliGenHBTprocessor.cxx: alihbtp_getnumberevents","(%d) ....",nev); + + AliGenHBTprocessor* gen = GetAliGenHBTprocessor();//we dont check because it is done in function + nev = gen->GetNumberOfEvents(); - if(gDebug>5) cout<<"EXITED N Ev = "<5) + ::Info("AliGenHBTprocessor.cxx: alihbtp_getnumberevents","EXITED N Ev = %d",nev); } /*******************************************************************/ @@ -1027,31 +1188,31 @@ extern "C" void type_ofCall alihbtp_setactiveeventnumber(Int_t & nev) { //sets active event in generator (AliGenCocktailAfterBurner) - if(gDebug>5) cout<<"alihbtp_setactiveeventnumber("<0) cout<<"Asked for event "<SetActiveEventNumber(nev - 1); //fortran numerates events from 1 to N + if(AliGenHBTprocessor::fgDebug>5) + ::Info("AliGenHBTpocessor.cxx: alihbtp_setactiveeventnumber","(%d)",nev); + if(AliGenHBTprocessor::fgDebug>0) + ::Info("AliGenHBTpocessor.cxx: alihbtp_setactiveeventnumber","Asked for event %d",nev-1); + + AliGenHBTprocessor* gen = GetAliGenHBTprocessor();//we dont check because it is done in function - if(gDebug>5) cout<<"EXITED returned "<SetActiveEventNumber(nev - 1); //fortran numerates events from 1 to N + if(AliGenHBTprocessor::fgDebug>5) + ::Info("AliGenHBTpocessor.cxx: alihbtp_setactiveeventnumber","EXITED returned %d",nev); } /*******************************************************************/ extern "C" void type_ofCall alihbtp_getnumbertracks(Int_t &ntracks) { //passes number of particles in active event to the fortran - if(gDebug>5) cout<<"alihbtp_getnumbertracks("<5) + ::Info("AliGenHBTpocessor.cxx: alihbtp_getnumbertracks","(%d)",ntracks); - AliGenCocktailAfterBurner* gen = GetGenerator(); - if (!gen) - { - ntracks = -1; - return; - } + AliGenHBTprocessor* gen = GetAliGenHBTprocessor();//we dont check because it is done in function - ntracks = gen->GetActiveStack()->GetNprimary(); - if(gDebug>5) cout<<"EXITED Ntracks = "<GetNumberOfTracks(); + if(AliGenHBTprocessor::fgDebug>5) + ::Info("AliGenHBTpocessor.cxx: alihbtp_getnumbertracks","EXITED Ntracks = %d",ntracks); } /*******************************************************************/ @@ -1067,26 +1228,33 @@ extern "C" void type_ofCall // px,py,pz - momenta // geantpid - type of the particle - Geant Particle ID - if(gDebug>5) cout<<"alihbtp_puttrack("<5) + ::Info("AliGenHBTpocessor.cxx: alihbtp_puttrack","(%d)",n); - AliGenCocktailAfterBurner* gen = GetGenerator(); - if(!gen) return; + AliGenHBTprocessor* gen = GetAliGenHBTprocessor();//we dont check because it is done in function - TParticle * track = gen->GetActiveStack()->Particle(n-1); - - AliGenHBTprocessor* g = GetAliGenHBTprocessor(); + TParticle * track = gen->GetTrack(n-1); + if (track == 0x0) + { + ::Error("AliGenHBTprocessor.cxx","Can not get track from AliGenHBTprocessor"); + return; + } //check to be deleted - if (geantpid != (g->IdFromPDG( track->GetPdgCode() ))) + if (geantpid != (gen->IdFromPDG( track->GetPdgCode() ))) { - cerr<0) + if(AliGenHBTprocessor::fgDebug>0) if (px != track->Px()) - cout<<"Px diff. = "<Px()<Px()); - if(gDebug>3) cout<<" track->GetPdgCode() --> "<GetPdgCode()<3) + ::Info("AliGenHBTprocessor.cxx: alihbtp_puttrack", + "track->GetPdgCode() --> %d",track->GetPdgCode()); @@ -1094,9 +1262,9 @@ extern "C" void type_ofCall Float_t e = TMath::Sqrt(m*m+px*px+py*py+pz*pz); track->SetMomentum(px,py,pz,e); - g->SetHbtPStatusCode(flag,n-1); + gen->SetHbtPStatusCode(flag,n-1); - if(gDebug>5) cout<<"EXITED "<5) ::Info("AliGenHBTprocessor.cxx: alihbtp_puttrack","EXITED "); } /*******************************************************************/ @@ -1112,20 +1280,10 @@ extern "C" void type_ofCall // px,py,pz - momenta // geantpid - type of the particle - Geant Particle ID - if(gDebug>5) cout<<"alihbtp_gettrack("<GetActiveStack()->Particle(n-1); + if(AliGenHBTprocessor::fgDebug>5) ::Info("AliGenHBTprocessor.cxx: alihbtp_gettrack","(%d)",n); AliGenHBTprocessor* g = GetAliGenHBTprocessor(); + + TParticle * track = g->GetTrack(n-1); flag = g->GetHbtPStatusCode(n-1); @@ -1135,7 +1293,7 @@ extern "C" void type_ofCall geantpid = g->IdFromPDG( track->GetPdgCode() ); - if(gDebug>5) cout<<"EXITED "<5) ::Info("AliGenHBTprocessor.cxx: alihbtp_gettrack","EXITED"); } /*******************************************************************/ diff --git a/THbtp/AliGenHBTprocessor.h b/THbtp/AliGenHBTprocessor.h index fd142657a76..d69c7e37448 100644 --- a/THbtp/AliGenHBTprocessor.h +++ b/THbtp/AliGenHBTprocessor.h @@ -11,12 +11,12 @@ #ifndef ALIGENHBTPROCESSOR_H #define ALIGENHBTPROCESSOR_H -#include - #include "AliGenerator.h" +#include "TPDGCode.h" class THBTprocessor; class TClonesArray; +class TParticle; enum {kHBTPMaxParticleTypes = 50}; @@ -76,9 +76,7 @@ class AliGenHBTprocessor : public AliGenerator virtual void SetPyRange(Float_t pymin = -1.0, Float_t pymax = 1.0); virtual void SetPzRange(Float_t pzmin = -3.6, Float_t pzmax = 3.6); - virtual void SetPhiRange(Float_t phimin = 0.0, Float_t phimax = 360.0);//Angle in degrees - //coherent with AliGenCocktail - //incohernet with AliGenerator + virtual void SetPhiRange(Float_t phimin = -180.0, Float_t phimax = 180.0);//Phi angle virtual void SetEtaRange(Float_t etamin = -1.5, Float_t etamax = 1.5);//Pseudorapidity void SetThetaRange(Float_t thetamin = 0, Float_t thetamax = 180); //Azimuthal angle, override AliGenerator method //which uses this, core fortran HBTProcessor uses Eta (pseudorapidity) @@ -105,6 +103,16 @@ class AliGenHBTprocessor : public AliGenerator virtual void SetBinSize3DCoarseMesh(Float_t x=0.08); virtual void SetNBins3DFineProjectMesh(Int_t n =3 ); + + virtual void SetPrintFull(Int_t flag = 1); + +/************* E V E N T M E R G E ******************/ + + Int_t GetNumberOfEvents(); + Int_t GetNumberOfTracks(); + void SetActiveEventNumber(Int_t n); + TParticle* GetTrack(Int_t n); + void SetNEventsToMerge(Int_t nev); /***********************************************************************/ /* * * * * * * P R O T E C T E D A R E A * * * * * * * * * * * */ /***********************************************************************/ @@ -227,7 +235,10 @@ class AliGenHBTprocessor : public AliGenerator Float_t fDelpz; // Mom. space sector cell size - pz(GeV/c) + Int_t fEventMerge; //number of events that are masked as an one event + Int_t fActiveStack; /******* P R O T E C T E D M E T H O D S *****/ + void GetTrackEventIndex(Int_t n, Int_t &evno, Int_t &index) const; //returns event(stack) number and private: public: //conveerts Eta (pseudorapidity) to etha(azimuthal angle). Returns radians @@ -238,7 +249,7 @@ class AliGenHBTprocessor : public AliGenerator static Double_t DegreesToRadians(Double_t arg){return arg*TMath::Pi()/180.;} //converts Radians To Degrees static Double_t RadiansToDegrees(Double_t arg){return arg*180./TMath::Pi();} - + static Int_t fgDebug; ClassDef(AliGenHBTprocessor,1) // Interface class for AliMevsim }; diff --git a/THbtp/THBTprocessor.cxx b/THbtp/THBTprocessor.cxx index 330ad6c6fa6..0932911794e 100644 --- a/THbtp/THBTprocessor.cxx +++ b/THbtp/THBTprocessor.cxx @@ -441,3 +441,8 @@ void THBTprocessor::PrintEvent() /*****************************************************************************************/ +void THBTprocessor::DumpSettings() +{ + //prints values set in common blocks + ctest(); +} diff --git a/THbtp/THBTprocessor.h b/THbtp/THBTprocessor.h index 51e4e39fb33..aefe70381a6 100644 --- a/THbtp/THBTprocessor.h +++ b/THbtp/THBTprocessor.h @@ -94,8 +94,10 @@ class THBTprocessor: public TGenerator virtual void SetBinSize3DCoarseMesh(Float_t x=0.08){MESH.binsize_3d_coarse=x;} virtual void SetNBins3DFineProjectMesh(Int_t n =3 ){ MESH.n_3d_fine_project=n;} - - + + virtual void SetPrintFull(Int_t flag = 1){PARAMETERS.print_full=flag;} + + void DumpSettings(); protected: private: diff --git a/TMEVSIM/AliGenMevSim.cxx b/TMEVSIM/AliGenMevSim.cxx index b8a822520fc..cf3a3053008 100644 --- a/TMEVSIM/AliGenMevSim.cxx +++ b/TMEVSIM/AliGenMevSim.cxx @@ -31,11 +31,10 @@ #include "AliGenMevSim.h" #include "AliRun.h" +static TRandom * sRandom; ClassImp(AliGenMevSim) -static TRandom * sRandom; - //____________________________________________________________________________ AliGenMevSim::AliGenMevSim() : AliGenerator(-1) { diff --git a/TMEVSIM/AliMevSimConfig.cxx b/TMEVSIM/AliMevSimConfig.cxx index 20879bd3f6b..1e539352318 100644 --- a/TMEVSIM/AliMevSimConfig.cxx +++ b/TMEVSIM/AliMevSimConfig.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/14 16:24:06 hristov +Merging with v3-09-08. Several classes are exported from EVGEN to different directories to resolve the dependencies + +Revision 1.1 2003/03/15 14:49:39 morsch +Classes imported from EVGEN + Revision 1.2 2001/03/24 10:08:30 morsch Log tag and copyright notice added. diff --git a/TMEVSIM/AliMevSimParticle.cxx b/TMEVSIM/AliMevSimParticle.cxx index a924152baa3..59db8edfeff 100644 --- a/TMEVSIM/AliMevSimParticle.cxx +++ b/TMEVSIM/AliMevSimParticle.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.1 2003/04/14 16:24:06 hristov +Merging with v3-09-08. Several classes are exported from EVGEN to different directories to resolve the dependencies + +Revision 1.1 2003/03/15 14:49:39 morsch +Classes imported from EVGEN + Revision 1.3 2001/10/21 18:35:56 hristov Several pointers were set to zero in the default constructors to avoid memory management problems diff --git a/TMEVSIM/TMevSim.cxx b/TMEVSIM/TMevSim.cxx index 81b9f76f567..a961b3ff3c6 100644 --- a/TMEVSIM/TMevSim.cxx +++ b/TMEVSIM/TMevSim.cxx @@ -13,18 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2001/09/28 16:27:03 hristov -A pointer is initialised to zero - -Revision 1.2 2001/03/28 07:32:51 hristov -Loop variables declared only once, old style include (HP,Sun) - -Revision 1.1 2001/03/25 10:15:23 morsch -Root interface to MevSim code as TGenerator realisation (Sylwester Radomski et al.) - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////////// // diff --git a/TMEVSIM/libTMEVSIM.pkg b/TMEVSIM/libTMEVSIM.pkg index 03aaf861870..240b59483fb 100644 --- a/TMEVSIM/libTMEVSIM.pkg +++ b/TMEVSIM/libTMEVSIM.pkg @@ -1,13 +1,7 @@ SRCS= TMevSim.cxx TMevSimPartTypeParams.cxx TMevSimConverter.cxx \ AliGenMevSim.cxx AliMevSimConfig.cxx AliMevSimParticle.cxx -HDRS= \ -TMevSim.h \ -TMevSimPartTypeParams.h \ -TMevSimConverter.h \ -AliGenMevSim.h \ -AliMevSimConfig.h \ -AliMevSimParticle.h +HDRS= $(SRCS:.cxx=.h) DHDR=TMevSimLinkDef.h diff --git a/TOF/AliTOF.cxx b/TOF/AliTOF.cxx index b54273e571b..26f129efeef 100644 --- a/TOF/AliTOF.cxx +++ b/TOF/AliTOF.cxx @@ -13,111 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.41 2002/10/22 14:26:27 alibrary -Introducing Riostream.h - -Revision 1.40 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.35.4.2 2002/07/24 10:08:43 alibrary -Updating VirtualMC - -Revision 1.39 2002/06/24 14:09:12 vicinanz -review on materials and - -Revision 1.38 2002/06/13 08:43:46 vicinanz -Merging added and test macro - -Revision 1.37 2002/05/03 07:34:19 vicinanz -Updated SDigitizer; Added AliTOFanalyzeSDigits.C macro - -Revision 1.36 2002/04/19 14:40:51 vicinanz -Updated SDigitizer - -Revision 1.35 2002/03/21 13:52:53 vicinanz -Minor changes to AliTOF constructor - -Revision 1.34 2002/02/20 13:41:38 hristov -Default arguments set only in the header file - -Revision 1.33 2002/02/19 10:39:38 vicinanz -t0 classes added and material update (steel added) - -Revision 1.31 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -Revision 1.30 2001/10/21 18:30:39 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.29 2001/10/17 14:19:24 hristov -delete replaced by delete [] - -Revision 1.28 2001/10/05 12:02:01 vicinanz -Minor improvements on Merger and SDigitizer - -Revision 1.27 2001/10/02 13:03:13 vicinanz -Minor improvements on the code - -Revision 1.26 2001/09/27 10:39:20 vicinanz -SDigitizer and Merger added - -Revision 1.25 2001/09/07 08:37:40 hristov -Pointers initialised to 0 in the default constructor - -Revision 1.24 2001/09/05 16:31:00 hristov -The deletion of TOF folders temporarily commented out - -Revision 1.23 2001/08/29 12:59:01 vicinanz -Minor changes to the Digitizer procedure - -Revision 1.22 2001/08/28 08:45:58 vicinanz -TTask and TFolder structures implemented - -Revision 1.21 2001/05/16 14:57:24 alibrary -New files for folders and Stack - -Revision 1.20 2001/05/04 10:09:47 vicinanz -Major upgrades to the strip structure - -Revision 1.19 2001/03/12 17:47:25 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.18 2001/01/26 19:57:42 hristov -Major upgrade of AliRoot code - -Revision 1.17 2000/10/19 09:58:14 vicinanz -Updated Hits2Digit procedure - -Revision 1.16 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.15 2000/05/18 14:33:01 vicinanz -Modified to be full HP compliant - -Revision 1.14 2000/05/15 19:32:36 fca -Add AddHitList !! - -Revision 1.13 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.11.2.1 2000/05/10 09:37:15 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.11 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.10 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.9 1999/10/15 15:35:19 fca -New version for frame1099 with and without holes - -Revision 1.9 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -145,34 +41,34 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// + #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliConst.h" +#include "AliLoader.h" +#include "AliMagF.h" +#include "AliRun.h" #include "AliTOF.h" -#include "AliTOFhit.h" -#include "AliTOFhitT0.h" -#include "AliTOFdigit.h" -#include "AliTOFSDigit.h" +#include "AliTOFRawDigit.h" #include "AliTOFRawSector.h" #include "AliTOFRoc.h" -#include "AliTOFRawDigit.h" - -#include "TROOT.h" -#include "TBRIK.h" -#include "TNode.h" -#include "TObject.h" -#include "TSystem.h" -#include "TTree.h" -#include "TFile.h" -#include "TFolder.h" -#include "TTask.h" - -#include "AliRun.h" -#include "AliMagF.h" -#include "AliConst.h" - +#include "AliTOFSDigit.h" +#include "AliTOFdigit.h" +#include "AliTOFhit.h" +#include "AliTOFhitT0.h" ClassImp(AliTOF) @@ -192,9 +88,7 @@ AliTOF::AliTOF() fReconParticles = 0x0; fName="TOF"; fMerger = 0x0; -/* fp - CreateTOFFolders(); -*/ + fTZero = kFALSE; } //_____________________________________________________________________________ @@ -209,11 +103,19 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option) // Initialization of hits, sdigits and digits array // added option for time zero analysis + fFGeom = 0x0; //skowron + fDTask = 0x0; + fReTask= 0x0; + fReconParticles= 0x0; + fMerger = 0x0; + if (strstr(option,"tzero")){ fHits = new TClonesArray("AliTOFhitT0", 1000); + fTZero = kTRUE; cout << "tzero option requires AliTOFv4T0 as TOF version (check Your Config.C)" << endl; }else{ fHits = new TClonesArray("AliTOFhit", 1000); + fTZero = kFALSE; } gAlice->AddHitList(fHits); fIshunt = 0; @@ -276,10 +178,7 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option) // (TARODA) fNTdc = 32; // number of Tdc (Time to Digital Converter) fNPadXRoc = (Int_t)fPadXSector/fNRoc; // number of pads for each ROC - /* fp 25 Sept 2001 - // Create TOF Folder Structure - CreateTOFFolders(); - */ + } //_____________________________________________________________________________ @@ -352,7 +251,7 @@ AliTOF::~AliTOF() } if (fSDigits) { - fSDigits->Delete (); + fSDigits->Delete(); delete fSDigits; fSDigits = 0; } @@ -415,36 +314,46 @@ void AliTOF::SetTreeAddress () { // Set branch address for the Hits and Digits Tree. char branchname[30]; + + if (fLoader->TreeH()) + { + if (fHits == 0x0) + { + if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000); + else fHits = new TClonesArray("AliTOFhit", 1000); + } + } AliDetector::SetTreeAddress (); TBranch *branch; - TTree *treeD = gAlice->TreeD (); - + TTree *treeD = fLoader->TreeD(); if (treeD) { - if (fDigits) - { - branch = treeD->GetBranch (branchname); - if (branch) - branch->SetAddress (&fDigits); - } - + branch = treeD->GetBranch (branchname); + if (branch) + { + if (fDigits == 0x0) fDigits = new TClonesArray("AliTOFdigit", 1000); + branch->SetAddress (&fDigits); + } } -// if (fSDigits) - // fSDigits->Clear (); - if (gAlice->TreeS () && fSDigits) + if (fLoader->TreeS () ) { - branch = gAlice->TreeS ()->GetBranch ("TOF"); - if (branch) - branch->SetAddress (&fSDigits); + branch = fLoader->TreeS ()->GetBranch ("TOF"); + if (branch) { + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000); + branch->SetAddress (&fSDigits); + } } - if (gAlice->TreeR() && fReconParticles) + if (fLoader->TreeR() && fReconParticles) //I do not know where this array is created - skowron { - branch = gAlice->TreeR()->GetBranch("TOF"); - if (branch) branch->SetAddress(&fReconParticles) ; + branch = fLoader->TreeR()->GetBranch("TOF"); + if (branch) + { + branch->SetAddress(&fReconParticles) ; + } } } @@ -690,7 +599,7 @@ void AliTOF::Init() } //____________________________________________________________________________ -void AliTOF::MakeBranch(Option_t* option, const char *file) +void AliTOF::MakeBranch(Option_t* option) { // // Initializes the Branches of the TOF inside the @@ -699,7 +608,17 @@ void AliTOF::MakeBranch(Option_t* option, const char *file) // Branch inside TreeH. Here we add the branches in // TreeD, TreeS and TreeR. // - AliDetector::MakeBranch(option,file); + const char *oH = strstr(option,"H"); + if (fLoader->TreeH() && oH) + { + if (fHits == 0x0) + { + if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000); + else fHits = new TClonesArray("AliTOFhit", 1000); + } + } + + AliDetector::MakeBranch(option); Int_t buffersize = 4000; Char_t branchname[10]; @@ -709,39 +628,19 @@ void AliTOF::MakeBranch(Option_t* option, const char *file) const char *oS = strstr(option,"S"); const char *oR = strstr(option,"R"); - if (oD) - // - // one branch for TOF digits - // - - - if (fDigits && gAlice->TreeD() && oD){ - MakeBranchInTree(gAlice->TreeD(), - branchname, &fDigits,buffersize, file) ; + if (fLoader->TreeD() && oD){ + if (fDigits == 0x0) fDigits = new TClonesArray("AliTOFdigit", 1000); + MakeBranchInTree(fLoader->TreeD(), branchname, &fDigits,buffersize, 0) ; } - if (oS) - // - // one branch for TOF sdigits - // - - - if (fSDigits && gAlice->TreeS() && oS){ - MakeBranchInTree(gAlice->TreeS(), - branchname, &fSDigits,buffersize, file) ; + if (fLoader->TreeS() && oS){ + if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000); + MakeBranchInTree(fLoader->TreeS(), branchname, &fSDigits,buffersize, 0) ; } - if (oR) - // - // one branch for TOF reconstructed particles - // - - - if (fReconParticles && gAlice->TreeR() && oR){ - MakeBranchInTree(gAlice->TreeR(), - branchname, &fReconParticles,buffersize, file) ; + if (fReconParticles && fLoader->TreeR() && oR){ + MakeBranchInTree(fLoader->TreeR(), branchname, &fReconParticles,buffersize, 0) ; } - } //____________________________________________________________________________ diff --git a/TOF/AliTOF.h b/TOF/AliTOF.h index e20f4053847..eb3bc864101 100644 --- a/TOF/AliTOF.h +++ b/TOF/AliTOF.h @@ -56,7 +56,7 @@ public: virtual void CreateMaterials(); virtual void Init(); // virtual void MakeBranch(Option_t* option, const char *file=0); - virtual void MakeBranch(Option_t *opt=" ",const char *file=0); + virtual void MakeBranch(Option_t *opt=" "); virtual void Makehits(Bool_t hits=1); virtual void FinishEvent(); virtual Int_t IsVersion() const =0; @@ -126,10 +126,11 @@ protected: Int_t fNTdc; // number of TDC Int_t fNPadXRoc; // number of pads for each ROC Int_t fIdSens; // the unique numeric identifier for sensitive volume FPAD + Bool_t fTZero; // flag indicating if T0 is used private: - ClassDef(AliTOF,5) // Time Of Flight base class + ClassDef(AliTOF,6) // Time Of Flight base class }; #endif /* ALITOF_H */ diff --git a/TOF/AliTOFDigitizer.cxx b/TOF/AliTOFDigitizer.cxx index 2471001a620..5f048b6f5bd 100644 --- a/TOF/AliTOFDigitizer.cxx +++ b/TOF/AliTOFDigitizer.cxx @@ -42,11 +42,12 @@ #include "AliRunDigitizer.h" #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliPDG.h" #include #include -#include ClassImp(AliTOFDigitizer) @@ -99,8 +100,27 @@ void AliTOFDigitizer::Exec(Option_t* option) sprintf (branchname, "%s", tof->GetName ()); fDigits=new TClonesArray("AliTOFdigit",4000); - - TTree* treeD = fManager->GetTreeD(); + + AliRunLoader* outrl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + if (outrl == 0x0) + { + Error("Exec","Can not find Run Loader in output folder."); + return; + } + + AliLoader* outgime = outrl->GetLoader("TOFLoader"); + if (outgime == 0x0) + { + Error("Exec","Can not get TOF Loader from Output Run Loader."); + return; + } + + TTree* treeD = outgime->TreeD(); + if (treeD == 0x0) + { + outgime->MakeTree("D"); + treeD = outgime->TreeD(); + } //Make branch for digits (to be created in Init()) tof->MakeBranchInTree(treeD,branchname,&fDigits,4000); @@ -115,7 +135,7 @@ void AliTOFDigitizer::Exec(Option_t* option) for (Int_t inputFile=0; inputFileGetNinputs(); inputFile++) { ReadSDigit(inputFile); - } + } // create digits CreateDigits(); @@ -125,7 +145,8 @@ void AliTOFDigitizer::Exec(Option_t* option) fSDigitsArray->Delete(); treeD->Fill(); - fManager->GetTreeD()->AutoSave(); // to fit with the framework + outgime->WriteDigits("OVERWRITE"); + outgime->UnloadDigits(); fDigits->Delete(); delete fDigits; @@ -219,8 +240,36 @@ void AliTOFDigitizer::ReadSDigit(Int_t inputFile ) // be created with the same simulation parameters. // get the treeS from manager - TTree* currentTreeS=fManager->GetInputTreeS(inputFile); - + AliRunLoader* rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile)); + if (rl == 0x0) + { + Error("ReadSDigit","Can not find Run Loader in input %d folder.",inputFile); + return; + } + + AliLoader* gime = rl->GetLoader("TOFLoader"); + if (gime == 0x0) + { + Error("ReadSDigit","Can not get TOF Loader from Input %d Run Loader.",inputFile); + return; + } + + TTree* currentTreeS=gime->TreeS(); + if (currentTreeS == 0x0) + { + Int_t retval = gime->LoadSDigits(); + if (retval) + { + Error("ReadSDigit","Error occured while loading S. Digits for Input %d",inputFile); + return; + } + currentTreeS=gime->TreeS(); + if (currentTreeS == 0x0) + { + Error("ReadSDigit","Can not get S. Digits Tree for Input %d",inputFile); + return; + } + } // get the branch TOF inside the treeS TClonesArray * sdigitsDummyContainer= new TClonesArray("AliTOFSDigit", 1000); diff --git a/TOF/AliTOFDigitizer.h b/TOF/AliTOFDigitizer.h index c56c9ec14ba..e563297727b 100644 --- a/TOF/AliTOFDigitizer.h +++ b/TOF/AliTOFDigitizer.h @@ -41,4 +41,3 @@ class AliTOFDigitizer : public AliDigitizer { ClassDef(AliTOFDigitizer,0) // TOF/Merging/Digitization }; #endif - diff --git a/TOF/AliTOFHitMap.cxx b/TOF/AliTOFHitMap.cxx index ea4c4be0f2c..5fee29ce2c0 100644 --- a/TOF/AliTOFHitMap.cxx +++ b/TOF/AliTOFHitMap.cxx @@ -13,27 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.3.6.1 2002/07/24 11:07:40 alibrary -Updating VirtualMC - -Revision 1.4 2002/07/24 09:38:28 vicinanz -Fixed (ininfluential) bug on TestHit method - -Revision 1.3 2001/12/19 09:33:32 hristov -Index corrected - -Revision 1.2 2001/11/22 11:30:30 hristov -Correct log field - -Revision 1.1 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -*/ +/* $Id$ */ //////////////////////////////////////////////////////////////////////// // diff --git a/TOF/AliTOFMerger.cxx b/TOF/AliTOFMerger.cxx index d85bf4be68d..b92f7bf7e80 100644 --- a/TOF/AliTOFMerger.cxx +++ b/TOF/AliTOFMerger.cxx @@ -12,6 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +//Piotr.Skowronski@cern.ch : +//Corrections applied in order to compile (only) with new I/O and folder structure +//To be implemented correctly by responsible + +#include "AliRunLoader.h" +#include "AliLoader.h" #include #include @@ -48,6 +54,7 @@ ClassImp(AliTOFMerger) fFnBgr = 0; fFnSig = 0; fBgrFile = 0; + fRunLoader = 0 ; } //------------------------------------------------------------------------ @@ -69,6 +76,7 @@ AliTOFMerger::~AliTOFMerger() delete[] fFnSig; fFnSig = 0; } + delete fRunLoader; } @@ -86,6 +94,8 @@ void AliTOFMerger::Init() TFile* AliTOFMerger::InitBgr() { // Initialise background event + fRunLoader = AliRunLoader::Open(fFnBgr);//open session and mount on default event folder + TFile *file = new TFile(fFnBgr); // add error checking later printf("\n AliTOFMerger has opened %s file with background event \n", fFnBgr); @@ -99,35 +109,69 @@ void AliTOFMerger::Digitise() // keep galice.root for signal and name differently the file for // background when add! otherwise the track info for signal will be lost ! - - #ifdef DEBUG cout<<"ALiTOFMerger::>SDigits2Digits start...\n"; #endif - + Int_t retval; + + if (fRunLoader == 0x0) + { + Error("Exec","Event is not loaded. Exiting"); + return; + } + retval = fRunLoader->LoadgAlice(); + if (retval) + { + Error("Exec","Error occured while loading gAlice. Exiting"); + return; + } + retval = fRunLoader->LoadHeader(); + if (retval) + { + Error("Exec","Error occured while loading header. Exiting"); + return; + } + + retval = fRunLoader->LoadKinematics("READ"); + if (retval) + { + Error("Exec","Error occured while loading kinematics. Exiting"); + return; + } + + AliLoader* gime = fRunLoader->GetLoader("TOFLoader"); + if (gime == 0x0) + { + Error("Exec","Can not find TOF loader in event. Exiting."); + return; + } + gAlice = fRunLoader->GetAliRun(); + AliTOF* TOF = (AliTOF *) gAlice->GetDetector("TOF") ; TFile *f1 =0; - TTree *TK = gAlice->TreeK(); + TTree *TK = fRunLoader->TreeK(); if (TK) f1 = TK->GetCurrentFile(); - gAlice->GetEvent(fEvNrSig) ; + fRunLoader->GetEvent(fEvNrSig); + + if(gime->TreeD() == 0) + gime->MakeTree("D") ; - if(gAlice->TreeD() == 0) - gAlice->MakeTree("D") ; - gAlice->TreeD()->Reset(); + gime->TreeD()->Reset(); // read and write digits for signal ReadWriteDigit(fEvNrSig); - if(fMerge){ - // bgr file - fBgrFile->cd(); - // gAlice->TreeS()->Reset(); - gAlice = (AliRun*)fBgrFile->Get("gAlice"); - ReadWriteDigit(fEvNrBgr); - } //if merge + if(fMerge) + { + // bgr file + fBgrFile->cd(); + // gAlice->TreeS()->Reset(); + gAlice = (AliRun*)fBgrFile->Get("gAlice"); + ReadWriteDigit(fEvNrBgr); + } //if merge f1->cd(); @@ -135,12 +179,12 @@ void AliTOFMerger::Digitise() //Make branch for digits TOF->MakeBranch("D"); - gAlice->TreeD()->Reset(); - gAlice->TreeD()->Fill(); + gime->TreeD()->Reset(); + gime->TreeD()->Fill(); fDigits = TOF->Digits(); - gAlice->TreeD()->Write(0,TObject::kOverwrite) ; + gime->WriteDigits("OVERWRITE"); gAlice->ResetDigits(); @@ -157,10 +201,27 @@ void AliTOFMerger::ReadWriteDigit(Int_t iEvNum) AliTOF * tofinfile = (AliTOF *) gAlice->GetDetector("TOF") ; - gAlice->GetEvent(iEvNum) ; - if(gAlice->TreeS()==0) { - cout<<" TreeS==0 -> return"<TreeS()<GetEvent(iEvNum); + if (retval) + { + Error("ReadWriteDigit","Error while getting event %d",iEvNum); + return; + } + + AliLoader* gime = fRunLoader->GetLoader("TOFLoader"); + if (gime == 0x0) + { + Error("Exec","Can not find TOF loader in event. Exiting."); + return; + } + + + + if(gime->TreeS()==0) + { + cout<<" TreeS==0 -> return"<TreeS()<ResetDigits(); - gAlice->TreeS()->GetEvent(iEvNum); + gime->TreeS()->GetEvent(iEvNum); TClonesArray * TOFdigits = tofinfile->SDigits(); ndig=TOFdigits->GetEntries(); diff --git a/TOF/AliTOFMerger.h b/TOF/AliTOFMerger.h index 7649cdbe5af..5eada3121b8 100644 --- a/TOF/AliTOFMerger.h +++ b/TOF/AliTOFMerger.h @@ -8,6 +8,10 @@ #include "TRandom.h" #include "AliDetector.h" #include "AliTOF.h" +//Piotr.Skowronski@cern.ch : +//Corrections applied in order to compile (only) with new I/O and folder structure +//To be implemented correctly by responsible +class AliRunLoader; typedef enum {kDigitize=0, kMerge = 1} MergeMode_t; @@ -52,6 +56,7 @@ class AliTOFMerger { char *fFnSig; // signal file name TFile *fBgrFile; // Pointer to background file + AliRunLoader * fRunLoader; //! Run Loader ClassDef(AliTOFMerger,0) }; #endif diff --git a/TOF/AliTOFReconstructioner.cxx b/TOF/AliTOFReconstructioner.cxx index de17ed7c373..b5e1ceafe74 100644 --- a/TOF/AliTOFReconstructioner.cxx +++ b/TOF/AliTOFReconstructioner.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + //_________________________________________________________________________ // Manager class for TOF reconstruction. // @@ -32,47 +34,50 @@ // ////////////////////////////////////////////////////////////////////////////// +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "AliConst.h" +#include "AliDetector.h" +#include "AliHeader.h" +#include "AliLoader.h" +#include "AliRun.h" #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliTOF.h" #include "AliTOFConstants.h" #include "AliTOFHitMap.h" -#include "AliTOFSDigit.h" -#include "AliTOFhit.h" -#include "AliTOFRecHit.h" #include "AliTOFPad.h" +#include "AliTOFRecHit.h" +#include "AliTOFReconstructioner.h" +#include "AliTOFSDigit.h" #include "AliTOFTrack.h" -#include "AliTOF.h" +#include "AliTOFhit.h" #include "AliTOFv1.h" #include "AliTOFv2.h" #include "AliTOFv2FHoles.h" #include "AliTOFv3.h" #include "AliTOFv4.h" #include "AliTOFv4T0.h" -#include "AliTOFReconstructioner.h" -// this line has to be commented till TPC will provide fPx fPy fPz and fL in -// AliTPChit class or somewhere -// #include "../TPC/AliTPC.h" -#include "AliRun.h" -#include "AliDetector.h" -#include "TTask.h" -#include "TBenchmark.h" -#include "TTree.h" -#include "TSystem.h" -#include "TFile.h" -#include "TParticle.h" -#include -#include "TGeant3.h" -#include "TVirtualMC.h" -#include -#include -#include "TROOT.h" -#include "TFolder.h" -#include "TNtuple.h" -#include -#include -#include +// #include "../TPC/AliTPC.h" +// AliTPChit class or somewhere +// this line has to be commented till TPC will provide fPx fPy fPz and fL in ClassImp(AliTOFReconstructioner) @@ -311,32 +316,59 @@ void AliTOFReconstructioner::Exec(const char* datafile, Option_t *option) // gBenchmark->Start("TOFReconstruction"); - TFile *file = TFile::Open(datafile); - + + AliRunLoader *rl = AliRunLoader::Open(datafile); + if (rl == 0x0) + { + Error("Exec","Can not open session for file %s",datafile); + return; + } // Get AliRun object from file or create it if not on file - gAlice = (AliRun*)file->Get("gAlice"); + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); AliTOF* TOF = (AliTOF *) gAlice->GetDetector ("TOF"); AliDetector* TPC = gAlice->GetDetector("TPC"); if (!TOF) { Error("AliTOFReconstructioner","TOF not found"); + delete rl; return; } if (!TPC) { Error("AliTOFReconstructioner","TPC Detector not found"); + delete rl; return; } + AliLoader* tpcloader = rl->GetLoader("TPCLoader"); + if (tpcloader == 0x0) + { + Error("AliTOFReconstructioner","Can not get TPC Loader from Run Loader."); + delete rl; + return; + } + AliLoader* tofloader = rl->GetLoader("TOFLoader"); + if (tofloader == 0x0) + { + Error("AliTOFReconstructioner","Can not get TOF Loader from Run Loader."); + delete rl; + return; + } + if (fEdgeTails) ftail = new TF1("tail",TimeWithTailR,-2,2,3); - - if (fNevents == 0) fNevents = (Int_t) gAlice->TreeE()->GetEntries(); + + if (fNevents == 0) fNevents = rl->GetNumberOfEvents(); // You have to set the number of event with the ad hoc setter // see testrecon.C - + if (rl->GetHeader() == 0x0) rl->LoadHeader(); + + tofloader->LoadHits(); + tpcloader->LoadHits(); + for (Int_t ievent = 0; ievent < fNevents; ievent++) { // start loop on events - - Int_t nparticles=gAlice->GetEvent(ievent); + rl->GetEvent(ievent); + Int_t nparticles= rl->GetHeader()->GetNtrack(); if (nparticles <= 0) return; TClonesArray* tofhits=0; @@ -345,7 +377,7 @@ void AliTOFReconstructioner::Exec(const char* datafile, Option_t *option) if (TOF) tofhits = TOF->Hits(); if (TPC) tpchits = TPC->Hits(); - TTree *TH = gAlice->TreeH(); + TTree *TH = tofloader->TreeH(); if (!TH) return; Int_t ntracks = (Int_t) (TH->GetEntries()); // primary tracks cout << "number of primary tracked tracks in current event " << ntracks << endl; // number of primary tracked tracks diff --git a/TOF/AliTOFReconstructionerV2.cxx b/TOF/AliTOFReconstructionerV2.cxx index dd127fa4fcf..33e6093949f 100644 --- a/TOF/AliTOFReconstructionerV2.cxx +++ b/TOF/AliTOFReconstructionerV2.cxx @@ -13,41 +13,46 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + //_________________________________________________________________________ // This is a TTask for reconstruction V2 in TOF // Description of the algorithm //-- Author: F. Pierella | pierella@bo.infn.it ////////////////////////////////////////////////////////////////////////////// -#include "TBenchmark.h" -#include "TFile.h" -#include "TFolder.h" -#include "TParticle.h" -#include "TTask.h" -#include "TTree.h" -#include "TClonesArray.h" -#include "TROOT.h" -#include "TSystem.h" -#include -#include + #include -#include "TGeant3.h" -#include "TVirtualMC.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../TPC/AliTPCtrack.h" +#include "../TRD/AliTRDtrack.h" #include "AliDetector.h" +#include "AliHeader.h" +#include "AliKalmanTrack.h" +#include "AliLoader.h" #include "AliRun.h" +#include "AliRunLoader.h" #include "AliTOF.h" +#include "AliTOFConstants.h" #include "AliTOFDigitMap.h" #include "AliTOFHitMap.h" -#include "AliTOFhitT0.h" -#include "AliTOFdigit.h" -#include "AliTOFConstants.h" #include "AliTOFReconstructionerV2.h" #include "AliTOFTrackV2.h" - -#include "AliKalmanTrack.h" -#include "../TPC/AliTPCtrack.h" -#include "../TRD/AliTRDtrack.h" +#include "AliTOFdigit.h" +#include "AliTOFhitT0.h" ClassImp(AliTOFReconstructionerV2) @@ -935,33 +940,44 @@ void AliTOFReconstructionerV2::Comparison(Int_t* rtIndex) Int_t nEvent = 0; - Char_t *alifile = "galice.root"; - - TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile); - if (!gafl) { - cout << "Open the ALIROOT-file " << alifile << endl; - gafl = new TFile(alifile); - } - else { - cout << alifile << " is already open" << endl; - } + Char_t *datafile = "galice.root"; + AliRunLoader *rl = AliRunLoader::Open(datafile); + if (rl == 0x0) + { + Error("Exec","Can not open session for file %s",datafile); + return; + } // Get AliRun object from file or create it if not on file - gAlice = (AliRun*) gafl->Get("gAlice"); + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); if (gAlice) cout << "AliRun object found on file" << endl; else gAlice = new AliRun("gAlice","Alice test program"); + + + AliTOF* TOF = (AliTOF *) gAlice->GetDetector ("TOF"); + // Import the Trees for the event nEvent in the file - const Int_t nparticles = gAlice->GetEvent(nEvent); + rl->GetEvent(nEvent); + const Int_t nparticles = rl->GetNumberOfEvents(); if (nparticles <= 0) return; + AliLoader* tofloader = rl->GetLoader("TOFLoader"); + if (tofloader == 0x0) + { + Error("AliTOFReconstructioner","Can not get TOF Loader from Run Loader."); + delete rl; + return; + } + // Get pointers to Alice detectors and Hits containers - AliDetector *TOF = gAlice->GetDetector("TOF"); - Int_t ntracks = (Int_t) gAlice->TreeH()->GetEntries(); - + tofloader->LoadHits(); + Int_t ntracks = (Int_t) tofloader->TreeH()->GetEntries(); + TOF->SetTreeAddress(); // Start loop on tracks in the hits containers for (Int_t track=0; track < ntracks; track++) { diff --git a/TOF/AliTOFSDigit.cxx b/TOF/AliTOFSDigit.cxx index 561a992baea..1495a744182 100644 --- a/TOF/AliTOFSDigit.cxx +++ b/TOF/AliTOFSDigit.cxx @@ -13,6 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ //_________________________________________________________________________ // TOF sdigit: member variables @@ -32,10 +33,10 @@ #include "TArrayF.h" #include "TArrayI.h" +#include "AliRun.h" #include "AliTOF.h" -#include "AliTOFSDigit.h" #include "AliTOFConstants.h" -#include "AliRun.h" +#include "AliTOFSDigit.h" ClassImp(AliTOFSDigit) diff --git a/TOF/AliTOFSDigitizer.cxx b/TOF/AliTOFSDigitizer.cxx index ca3a93343af..79845a73f1e 100644 --- a/TOF/AliTOFSDigitizer.cxx +++ b/TOF/AliTOFSDigitizer.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + //_________________________________________________________________________ // This is a TTask that constructs SDigits out of Hits // A Summable Digits is the "sum" of all hits in a pad @@ -23,34 +25,36 @@ // Use case: see AliTOFhits2sdigits.C macro in the CVS ////////////////////////////////////////////////////////////////////////////// -#include "TBenchmark.h" -#include "TTask.h" -#include "TTree.h" -#include "TSystem.h" -#include "TParticle.h" -#include "TH1.h" -#include "TFile.h" -#include "TROOT.h" -#include "TFolder.h" -#include -#include -#include + #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliDetector.h" +#include "AliLoader.h" +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliTOF.h" +#include "AliTOFConstants.h" #include "AliTOFHitMap.h" #include "AliTOFSDigit.h" -#include "AliTOFConstants.h" +#include "AliTOFSDigitizer.h" #include "AliTOFhit.h" #include "AliTOFhitT0.h" -#include "AliTOF.h" #include "AliTOFv1.h" #include "AliTOFv2.h" #include "AliTOFv3.h" #include "AliTOFv4.h" -#include "AliTOFSDigitizer.h" -#include "AliRun.h" -#include "AliDetector.h" - ClassImp(AliTOFSDigitizer) @@ -58,6 +62,9 @@ ClassImp(AliTOFSDigitizer) AliTOFSDigitizer::AliTOFSDigitizer():TTask("AliTOFSDigitizer","") { // ctor + + fRunLoader = 0 ; + fEvent1=0; fEvent2=0; ftail = 0; @@ -66,7 +73,7 @@ ClassImp(AliTOFSDigitizer) } //____________________________________________________________________________ - AliTOFSDigitizer::AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1, Int_t nEvents):TTask("AliTOFSDigitizer","") + AliTOFSDigitizer::AliTOFSDigitizer(char* HeaderFile, Int_t evNumber1, Int_t nEvents):TTask("AliTOFSDigitizer","") { fEvent1=evNumber1; fEvent2=fEvent1+nEvents; @@ -88,8 +95,19 @@ ClassImp(AliTOFSDigitizer) InitParameters(); // add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + fRunLoader = AliRunLoader::Open(HeaderFile);//open session and mount on default event folder + if (fRunLoader == 0x0) + { + Fatal("AliTOFSDigitizer","Event is not loaded. Exiting"); + return; + } + AliLoader* gime = fRunLoader->GetLoader("TOFLoader"); + if (gime == 0x0) + { + Fatal("AliTOFSDigitizer","Can not find TOF loader in event. Exiting."); + return; + } + gime->PostSDigitizer(this); } //____________________________________________________________________________ @@ -158,10 +176,17 @@ Double_t TimeWithTail(Double_t* x, Double_t* par) //____________________________________________________________________________ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) { + fRunLoader->LoadgAlice(); + fRunLoader->LoadHeader(); + gAlice = fRunLoader->GetAliRun(); + + AliLoader* gime = fRunLoader->GetLoader("TOFLoader"); + gime->LoadHits("read"); + gime->LoadSDigits("recreate"); if(strstr(verboseOption,"tim") || strstr(verboseOption,"all")) gBenchmark->Start("TOFSDigitizer"); - AliTOF *TOF = (AliTOF *) gAlice->GetDetector ("TOF"); + AliTOF *TOF = (AliTOF *) gAlice->GetDetector("TOF"); if (!TOF) { Error("AliTOFSDigitizer","TOF not found"); @@ -208,19 +233,20 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) { Int_t nnoisesdigitsinEv=0; Int_t nsignalsdigitsinEv=0; - gAlice->GetEvent(ievent); - TTree *TH = gAlice->TreeH (); + fRunLoader->GetEvent(ievent); + TOF->SetTreeAddress(); + TTree *TH = gime->TreeH (); if (!TH) return; - if (gAlice->TreeS () == 0) - gAlice->MakeTree ("S"); + if (gime->TreeS () == 0) + gime->MakeTree ("S"); //Make branches char branchname[20]; sprintf (branchname, "%s", TOF->GetName ()); //Make branch for digits - TOF->MakeBranch ("S"); + TOF->MakeBranch("S"); //Now made SDigits from hits @@ -381,10 +407,10 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) { delete hitMap; - gAlice->TreeS()->Reset(); - gAlice->TreeS()->Fill(); + gime->TreeS()->Reset(); + gime->TreeS()->Fill(); //gAlice->TreeS()->Write(0,TObject::kOverwrite) ; - gAlice->TreeS()->AutoSave(); + gime->WriteSDigits("OVERWRITE"); if(strstr(verboseOption,"all")){ cout << "----------------------------------------" << endl; diff --git a/TOF/AliTOFSDigitizer.h b/TOF/AliTOFSDigitizer.h index ecb58f04dae..7a8f683223b 100644 --- a/TOF/AliTOFSDigitizer.h +++ b/TOF/AliTOFSDigitizer.h @@ -12,8 +12,7 @@ #include "TTask.h" #include "TString.h" -#include "AliTOF.h" -#include "AliDetector.h" +class AliRunLoader; class TF1; @@ -21,12 +20,12 @@ class AliTOFSDigitizer: public TTask { public: AliTOFSDigitizer() ; // ctor - AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1=0, Int_t nEvents=1) ; // par ctor + AliTOFSDigitizer(char* HeaderFile, Int_t evNumber1=0, Int_t nEvents=1) ; // par ctor virtual ~AliTOFSDigitizer() ; // dtor virtual void Exec(Option_t *verboseOption, Option_t *allEvents="noAll"); - void SetSDigitsFile(const char* file ) {;} + void SetSDigitsFile(char * file ) {;} void InitParameters(); virtual void PrintParameters() const ; @@ -108,6 +107,9 @@ private: Int_t fEvent2; // upper bound for events to sdigitize TF1 *ftail; // pointer to formula for time with tail TString fHeadersFile; // input file + AliRunLoader* fRunLoader; //! Run Loader + + Int_t fSelectedSector; // sector number for sdigitization Int_t fSelectedPlate ; // plate number for sdigitization diff --git a/TOF/AliTOFT0.cxx b/TOF/AliTOFT0.cxx index 45edb289112..dbea17e638b 100644 --- a/TOF/AliTOFT0.cxx +++ b/TOF/AliTOFT0.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + //_________________________________________________________________________ // This is a TTask that made the calculation of the Time zero using TOF. // Description: The algorithm used to calculate the time zero of interaction @@ -61,27 +63,29 @@ //-- Author: F. Pierella ////////////////////////////////////////////////////////////////////////////// +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliDetector.h" +#include "AliRun.h" +#include "AliTOF.h" #include "AliTOFT0.h" #include "AliTOFhitT0.h" -#include "AliTOF.h" #include "AliTOFv4T0.h" -#include "AliRun.h" -#include "AliDetector.h" - -#include "TH1.h" -#include "TFile.h" -#include "TTask.h" -#include "TTree.h" -#include "TSystem.h" -#include "TCanvas.h" -#include "TFrame.h" -#include "TROOT.h" -#include "TFolder.h" -#include "TBenchmark.h" -#include "TParticle.h" -#include "TClonesArray.h" -#include -#include ClassImp(AliTOFT0) @@ -222,7 +226,7 @@ void AliTOFT0::Exec(Option_t *option) for (Int_t ievent = 0; ievent < fNevents; ievent++) { gAlice->GetEvent(ievent); - TTree *TH = gAlice->TreeH (); + TTree *TH = TOF->TreeH (); if (!TH) return; TParticle* particle; diff --git a/TOF/AliTOFdigit.cxx b/TOF/AliTOFdigit.cxx index f18682a27d3..f306d7b044b 100644 --- a/TOF/AliTOFdigit.cxx +++ b/TOF/AliTOFdigit.cxx @@ -1,18 +1,3 @@ -//_________________________________________________________________________ -// TOF digit: member variables -// fSector : TOF sector -// fPlate : TOF plate -// fStrip : strips number -// fPadx : pad number along x -// fPadz : pad number along z -// fTdc : TDC -// fAdc : ADC -// -// Getters, setters and member functions defined here -// -//*-- Authors: F. Pierella, A. Seganti, D. Vicinanza - - /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * @@ -28,11 +13,28 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + +//_________________________________________________________________________ +// TOF digit: member variables +// fSector : TOF sector +// fPlate : TOF plate +// fStrip : strips number +// fPadx : pad number along x +// fPadz : pad number along z +// fTdc : TDC +// fAdc : ADC +// +// Getters, setters and member functions defined here +// +//*-- Authors: F. Pierella, A. Seganti, D. Vicinanza + + #include +#include "AliRun.h" #include "AliTOF.h" #include "AliTOFdigit.h" -#include "AliRun.h" ClassImp(AliTOFdigit) diff --git a/TOF/AliTOFv0.cxx b/TOF/AliTOFv0.cxx index e979252e966..ae5583e69a6 100644 --- a/TOF/AliTOFv0.cxx +++ b/TOF/AliTOFv0.cxx @@ -13,72 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.29 2002/10/22 14:26:28 alibrary -Introducing Riostream.h - -Revision 1.28 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.25.6.4 2002/10/11 10:56:40 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.27 2002/07/24 16:13:56 vicinanz -Fixed bub in BuildGeometry - -Revision 1.26 2002/05/08 13:24:50 vicinanz -AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code - -Revision 1.25 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -Revision 1.23 2001/09/27 10:39:20 vicinanz -SDigitizer and Merger added - -Revision 1.22 2001/09/20 15:54:22 vicinanz -Updated Strip Structure (Double Stack) - -Revision 1.21 2001/08/28 08:45:59 vicinanz -TTask and TFolder structures implemented - -Revision 1.9 2001/05/04 10:09:48 vicinanz -Major upgrades to the strip structure - -Revision 1.8 2000/12/04 08:48:20 alibrary -Fixing problems in the HEAD - -Revision 1.7 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.4.2.1 2000/05/10 09:37:16 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.14 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.13 1999/11/02 11:26:39 fca -added stdlib.h for exit - -Revision 1.12 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/10/22 08:04:14 fca -Correct improper use of negative parameters - -Revision 1.10 1999/10/16 19:30:06 fca -Corrected Rotation Matrix and CVS log - -Revision 1.9 1999/10/15 15:35:20 fca -New version for frame1099 with and without holes - -Revision 1.8 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -111,15 +46,16 @@ Introduction of the Copyright and cvs Log #include #include -#include "AliTOFv0.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliRun.h" +#include "AliTOFv0.h" ClassImp(AliTOFv0) diff --git a/TOF/AliTOFv1.cxx b/TOF/AliTOFv1.cxx index 363de60bd06..638a1b94472 100644 --- a/TOF/AliTOFv1.cxx +++ b/TOF/AliTOFv1.cxx @@ -13,85 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.32 2002/10/22 14:26:28 alibrary -Introducing Riostream.h - -Revision 1.31 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.27.6.3 2002/07/25 06:24:27 alibrary -Updating TOF on VirtualMC - -Revision 1.30 2002/07/24 16:13:56 vicinanz -Fixed bub in BuildGeometry - -Revision 1.29 2002/06/24 14:09:12 vicinanz -review on materials and - -Revision 1.28 2002/05/08 13:24:50 vicinanz -AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code - -Revision 1.27 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - - -Revision 1.26 2001/11/13 14:36:40 vicinanz -Updated check for ppad[1] range - -Revision 1.24 2001/09/27 10:39:20 vicinanz -SDigitizer and Merger added - -Revision 1.23 2001/09/20 15:54:22 vicinanz -Updated Strip Structure (Double Stack) - -Revision 1.22 2001/08/28 08:45:59 vicinanz -TTask and TFolder structures implemented - -Revision 1.21 2001/05/16 14:57:24 alibrary -New files for folders and Stack - -Revision 1.20 2001/05/04 10:09:48 vicinanz -Major upgrades to the strip structure - -Revision 1.19 2000/12/04 08:48:20 alibrary -Fixing problems in the HEAD - -Revision 1.18 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.17 2000/06/06 07:52:09 vicinanz -NodeName array dimension enlarged - -Revision 1.16 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.14 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.13 1999/11/02 11:26:39 fca -added stdlib.h for exit - -Revision 1.12 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/10/22 08:04:14 fca -Correct improper use of negative parameters - -Revision 1.10 1999/10/16 19:30:06 fca -Corrected Rotation Matrix and CVS log - -Revision 1.9 1999/10/15 15:35:20 fca -New version for frame1099 with and without holes - -Revision 1.8 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -124,16 +46,17 @@ Introduction of the Copyright and cvs Log #include #include -#include "AliTOFv1.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" -#include "TObject.h" +#include +#include #include -#include "AliRun.h" -#include "AliMagF.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliMagF.h" +#include "AliRun.h" +#include "AliTOFv1.h" ClassImp(AliTOFv1) diff --git a/TOF/AliTOFv2.cxx b/TOF/AliTOFv2.cxx index 1fcf6865a2f..7689cc59815 100644 --- a/TOF/AliTOFv2.cxx +++ b/TOF/AliTOFv2.cxx @@ -13,81 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.31 2002/11/21 22:46:24 alibrary -Removing AliMC and AliMCProcess - -Revision 1.30 2002/10/22 14:26:28 alibrary -Introducing Riostream.h - -Revision 1.29 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.25.6.3 2002/07/25 06:24:27 alibrary -Updating TOF on VirtualMC - -Revision 1.28 2002/07/24 16:13:56 vicinanz -Fixed bub in BuildGeometry - -Revision 1.27 2002/06/24 14:09:12 vicinanz -review on materials and - -Revision 1.26 2002/05/08 13:24:50 vicinanz -AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code - -Revision 1.25 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -Revision 1.23 2001/09/27 10:39:20 vicinanz -SDigitizer and Merger added - -Revision 1.22 2001/09/20 15:54:22 vicinanz -Updated Strip Structure (Double Stack) - -Revision 1.21 2001/08/28 08:45:59 vicinanz -TTask and TFolder structures implemented - -Revision 1.20 2001/05/16 14:57:24 alibrary -New files for folders and Stack - -Revision 1.19 2001/05/04 10:09:48 vicinanz -Major upgrades to the strip structure - -Revision 1.18 2000/12/04 08:48:20 alibrary -Fixing problems in the HEAD - -Revision 1.17 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.16 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.14 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.13 1999/11/02 11:26:39 fca -added stdlib.h for exit - -Revision 1.12 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/10/22 08:04:14 fca -Correct improper use of negative parameters - -Revision 1.10 1999/10/16 19:30:06 fca -Corrected Rotation Matrix and CVS log - -Revision 1.9 1999/10/15 15:35:20 fca -New version for frame1099 with and without holes - -Revision 1.8 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -120,16 +46,17 @@ Introduction of the Copyright and cvs Log #include #include -#include "AliTOFv2.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliMagF.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliMagF.h" +#include "AliRun.h" +#include "AliTOFv2.h" ClassImp(AliTOFv2) @@ -527,7 +454,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.); gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); - if(fDebug>=1) { + if(fDebug) { printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); } diff --git a/TOF/AliTOFv2FHoles.cxx b/TOF/AliTOFv2FHoles.cxx index 14cf1f7f24c..24d7a0abf96 100644 --- a/TOF/AliTOFv2FHoles.cxx +++ b/TOF/AliTOFv2FHoles.cxx @@ -13,7 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -46,16 +46,17 @@ #include #include -#include "AliTOFv2FHoles.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliMagF.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliMagF.h" +#include "AliRun.h" +#include "AliTOFv2FHoles.h" ClassImp(AliTOFv2FHoles) @@ -381,8 +382,6 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, // positioning the central PCB layer gMC->Gspos("FPCB",3,"FSTR",0.,0.,0.,0,"ONLY"); - - //-- MYLAR Layer definition parfp[1] = khmyly*0.5; gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3); diff --git a/TOF/AliTOFv3.cxx b/TOF/AliTOFv3.cxx index bbd5b53f58c..71b5b6f1db0 100644 --- a/TOF/AliTOFv3.cxx +++ b/TOF/AliTOFv3.cxx @@ -13,81 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.31 2002/11/21 22:46:24 alibrary -Removing AliMC and AliMCProcess - -Revision 1.30 2002/10/22 14:26:28 alibrary -Introducing Riostream.h - -Revision 1.29 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.25.6.3 2002/07/25 06:24:28 alibrary -Updating TOF on VirtualMC - -Revision 1.28 2002/07/24 16:13:56 vicinanz -Fixed bub in BuildGeometry - -Revision 1.27 2002/06/24 14:09:12 vicinanz -review on materials and - -Revision 1.26 2002/05/08 13:24:50 vicinanz -AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code - -Revision 1.25 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -Revision 1.23 2001/09/27 10:39:20 vicinanz -SDigitizer and Merger added - -Revision 1.22 2001/09/20 15:54:22 vicinanz -Updated Strip Structure (Double Stack) - -Revision 1.21 2001/08/28 08:45:59 vicinanz -TTask and TFolder structures implemented - -Revision 1.20 2001/05/16 14:57:24 alibrary -New files for folders and Stack - -Revision 1.19 2001/05/04 10:09:48 vicinanz -Major upgrades to the strip structure - -Revision 1.18 2000/12/04 08:48:20 alibrary -Fixing problems in the HEAD - -Revision 1.17 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.16 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.14 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.13 1999/11/02 11:26:39 fca -added stdlib.h for exit - -Revision 1.12 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/10/22 08:04:14 fca -Correct improper use of negative parameters - -Revision 1.10 1999/10/16 19:30:06 fca -Corrected Rotation Matrix and CVS log - -Revision 1.9 1999/10/15 15:35:20 fca -New version for frame1099 with and without holes - -Revision 1.8 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -120,15 +46,16 @@ Introduction of the Copyright and cvs Log #include #include -#include "AliTOFv3.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliRun.h" +#include "AliTOFv3.h" ClassImp(AliTOFv3) diff --git a/TOF/AliTOFv4.cxx b/TOF/AliTOFv4.cxx index 2871e3968d0..c781051868f 100644 --- a/TOF/AliTOFv4.cxx +++ b/TOF/AliTOFv4.cxx @@ -13,81 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2002/11/21 22:46:24 alibrary -Removing AliMC and AliMCProcess - -Revision 1.20 2002/10/22 14:26:28 alibrary -Introducing Riostream.h - -Revision 1.19 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.6.3 2002/07/25 06:24:28 alibrary -Updating TOF on VirtualMC - -Revision 1.18 2002/07/24 16:13:56 vicinanz -Fixed bub in BuildGeometry - -Revision 1.17 2002/06/24 14:09:12 vicinanz -review on materials and - -Revision 1.16 2002/05/08 13:24:50 vicinanz -AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code - -Revision 1.15 2001/11/22 11:22:51 hristov -Updated version of TOF digitization, N^2 problem solved (J.Chudoba) - -Revision 1.13 2001/09/27 10:39:21 vicinanz -SDigitizer and Merger added - -Revision 1.12 2001/09/20 15:54:22 vicinanz -Updated Strip Structure (Double Stack) - -Revision 1.11 2001/08/28 08:45:59 vicinanz -TTask and TFolder structures implemented - -Revision 1.10 2001/05/16 14:57:24 alibrary -New files for folders and Stack - -Revision 1.9 2001/05/04 10:09:48 vicinanz -Major upgrades to the strip structure - -Revision 1.8 2000/12/04 08:48:20 alibrary -Fixing problems in the HEAD - -Revision 1.7 2000/10/02 21:28:17 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/05/10 16:52:18 vicinanz -New TOF version with holes for PHOS/RICH - -Revision 1.4.2.1 2000/05/10 09:37:16 vicinanz -New version with Holes for PHOS/RICH - -Revision 1.14 1999/11/05 22:39:06 fca -New hits structure - -Revision 1.13 1999/11/02 11:26:39 fca -added stdlib.h for exit - -Revision 1.12 1999/11/01 20:41:57 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/10/22 08:04:14 fca -Correct improper use of negative parameters - -Revision 1.10 1999/10/16 19:30:06 fca -Corrected Rotation Matrix and CVS log - -Revision 1.9 1999/10/15 15:35:20 fca -New version for frame1099 with and without holes - -Revision 1.8 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -120,15 +46,16 @@ Introduction of the Copyright and cvs Log #include #include -#include "AliTOFv4.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliRun.h" +#include "AliTOFv4.h" ClassImp(AliTOFv4) diff --git a/TOF/AliTOFv4T0.cxx b/TOF/AliTOFv4T0.cxx index 3b68228e604..598514b1e88 100644 --- a/TOF/AliTOFv4T0.cxx +++ b/TOF/AliTOFv4T0.cxx @@ -13,6 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // @@ -40,15 +41,16 @@ #include #include "TVirtualMC.h" -#include "AliTOFv4T0.h" -#include "TBRIK.h" -#include "TGeometry.h" -#include "TNode.h" +#include +#include #include -#include "TObject.h" -#include "AliRun.h" -#include "AliConst.h" +#include +#include +#include +#include "AliConst.h" +#include "AliRun.h" +#include "AliTOFv4T0.h" ClassImp(AliTOFv4T0) @@ -808,7 +810,8 @@ void AliTOFv4T0::DrawDetectorModules() // Draw a shaded view of the TOF detector version 4 // - //Set ALIC mother transparent + +//Set ALIC mother transparent gMC->Gsatt("ALIC","SEEN",0); // diff --git a/TPC/AliBarrelReconstruction.C b/TPC/AliBarrelReconstruction.C index eab6492a4f7..358e2fc3cc0 100644 --- a/TPC/AliBarrelReconstruction.C +++ b/TPC/AliBarrelReconstruction.C @@ -13,9 +13,14 @@ #ifndef __CINT__ #include "alles.h" + #include "iostream.h" + #include "AliRun.h" + #include "AliRunLoader.h" + #include "AliLoader.h" + #include "AliTPCLoader.h" + #include "AliITSLoader.h" #include "AliMagF.h" #include "AliTPCtracker.h" - #include "AliITS.h" #include "AliITSgeom.h" #include "AliITSRecPoint.h" @@ -24,249 +29,392 @@ #include "AliITStrackerV2.h" #endif -Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n); -Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n); -Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n); -Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname); - -Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n); -Int_t ITSFindTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n); -Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname); - - -Int_t AliBarrelReconstruction(Int_t n=1) { - const Char_t *TPCdigName="rfio:galice.root"; - const Char_t *TPCclsName="AliTPCclusters.root"; - const Char_t *TPCtrkName="AliTPCtracks.root"; - const Char_t *TPCtrkNameS="AliTPCtracksSorted.root"; - - const Char_t *ITSdigName="rfio:galice.root"; - const Char_t *ITSclsName="AliITSclustersV2.root"; - const Char_t *ITStrkName="AliITStracksV2.root"; - - AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor()); +Int_t TPCFindClusters( Int_t n); +Int_t TPCFindTracks(Int_t n); +Int_t TPCSortTracks(const Char_t *outname, Int_t n); +Int_t TPCPropagateBack(); + +Int_t ITSFindClusters(Int_t n); +Int_t ITSFindTracks(const Char_t *inname2, Int_t n); +Int_t ITSPropagateBack(); + +const char* TPCtrkNameS= "TPC.TracksSorted.root"; + +class AliRunLoader; +class AliTPCLoader; +class AliTPCParam; +AliRunLoader *rl = 0x0; +AliTPCLoader *tpcl = 0x0; +AliTPCParam *param = 0x0; +Bool_t debug = kFALSE; +Int_t AliBarrelReconstruction(Int_t n=1) + { + + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"Can not open session"<LoadgAlice()) + { + cerr<<"Error occured while l"<GetAliRun()->Field()->SolenoidField()); + + tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"Can not get TPC Loader"<Close(); - } + cout<<"Stopping on ITSFindTracks\n"; + delete rl; + rl = 0x0; + return 0; return 1; + // ********** Back propagation of the ITS tracks *********** // - {TFile *clsFile=TFile::Open(ITSclsName); - if (ITSPropagateBack(ITStrkName,TPCtrkNameS)) { + if ( ITSPropagateBack() ) { cerr<<"Failed to propagate back the ITS tracks !\n"; return 1; } - clsFile->Close();} // ********** Back propagation of the TPC tracks *********** // - {TFile *clsFile=TFile::Open(TPCclsName); - if (TPCPropagateBack(TPCtrkName,TPCtrkName)) { + + if (TPCPropagateBack()) { cerr<<"Failed to propagate back the TPC tracks !\n"; return 1; } - clsFile->Close();} return 0; } -Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) { +Int_t TPCFindClusters(Int_t n) + { Int_t rc=0; const Char_t *name="TPCFindClusters"; cerr<<'\n'<Start(name); + rl->CdGAFile(); + param=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + param=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + } +// param->Dump(); + param->Update(); - TFile *out=TFile::Open(outname,"recreate"); - TFile *in =TFile::Open(inname); + gBenchmark->Start(name); - AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60"); - if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;} AliTPCv2 tpc; tpc.SetParam(param); + tpc.SetLoader(tpcl); + + tpcl->LoadDigits("read"); + tpcl->LoadRecPoints("recreate"); + //tpc.Digits2Clusters(out); //MI change - for (Int_t i=0;iClose(); - out->Close(); + for (Int_t i=0;iUnloadDigits(); + tpcl->UnloadRecPoints(); gBenchmark->Stop(name); gBenchmark->Show(name); return rc; } -Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n) { +Int_t TPCFindTracks(Int_t n) { + Int_t rc=0; + AliTPCtracker *tracker = 0x0; const Char_t *name="TPCFindTracks"; - cerr<<'\n'<GetEvent(0); + rl->CdGAFile(); + param=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + + if (!param) + { + param=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + } +// param->Dump(); + param->Update(); + gBenchmark->Start(name); - TFile *out=TFile::Open(outname,"recreate"); - TFile *in =TFile::Open(inname); - AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60"); - if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;} + + tpcl->LoadRecPoints("read"); + tpcl->LoadTracks("recreate"); //AliTPCtracker *tracker=new AliTPCtracker(param); //rc=tracker->Clusters2Tracks(0,out); //delete tracker; - + for (Int_t i=0;iGetEvent(i); printf("Processing event %d\n",i); - AliTPCtracker *tracker = new AliTPCtracker(param,i); + + tracker = new AliTPCtracker(param, i, AliConfig::fgkDefaultEventFolderName.Data()); //Int_t rc= - tracker->Clusters2Tracks(0,out); + tracker->Clusters2Tracks(); delete tracker; } + tpcl->UnloadRecPoints(); + tpcl->UnloadTracks(); - in->Close(); - out->Close(); gBenchmark->Stop(name); gBenchmark->Show(name); return rc; } -Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t * outname, Int_t eventn){ - Int_t rc=0; - const Char_t *name="TPCSortTracks"; - cerr<<'\n'<Start(name); - - TFile *out =TFile::Open(outname,"recreate"); - TFile *in1 =TFile::Open(inname); - TFile *in2 =TFile::Open(inname2); - AliTPCParam *param=(AliTPCParam *)in1->Get("75x40_100x60"); - if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;} - +Int_t TPCSortTracks(const Char_t * outname, Int_t eventn){ + Int_t rc=0; + const Char_t *name="TPCSortTracks"; + cerr<<'\n'<CdGAFile(); + param=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + param=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + } + param->Update(); + gBenchmark->Start(name); + + + AliRunLoader* rl2 = AliRunLoader::Open("galice.root","tmp"); + + AliLoader* tpcl2 = (AliTPCLoader*)rl2->GetLoader("TPCLoader"); + cout<<"tpcl2->SetTracksFileName("<SetTracksFileName(TString(outname)); + tpcl2->LoadTracks("recreate"); + // loop over events - for (Int_t event=0;eventGetEvent(event); + rl2->GetEvent(event); + TObjArray tarray(10000); AliTPCtrack *iotrack=0; Int_t i; - - - in2->cd(); - char tname[100]; - sprintf(tname,"TreeT_TPC_%d",event); - - TTree *tracktree=(TTree*)in2->Get(tname); + + if (tpcl->TreeT() == 0x0) tpcl->LoadTracks("read"); + TTree *tracktree=tpcl->TreeT(); + if (tracktree == 0x0) + { + cerr<<"Can not get TreeT for event "<GetBranch("tracks"); Int_t nentr=(Int_t)tracktree->GetEntries(); - for (i=0; iLoadInnerSectors(); tracker->LoadOuterSectors(); - for (i=0; iCookLabel(iotrack,0.1); - } + } + cout<<"deleting tracker\n"; delete tracker; //in->Close(); //end of GEANT label assignment - tracktree=new TTree(tname,"Tree with TPC tracks"); + + if (tpcl2->TreeT() == 0x0) tpcl2->MakeTree("T"); + tracktree= tpcl2->TreeT(); + if (tracktree == 0x0) + { + cerr<<"Can not get TreeT for Sorted tracks\n"; + return 1; + } tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0); for (i=0; iFill(); } - out->cd(); - tracktree->Write(); + + cout<<" Tracks File Name is "<GetTracksFileName()<WriteTracks("OVERWRITE"); } + - out->Close(); - in2->Close(); - in1->Close(); + delete rl2; + tpcl->UnloadTracks(); + tpcl->UnloadRecPoints(); + gBenchmark->Stop(name); gBenchmark->Show(name); return rc; } -Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) { +Int_t ITSFindClusters(Int_t n) + { Int_t rc=0; const Char_t *name="ITSFindClusters"; cerr<<'\n'<Start(name); - TFile *out=TFile::Open(outname,"recreate"); - TFile *in =TFile::Open(inname,"update"); - if (!(gAlice=(AliRun*)in->Get("gAlice"))) { + if (rl->GetEvent(0)) + { + cerr<<"Problems\n"; + return 1; + } + + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if (itsl == 0x0) + { + cerr<<"Can not get ITS Loader from Run Loader\n"; + return 1; + } + + gAlice=rl->GetAliRun(); + if (!gAlice) { cerr<<"Can't get gAlice !\n"; return 1; } - + if (rl->TreeK() == 0x0) rl->LoadKinematics(); + if (rl->TreeE() == 0x0) rl->LoadHeader(); + + itsl->LoadRawClusters("recreate"); + AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); if (!ITS) { cerr<<"Can't get the ITS !\n"; return 1;} AliITSgeom *geom=ITS->GetITSgeom(); - out->cd(); - geom->Write(); - + Int_t ev=0; - for (ev = 0; evcd(); // !!!! MI directory must point to galice. - othervise problem with Tree -connection - gAlice->GetEvent(ev); - //gAlice->TreeR()->Reset(); //reset reconstructed tree + for (ev = 0; evGetEvent(ev); + TBranch *branch = 0x0; + TTree *pTree = 0x0; - TTree *pTree=gAlice->TreeR(); - if (!pTree){ - gAlice->MakeTree("R"); - pTree = gAlice->TreeR(); - } - TBranch *branch=pTree->GetBranch("ITSRecPoints"); - if (!branch) { + pTree=itsl->TreeR(); + if (pTree == 0x0) + { + itsl->LoadRecPoints("read"); + pTree=itsl->TreeR(); + if (pTree == 0x0) + { + ::Error("AliBarrelReonstruction.C::ITSFindClusters", + "Can not get TreeR for event %d",ev); + return 1; + } + } + + pTree=itsl->TreeR(); + branch=(pTree)?pTree->GetBranch("ITSRecPoints"):0x0; + + if (branch== 0x0) { //if not reconstructed ITS branch do reconstruction - ITS->MakeBranch("R",0); + if (debug) ::Info("AliBarrelReconstruction.C","Did not get ITSRecPoints from TreeR."); + if (debug) ::Info("AliBarrelReconstruction.C","Making branch and Producing RecPoints"); + itsl->SetRecPointsFileOption("recreate"); + if (itsl->TreeR()==0x0) itsl->MakeTree("R"); + + ITS->MakeBranch("RF"); + ITS->SetTreeAddress(); + itsl->LoadHits(); + //////////////// Taken from ITSHitsToFastPoints.C /////////////////////// for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,new AliITSsimulationFastPoints()); @@ -274,37 +422,52 @@ Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) { Int_t nsignal=25; Int_t size=-1; Int_t bgr_ev=Int_t(ev/nsignal); + ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," "); ////////////////////////////////////////////////////////////////////////// - gAlice->GetEvent(ev); //MI comment - in HitsToFast... they reset treeR to 0 + //MI comment - in HitsToFast... they reset treeR to 0 //they overwrite full reconstructed event ???? ... so lets connect TreeR one more //time + itsl->UnloadHits(); + ITS->SetTreeAddress(); } - - - out->cd(); TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000); - char cname[100]; - sprintf(cname,"TreeC_ITS_%d",ev); - - TTree *cTree=new TTree(cname,"ITS clusters"); - cTree->Branch("Clusters",&clusters); + + if (itsl->TreeC() == 0x0) itsl->MakeTree("C"); + TTree *cTree = itsl->TreeC(); + TBranch* b = cTree->GetBranch("Clusters"); + if (b == 0x0) + cTree->Branch("Clusters",&clusters); + else b->SetAddress(&clusters); - pTree=gAlice->TreeR(); - if (!pTree) { cerr<<"Can't get TreeR !\n"; return 1; } - branch=pTree->GetBranch("ITSRecPoints"); - if (!branch) { cerr<<"Can't get ITSRecPoints branch !\n"; return 1;} + + if (itsl->TreeR() == 0x0) itsl->LoadRecPoints(); + + if (branch == 0x0) + {//it means that we produced FastRecPoints above + pTree=itsl->TreeR(); + if (!pTree) { cerr<<"Can't get TreeR !\n"; return 1; } + branch=pTree->GetBranch("ITSRecPointsF"); + if (!branch) { cerr<<"Can't get Fast RecPoints branch named ITSRecPointsF !\n"; return 1;} + } TClonesArray *points=new TClonesArray("AliITSRecPoint",10000); branch->SetAddress(&points); TClonesArray &cl=*clusters; Int_t nclusters=0; - Int_t nentr=(Int_t)pTree->GetEntries(); + Int_t nentr=(Int_t)branch->GetEntries(); AliITSgeom *geom=ITS->GetITSgeom(); - - for (Int_t i=0; iGetEvent(i)) {cTree->Fill(); continue;} + + cout<<"\n\n Number of entries in TreeR = "<GetEvent(i)) + { + cTree->Fill(); + continue; + } + Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det); Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift); Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot); @@ -312,74 +475,97 @@ Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) { Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1); Int_t ncl=points->GetEntriesFast(); nclusters+=ncl; - for (Int_t j=0; jUncheckedAt(j); - Float_t lp[5]; - lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0]; - lp[1]=p->GetZ()+zshift; - lp[2]=p->GetSigmaX2(); - lp[3]=p->GetSigmaZ2(); - lp[4]=p->GetQ(); - Int_t lab[6]; - lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2); - lab[3]=ndet; - - Int_t label=lab[0]; - TParticle *part=(TParticle*)gAlice->Particle(label); - label=-3; - while (part->P() < 0.005) { - Int_t m=part->GetFirstMother(); - if (m<0) {cerr<<"Primary momentum: "<P()<Particle(label); - } - if (lab[1]<0) lab[1]=label; - else if (lab[2]<0) lab[2]=label; - else cerr<<"No empty labels !\n"; - - new(cl[j]) AliITSclusterV2(lab,lp); - } + + if (debug) ::Info("AliBarrelReconstruction.C", + "i=%d lay=%d lad=%d det=%d NRP=%d", + i, lay, lad, det, ncl); + + for (Int_t j=0; jUncheckedAt(j); + lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0]; + lp[1]=p->GetZ()+zshift; + lp[2]=p->GetSigmaX2(); + lp[3]=p->GetSigmaZ2(); + lp[4]=p->GetQ(); + lab[0]=p->GetLabel(0); + lab[1]=p->GetLabel(1); + lab[2]=p->GetLabel(2); + lab[3]=ndet; + + Int_t label=lab[0]; + if (label<0) continue; + TParticle *part=(TParticle*)rl->Stack()->Particle(label); + label=-3; + while (part->P() < 0.005) { + Int_t m=part->GetFirstMother(); + if (m<0) {cerr<<"Primary momentum: "<P()<Particle(label); + } + if (lab[1]<0) lab[1]=label; + else if (lab[2]<0) lab[2]=label; + else cerr<<"No empty labels !\n"; + + new(cl[j]) AliITSclusterV2(lab,lp); + } cTree->Fill(); clusters->Delete(); points->Delete(); } - cTree->Write(); + itsl->WriteRawClusters("OVERWRITE"); + cerr<<"Number of clusters: "<UnloadRecPoints(); + itsl->UnloadRawClusters(); + rl->UnloadKinematics(); - delete gAlice; gAlice=0; - in->Close(); - out->Close(); gBenchmark->Stop(name); gBenchmark->Show(name); return rc; } -Int_t ITSFindTracks(const Char_t * inname, const Char_t *inname2, const Char_t *outname, Int_t n) { +Int_t ITSFindTracks(const Char_t *inname2, Int_t n) +{ + Int_t rc=0; const Char_t *name="ITSFindTracks"; cerr<<'\n'<Start(name); + rl->GetEvent(0); - TFile *out=TFile::Open(outname,"recreate"); - TFile *in =TFile::Open(inname); - TFile *in2 =TFile::Open(inname2); - - AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom"); + AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + if ( (itsl == 0x0) || (tpcl == 0x0)) + { + cerr<<"Can not get ITS Loader from Run Loader\n"; + return 1; + } + + tpcl->SetTracksFileName(TString(inname2)); + if(rl->GetAliRun() == 0x0) rl->LoadgAlice(); + + AliITS* ITS = rl->GetAliRun()->GetModule("ITS"); + + rl->CdGAFile(); + AliITSgeom *geom=ITS->GetITSgeom(); if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;} + itsl->LoadTracks("recreate"); + itsl->LoadRawClusters("read"); + for (Int_t i=0;iGetEvent(i); + AliITStrackerV2 tracker(geom,i,AliConfig::fgkDefaultEventFolderName); + rc=tracker.Clusters2Tracks(); + } - for (Int_t i=0;iClose(); - in2->Close(); - out->Close(); gBenchmark->Stop(name); gBenchmark->Show(name); @@ -387,7 +573,8 @@ Int_t ITSFindTracks(const Char_t * inname, const Char_t *inname2, const Char_t * return rc; } -Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname) { +Int_t ITSPropagateBack() +{ Int_t rc=0; /* @@ -411,26 +598,36 @@ Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname) { return rc; } -Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname) { +Int_t TPCPropagateBack() +{ Int_t rc=0; const Char_t *name="TPCPropagateBack"; cerr<<'\n'<Start(name); - AliTPCParam *param=(AliTPCParam *)gFile->Get("75x40_100x60"); - if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;} - AliTPCtracker *tracker=new AliTPCtracker(param); + param=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + param=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + } +// param->Dump(); + param->Update(); - TFile *out=TFile::Open(outname,"update"); - TFile *in =TFile::Open(inname); - rc=tracker->PropagateBack(in,out); + AliTPCtracker *tracker = new AliTPCtracker(param, AliConfig::fgkDefaultEventFolderName); + +// TFile *out=TFile::Open(outname,"update"); +// TFile *in =TFile::Open(inname); + + rc=tracker->PropagateBack(); delete tracker; - in->Close(); - out->Close(); gBenchmark->Stop(name); gBenchmark->Show(name); return rc; } - diff --git a/TPC/AliClusters.cxx b/TPC/AliClusters.cxx index 26d1541ce91..bba208dc002 100644 --- a/TPC/AliClusters.cxx +++ b/TPC/AliClusters.cxx @@ -13,29 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2000/10/05 16:17:27 kowal2 -New class replacing AliCluster - -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.2 2000/06/14 16:45:13 kowal2 -Improved algorithms. Compiler warnings removed. - -Revision 1.2.4.1 2000/06/09 07:09:29 kowal2 - -Clustering and tracking classes are splitted from the simulation ones - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:34:02 kowal2 - -Clusters handling in a new data structure - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliClustersArray.cxx b/TPC/AliClustersArray.cxx index cda700aa07b..afd98b74d0e 100644 --- a/TPC/AliClustersArray.cxx +++ b/TPC/AliClustersArray.cxx @@ -13,35 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2000/10/05 15:59:31 kowal2 -Forward declarations. Changes due to a new class AliComplexCluster. - -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.2.4.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.2.4.2 2000/06/14 16:45:13 kowal2 -Improved algorithms. Compiler warnings removed. - -Revision 1.2.4.1 2000/06/09 07:09:29 kowal2 - -Clustering and tracking classes are splitted from the simulation ones - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:34:02 kowal2 - -Clusters handling in a new data structure - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliComplexCluster.cxx b/TPC/AliComplexCluster.cxx index 332a0c0d9b3..446c53319bb 100644 --- a/TPC/AliComplexCluster.cxx +++ b/TPC/AliComplexCluster.cxx @@ -13,16 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2001/02/05 14:43:13 hristov -Compare() declared const - -Revision 1.1 2000/10/05 16:17:27 kowal2 -New class replacing AliCluster - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliDetectorParam.cxx b/TPC/AliDetectorParam.cxx index a663b423751..b33db2fad04 100644 --- a/TPC/AliDetectorParam.cxx +++ b/TPC/AliDetectorParam.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1.4.2 2000/04/10 11:36:13 kowal2 - -New Detector parameters handling class - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Paramter class for AliDetector // diff --git a/TPC/AliDigitsArray.cxx b/TPC/AliDigitsArray.cxx index 3021fb38b27..192b3c384e6 100644 --- a/TPC/AliDigitsArray.cxx +++ b/TPC/AliDigitsArray.cxx @@ -13,19 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2000/10/05 16:03:07 kowal2 -Forward declarations. Destructor made virtual. - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:37:42 kowal2 - -Digits handling in a new data structure - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliSimDigits.cxx b/TPC/AliSimDigits.cxx index 479df5748ac..8feda021dda 100644 --- a/TPC/AliSimDigits.cxx +++ b/TPC/AliSimDigits.cxx @@ -13,54 +13,16 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2002/10/23 07:17:33 alibrary -Introducing Riostream.h - -Revision 1.6 2002/01/21 17:15:23 kowal2 -Better protection. - -Revision 1.5 2001/11/24 16:10:22 kowal2 -Faster algorithms. - -Revision 1.4 2000/10/05 16:01:49 kowal2 -Corrected for memory leaks. - -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.3 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.2.4.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.2.4.1 2000/06/14 16:45:13 kowal2 -Improved algorithms. Compiler warnings removed. - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:37:42 kowal2 - -Digits handling in a new data structure - -*/ - -// +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // // Alice segment manager object // -// -// AliSimDigits object (derived from AliDigits) // +// AliSimDigits object (derived from AliDigits) // // provide additional track information to digit // -// -// Origin: Marian Ivanov GSI Darmstadt // -// +// Origin: Marian Ivanov GSI Darmstadt // +// // // // -// // /////////////////////////////////////////////////////////////////////////////// #include "TClass.h" diff --git a/TPC/AliTPC.cxx b/TPC/AliTPC.cxx index 24a1d5a490a..f006ca43eca 100644 --- a/TPC/AliTPC.cxx +++ b/TPC/AliTPC.cxx @@ -13,196 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.67 2003/03/03 16:36:16 kowal2 -Added LoadTPCParam method - -Revision 1.66 2003/02/11 16:54:07 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.65 2002/11/21 22:43:32 alibrary -Removing AliMC and AliMCProcess - -Revision 1.64 2002/10/23 07:17:33 alibrary -Introducing Riostream.h - -Revision 1.63 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.54.4.3 2002/10/11 08:34:48 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.62 2002/09/23 09:22:56 hristov -The address of the TrackReferences is set (M.Ivanov) - -Revision 1.61 2002/09/10 07:06:42 kowal2 -Corrected for the memory leak. Thanks to J. Chudoba and M. Ivanov - -Revision 1.60 2002/06/12 14:56:56 kowal2 -Added track length to the reference hits - -Revision 1.59 2002/06/05 15:37:31 kowal2 -Added cross-talk from the wires beyond the first and the last rows - -Revision 1.58 2002/05/27 14:33:14 hristov -The new class AliTrackReference used (M.Ivanov) - -Revision 1.57 2002/05/07 17:23:11 kowal2 -Linear gain inefficiency instead of the step one at the wire edges. - -Revision 1.56 2002/04/04 16:26:33 kowal2 -Digits (Sdigits) go to separate files now. - -Revision 1.55 2002/03/29 06:57:45 kowal2 -Restored backward compatibility to use the hits from Dec. 2000 production. - -Revision 1.54 2002/03/18 17:59:13 kowal2 -Chnges in the pad geometry - 3 pad lengths introduced. - -Revision 1.53 2002/02/25 11:02:56 kowal2 -Changes towards speeding up the code. Thanks to Marian Ivanov. - -Revision 1.52 2002/02/18 09:26:09 kowal2 -Removed compiler warning - -Revision 1.51 2002/01/21 17:13:21 kowal2 -New track hits using root containers. Setting active sectors added. - -Revision 1.50 2001/12/06 14:16:19 kowal2 -meaningfull printouts - -Revision 1.49 2001/11/30 11:55:37 hristov -Noise table created in Hits2SDigits (M.Ivanov) - -Revision 1.48 2001/11/24 16:10:21 kowal2 -Faster algorithms. - -Revision 1.47 2001/11/19 10:25:34 kowal2 -Nearest integer instead of integer when converting to ADC counts - -Revision 1.46 2001/11/07 06:47:12 kowal2 -Removed printouts - -Revision 1.45 2001/11/03 13:33:48 kowal2 -Updated algorithms in Hits2SDigits, SDigits2Digits, -Hits2ExactClusters. -Added method Merge - -Revision 1.44 2001/08/30 09:28:48 hristov -TTree names are explicitly set via SetName(name) and then Write() is called - -Revision 1.43 2001/07/28 12:02:54 hristov -Branch split level set to 99 - -Revision 1.42 2001/07/28 11:38:52 hristov -Loop variable declared once - -Revision 1.41 2001/07/28 10:53:50 hristov -Digitisation done according to the general scheme (M.Ivanov) - -Revision 1.40 2001/07/27 13:03:14 hristov -Default Branch split level set to 99 - -Revision 1.39 2001/07/26 09:09:34 kowal2 -Hits2Reco method added - -Revision 1.38 2001/07/20 14:32:43 kowal2 -Processing of many events possible now - -Revision 1.37 2001/06/12 07:17:18 kowal2 -Hits2SDigits method implemented (summable digits) - -Revision 1.36 2001/05/16 14:57:25 alibrary -New files for folders and Stack - -Revision 1.35 2001/05/08 16:02:22 kowal2 -Updated material specifications - -Revision 1.34 2001/05/08 15:00:15 hristov -Corrections for tracking in arbitrary magnenetic field. Changes towards a concept of global Alice track. Back propagation of reconstructed tracks (Yu.Belikov) - -Revision 1.33 2001/04/03 12:40:43 kowal2 -Removed printouts - -Revision 1.32 2001/03/12 17:47:36 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.31 2001/03/12 08:21:50 kowal2 -Corrected C++ bug in the material definitions - -Revision 1.30 2001/03/01 17:34:47 kowal2 -Correction due to the accuracy problem - -Revision 1.29 2001/02/28 16:34:40 kowal2 -Protection against nonphysical values of the avalanche size, -10**6 is the maximum - -Revision 1.28 2001/01/26 19:57:19 hristov -Major upgrade of AliRoot code - -Revision 1.27 2001/01/13 17:29:33 kowal2 -Sun compiler correction - -Revision 1.26 2001/01/10 07:59:43 kowal2 -Corrections to load points from the noncompressed hits. - -Revision 1.25 2000/11/02 07:25:31 kowal2 -Changes due to the new hit structure. -Memory leak removed. - -Revision 1.24 2000/10/05 16:06:09 kowal2 -Forward declarations. Changes due to a new class AliComplexCluster. - -Revision 1.23 2000/10/02 21:28:18 fca -Removal of useless dependecies via forward declarations - -Revision 1.22 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.19.2.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.19.2.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.19.2.2 2000/06/16 12:59:28 kowal2 -Changed parameter settings - -Revision 1.19.2.1 2000/06/09 07:15:07 kowal2 - -Defaults loaded automatically (hard-wired) -Optional parameters can be set via macro called in the constructor - -Revision 1.19 2000/04/18 19:00:59 fca -Small bug fixes to TPC files - -Revision 1.18 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.17.2.2 2000/04/10 08:15:12 kowal2 - -New, experimental data structure from M. Ivanov -New tracking algorithm -Different pad geometry for different sectors -Digitization rewritten - -Revision 1.17.2.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.17 2000/01/19 17:17:30 fca -Introducing a list of lists of hits -- more hits allowed for detector now - -Revision 1.16 1999/11/05 09:29:23 fca -Accept only signals > 0 - -Revision 1.15 1999/10/08 06:26:53 fca -Removed ClustersIndex - not used anymore - -Revision 1.14 1999/09/29 09:24:33 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -222,51 +33,49 @@ Introduction of the Copyright and cvs Log // +#include +#include + +#include +#include +#include #include -#include -#include #include -#include #include -#include #include -#include "TParticle.h" -#include "AliTPC.h" -#include +#include #include +#include #include -#include "AliRun.h" -#include -#include -#include -#include "AliMagF.h" -#include "AliTrackReference.h" - +#include +#include +#include +#include -#include "AliTPCParamSR.h" -#include "AliTPCPRF2D.h" -#include "AliTPCRF1D.h" +#include "AliArrayBranch.h" +#include "AliClusters.h" +#include "AliComplexCluster.h" #include "AliDigits.h" +#include "AliMagF.h" +#include "AliPoints.h" +#include "AliRun.h" +#include "AliRunLoader.h" #include "AliSimDigits.h" +#include "AliTPC.h" +#include "AliTPC.h" +#include "AliTPCClustersArray.h" +#include "AliTPCClustersRow.h" +#include "AliTPCDigitsArray.h" +#include "AliTPCLoader.h" +#include "AliTPCPRF2D.h" +#include "AliTPCParamSR.h" +#include "AliTPCRF1D.h" #include "AliTPCTrackHits.h" #include "AliTPCTrackHitsV2.h" -#include "AliPoints.h" -#include "AliArrayBranch.h" - - -#include "AliTPCDigitsArray.h" -#include "AliComplexCluster.h" -#include "AliClusters.h" -#include "AliTPCClustersRow.h" -#include "AliTPCClustersArray.h" - #include "AliTPCcluster.h" #include "AliTPCclusterer.h" #include "AliTPCtracker.h" - -#include -#include - +#include "AliTrackReference.h" ClassImp(AliTPC) @@ -406,7 +215,7 @@ void AliTPC::AddHit(Int_t track, Int_t *vol, Float_t *hits) if (fHitType>1) AddHit2(track,vol,hits); } - + //_____________________________________________________________________________ void AliTPC::BuildGeometry() { @@ -502,13 +311,14 @@ Int_t AliTPC::DistancetoPrimitive(Int_t , Int_t ) return 9999; } -void AliTPC::Clusters2Tracks(TFile *of) { +void AliTPC::Clusters2Tracks() + { //----------------------------------------------------------------- // This is a track finder. //----------------------------------------------------------------- - AliTPCtracker tracker(fTPCParam); - tracker.Clusters2Tracks(gFile,of); -} + AliTPCtracker tracker(fTPCParam,0,fLoader->GetEventFolder()->GetName()); + tracker.Clusters2Tracks(); + } //_____________________________________________________________________________ void AliTPC::CreateMaterials() @@ -959,6 +769,7 @@ Bool_t AliTPC::IsSectorActive(Int_t sec) void AliTPC::SetActiveSectors(Int_t * sectors, Int_t n) { // activate interesting sectors + SetTreeAddress();//just for security if (fActiveSectors) delete [] fActiveSectors; fActiveSectors = new Bool_t[fTPCParam->GetNSector()]; for (Int_t i=0;iGetNSector();i++) fActiveSectors[i]=kFALSE; @@ -972,6 +783,7 @@ void AliTPC::SetActiveSectors(Int_t flag) // // activate sectors which were hitted by tracks //loop over tracks + SetTreeAddress();//just for security if (fHitType==0) return; // if Clones hit - not short volume ID information if (fActiveSectors) delete [] fActiveSectors; fActiveSectors = new Bool_t[fTPCParam->GetNSector()]; @@ -981,16 +793,24 @@ void AliTPC::SetActiveSectors(Int_t flag) } for (Int_t i=0;iGetNSector();i++) fActiveSectors[i]=kFALSE; TBranch * branch=0; - if (fHitType>1) branch = gAlice->TreeH()->GetBranch("TPC2"); - else branch = gAlice->TreeH()->GetBranch("TPC"); - Stat_t ntracks = gAlice->TreeH()->GetEntries(); + if (TreeH() == 0x0) + { + Fatal("SetActiveSectors","Can not find TreeH in folder"); + return; + } + if (fHitType>1) branch = TreeH()->GetBranch("TPC2"); + else branch = TreeH()->GetBranch("TPC"); + Stat_t ntracks = TreeH()->GetEntries(); // loop over all hits - for(Int_t track=0;trackTreeH()->GetBranch("fVolumes"); - TBranch * br2 = gAlice->TreeH()->GetBranch("fNVolumes"); + TBranch * br1 = TreeH()->GetBranch("fVolumes"); + TBranch * br2 = TreeH()->GetBranch("fNVolumes"); br1->GetEvent(track); br2->GetEvent(track); Int_t *volumes = fTrackHits->GetVolumes(); @@ -1000,7 +820,7 @@ void AliTPC::SetActiveSectors(Int_t flag) // if (fTrackHitsOld && fHitType&2) { - TBranch * br = gAlice->TreeH()->GetBranch("fTrackHitsInfo"); + TBranch * br = TreeH()->GetBranch("fTrackHitsInfo"); br->GetEvent(track); AliObjectArray * ar = fTrackHitsOld->fTrackHitsInfo; for (UInt_t j=0;jGetSize();j++){ @@ -1014,12 +834,12 @@ void AliTPC::SetActiveSectors(Int_t flag) -void AliTPC::Digits2Clusters(TFile *of, Int_t eventnumber) +void AliTPC::Digits2Clusters(Int_t eventnumber) { //----------------------------------------------------------------- // This is a simple cluster finder. //----------------------------------------------------------------- - AliTPCclusterer::Digits2Clusters(fTPCParam,of,eventnumber); + AliTPCclusterer::Digits2Clusters(fTPCParam, fLoader,eventnumber); } extern Double_t SigmaY2(Double_t, Double_t, Double_t); @@ -1057,9 +877,8 @@ void AliTPC::Hits2Clusters(TFile *of, Int_t eventn) const Float_t kBCz=0.55938e-3; const Float_t kCCz=0.30428; - TDirectory *savedir=gDirectory; - if (!of->IsOpen()) { + if (!fLoader) { cerr<<"AliTPC::Hits2Clusters(): output file not open !\n"; return; } @@ -1080,21 +899,30 @@ void AliTPC::Hits2Clusters(TFile *of, Int_t eventn) // Get the access to the tracks //--------------------------------------------------------------- - TTree *tH = gAlice->TreeH(); + TTree *tH = TreeH(); + if (tH == 0x0) + { + Fatal("Hits2Clusters","Can not find TreeH in folder"); + return; + } + SetTreeAddress(); + Stat_t ntracks = tH->GetEntries(); //Switch to the output file - of->cd(); - - char cname[100]; - - sprintf(cname,"TreeC_TPC_%d",eventn); - + + if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); + + cout<<"fTPCParam->GetTitle() = "<GetTitle()<GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + rl->CdGAFile(); fTPCParam->Write(fTPCParam->GetTitle()); + AliTPCClustersArray carray; carray.Setup(fTPCParam); carray.SetClusterType("AliTPCcluster"); - carray.MakeTree(); + carray.MakeTree(fLoader->TreeR()); Int_t nclusters=0; //cluster counter @@ -1209,10 +1037,8 @@ void AliTPC::Hits2Clusters(TFile *of, Int_t eventn) } // end of loop over sectors cerr<<"Number of made clusters : "<SetName(cname); - carray.GetTree()->Write(); - - savedir->cd(); //switch back to the input file + fLoader->WriteRecPoints("OVERWRITE"); + } // end of function @@ -1248,7 +1074,14 @@ void AliTPC::Hits2ExactClustersSector(Int_t isec) // Get the access to the tracks //--------------------------------------------------------------- - TTree *tH = gAlice->TreeH(); + TTree *tH = TreeH(); + if (tH == 0x0) + { + Fatal("Hits2Clusters","Can not find TreeH in folder"); + return; + } + SetTreeAddress(); + Stat_t ntracks = tH->GetEntries(); Int_t npart = gAlice->GetNtrack(); //MI change @@ -1399,24 +1232,33 @@ void AliTPC::SDigits2Digits2(Int_t eventnumber) { //create digits from summable digits GenerNoise(500000); //create teble with noise - char sname[100]; - char dname[100]; - sprintf(sname,"TreeS_%s_%d",fTPCParam->GetTitle(),eventnumber); - sprintf(dname,"TreeD_%s_%d",fTPCParam->GetTitle(),eventnumber); //conect tree with sSDigits - TTree *t; - if (gAlice->GetTreeDFile()) { - t = (TTree *)gAlice->GetTreeDFile()->Get(sname); - } else { - t = (TTree *)gDirectory->Get(sname); - } - if (!t) { - cerr<<"TPC tree with sdigits not found"<TreeS(); + + if (t == 0x0) + { + fLoader->LoadSDigits("READ"); + t = fLoader->TreeS(); + if (t == 0x0) + { + Error("SDigits2Digits2","Can not get input TreeS"); + return; + } + } + + if (fLoader->TreeD() == 0x0) fLoader->MakeTree("D"); + AliSimDigits digarr, *dummy=&digarr; - t->GetBranch("Segment")->SetAddress(&dummy); + TBranch* sdb = t->GetBranch("Segment"); + if (sdb == 0x0) + { + Error("SDigits2Digits2","Can not find branch with segments in TreeS."); + return; + } + + sdb->SetAddress(&dummy); + Stat_t nentries = t->GetEntries(); // set zero suppression @@ -1432,14 +1274,9 @@ void AliTPC::SDigits2Digits2(Int_t eventnumber) AliTPCDigitsArray *arr = new AliTPCDigitsArray; arr->SetClass("AliSimDigits"); arr->Setup(fTPCParam); -// Note that methods arr->MakeTree have different signatures - if (gAlice->GetTreeDFile()) { - arr->MakeTree(gAlice->GetTreeDFile()); - } else { - arr->MakeTree(fDigitsFile); - } + arr->MakeTree(fLoader->TreeD()); - AliTPCParam * par =fTPCParam; + AliTPCParam * par = fTPCParam; //Loop over segments of the TPC @@ -1450,7 +1287,15 @@ void AliTPC::SDigits2Digits2(Int_t eventnumber) cerr<<"AliTPC warning: invalid segment ID ! "<CreateRow(sec,row); Int_t nrows = digrow->GetNRows(); Int_t ncols = digrow->GetNCols(); @@ -1500,141 +1345,10 @@ void AliTPC::SDigits2Digits2(Int_t eventnumber) //write results - - - arr->GetTree()->SetName(dname); - arr->GetTree()->AutoSave(); - delete arr; -} -//_________________________________________ -void AliTPC::Merge(TTree * intree, Int_t *mask, Int_t nin, Int_t outid) -{ - - //intree - pointer to array of trees with s digits - //mask - mask for each - //nin - number of inputs - //outid - event number of the output event - - //create digits from summable digits - //conect tree with sSDigits - - - AliSimDigits ** digarr = new AliSimDigits*[nin]; - for (Int_t i1=0;i1SetAddress(&digarr[i1]); - } - Stat_t nentries = intree[0].GetEntries(); - - //make tree with digits - char dname[100]; - sprintf(dname,"TreeD_%s_%d",fTPCParam->GetTitle(),outid); - AliTPCDigitsArray *arr = new AliTPCDigitsArray; - arr->SetClass("AliSimDigits"); - arr->Setup(fTPCParam); - arr->MakeTree(fDigitsFile); - - // set zero suppression - - fTPCParam->SetZeroSup(2); - - // get zero suppression - - Int_t zerosup = fTPCParam->GetZeroSup(); - - - AliTPCParam * par =fTPCParam; - - //Loop over segments of the TPC - for (Int_t n=0; nExpandBuffer(); - digarr[i]->ExpandTrackBuffer(); - } - Int_t sec, row; - if (!par->AdjustSectorRow(digarr[0]->GetID(),sec,row)) { - cerr<<"AliTPC warning: invalid segment ID ! "<GetID()<CreateRow(sec,row); - Int_t nrows = digrow->GetNRows(); - Int_t ncols = digrow->GetNCols(); - - digrow->ExpandBuffer(); - digrow->ExpandTrackBuffer(); + fLoader->WriteDigits("OVERWRITE"); - for (Int_t rows=0;rowsGetDigitFast(rows,col); - for (Int_t tr=0;tr<3;tr++) { - Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); - if ( lab > 1) { - label[labptr]=lab+mask[i]-2; - labptr++; - } - } - } - //add noise - q = gRandom->Gaus(q,fTPCParam->GetNoise()*fTPCParam->GetNoiseNormFac()*16); - - q/=16; //conversion faktor - q=(Short_t)q; - - if (q> zerosup){ - - if(q > fTPCParam->GetADCSat()) q = fTPCParam->GetADCSat(); - digrow->SetDigitFast((Short_t)q,rows,col); - for (Int_t tr=0;tr<3;tr++){ - if (trSetTrackIDFast(label[tr],rows,col,tr); - else - ((AliSimDigits*)digrow)->SetTrackIDFast(-1,rows,col,tr); - } - } - } - } - arr->StoreRow(sec,row); - - arr->ClearRow(sec,row); - - } - - delete digarr; - arr->GetTree()->SetName(dname); - arr->GetTree()->Write(); - - delete arr; - -} - -/*_________________________________________ -void AliTPC::SDigits2Digits(Int_t eventnumber) -{ - - - cerr<<"Digitizing TPC...\n"; - - Hits2Digits(eventnumber); - - - //write results - - // char treeName[100]; - - // sprintf(treeName,"TreeD_%s_%d",fTPCParam->GetTitle(),eventnumber); - - // GetDigitsArray()->GetTree()->Write(treeName); + delete arr; } -*/ //__________________________________________________________________ void AliTPC::SetDefaults(){ @@ -1643,6 +1357,9 @@ void AliTPC::SetDefaults(){ // Set response functions + // + AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + rl->CdGAFile(); AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60"); if(param){ printf("You are using 2 pad-length geom hits with 3 pad-lenght geom digits...\n"); @@ -1697,7 +1414,26 @@ void AliTPC::Hits2Digits(Int_t eventnumber) //---------------------------------------------------- // Loop over all sectors for a single event //---------------------------------------------------- - + AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + rl->GetEvent(eventnumber); + if (fLoader->TreeH() == 0x0) + { + if(fLoader->LoadHits()) + { + Error("Hits2Digits","Can not load hits."); + } + } + SetTreeAddress(); + + if (fLoader->TreeD() == 0x0 ) + { + fLoader->MakeTree("D"); + if (fLoader->TreeD() == 0x0 ) + { + Error("Hits2Digits","Can not get TreeD"); + return; + } + } if(fDefaults == 0) SetDefaults(); // check if the parameters are set GenerNoise(500000); //create teble with noise @@ -1709,30 +1445,26 @@ void AliTPC::Hits2Digits(Int_t eventnumber) AliTPCDigitsArray *arr = new AliTPCDigitsArray; arr->SetClass("AliSimDigits"); arr->Setup(fTPCParam); -// Note that methods arr->MakeTree have different signatures - if (gAlice->GetTreeDFile()) { - arr->MakeTree(gAlice->GetTreeDFile()); - } else { - arr->MakeTree(fDigitsFile); - } + + arr->MakeTree(fLoader->TreeD()); SetDigitsArray(arr); fDigitsSwitch=0; // standard digits cerr<<"Digitizing TPC -- normal digits...\n"; - for(Int_t isec=0;isecGetNSector();isec++) if (IsSectorActive(isec)) Hits2DigitsSector(isec); - - // write results - - char treeName[100]; - - sprintf(treeName,"TreeD_%s_%d",fTPCParam->GetTitle(),eventnumber); - - GetDigitsArray()->GetTree()->SetName(treeName); - GetDigitsArray()->GetTree()->AutoSave(); - + for(Int_t isec=0;isecGetNSector();isec++) + if (IsSectorActive(isec)) + { + cout<<"Sector "<WriteDigits("OVERWRITE"); } @@ -1748,23 +1480,40 @@ void AliTPC::Hits2SDigits2(Int_t eventnumber) //---------------------------------------------------- // Loop over all sectors for a single event //---------------------------------------------------- +// AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + + AliRunLoader* rl = fLoader->GetRunLoader(); + + rl->GetEvent(eventnumber); + if (fLoader->TreeH() == 0x0) + { + if(fLoader->LoadHits()) + { + Error("Hits2Digits","Can not load hits."); + return; + } + } + SetTreeAddress(); + if (fLoader->TreeS() == 0x0 ) + { + fLoader->MakeTree("S"); + } + if(fDefaults == 0) SetDefaults(); + GenerNoise(500000); //create table with noise //setup TPCDigitsArray if(GetDigitsArray()) delete GetDigitsArray(); + AliTPCDigitsArray *arr = new AliTPCDigitsArray; arr->SetClass("AliSimDigits"); arr->Setup(fTPCParam); -// Note that methods arr->MakeTree have different signatures - if (gAlice->GetTreeSFile()) { - arr->MakeTree(gAlice->GetTreeSFile()); - } else { - arr->MakeTree(fDigitsFile); - } + arr->MakeTree(fLoader->TreeS()); + SetDigitsArray(arr); cerr<<"Digitizing TPC -- summable digits...\n"; @@ -1775,23 +1524,24 @@ void AliTPC::Hits2SDigits2(Int_t eventnumber) fTPCParam->SetZeroSup(0); - for(Int_t isec=0;isecGetNSector();isec++) if (IsSectorActive(isec)) Hits2DigitsSector(isec); - - - // write results - - char treeName[100]; - - sprintf(treeName,"TreeS_%s_%d",fTPCParam->GetTitle(),eventnumber); - - GetDigitsArray()->GetTree()->SetName(treeName); - GetDigitsArray()->GetTree()->AutoSave(); - + for(Int_t isec=0;isecGetNSector();isec++) + if (IsSectorActive(isec)) + { +// cout<<"Sector "<WriteSDigits("OVERWRITE"); + +//this line prevents the crash in the similar one +//on the beginning of this method +//destructor attempts to reset the tree, which is deleted by the loader +//need to be redesign + if(GetDigitsArray()) delete GetDigitsArray(); + SetDigitsArray(0x0); } - - - //__________________________________________________________________ + void AliTPC::Hits2SDigits() { @@ -1803,7 +1553,20 @@ void AliTPC::Hits2SDigits() // Loop over all sectors for a single event //---------------------------------------------------- //MI change - for pp run - Int_t eventnumber = gAlice->GetEvNumber(); +// Int_t eventnumber = gAlice->GetEvNumber(); +// AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); +// rl->GetEvent(eventnumber); +// 12/05/2003 This method is obsolete and not used. It should be redesingned +// M.Kowalski + + if (fLoader->TreeH() == 0x0) + { + if(fLoader->LoadHits()) + { + Error("Hits2Digits","Can not load hits."); + } + } + SetTreeAddress(); if(fDefaults == 0) SetDefaults(); GenerNoise(500000); //create table with noise @@ -1812,15 +1575,15 @@ void AliTPC::Hits2SDigits() if(GetDigitsArray()) delete GetDigitsArray(); + if (fLoader->TreeS() == 0x0 ) + { + fLoader->MakeTree("S"); + } + AliTPCDigitsArray *arr = new AliTPCDigitsArray; arr->SetClass("AliSimDigits"); arr->Setup(fTPCParam); -// Note that methods arr->MakeTree have different signatures - if (gAlice->GetTreeSFile()) { - arr->MakeTree(gAlice->GetTreeSFile()); - } else { - arr->MakeTree(fDigitsFile); - } + arr->MakeTree(fLoader->TreeS()); SetDigitsArray(arr); cerr<<"Digitizing TPC -- summable digits...\n"; @@ -1829,19 +1592,13 @@ void AliTPC::Hits2SDigits() for(Int_t isec=0;isecGetNSector();isec++) if (IsSectorActive(isec)) Hits2DigitsSector(isec); - // write results - char treeName[100]; - - sprintf(treeName,"TreeD_%s_%d",fTPCParam->GetTitle(),eventnumber); - - GetDigitsArray()->GetTree()->SetName(treeName); - GetDigitsArray()->GetTree()->AutoSave(); - + // + cout<<"Why method TPC::Hits2SDigits writes digits and not sdigits? skowron\n"; + fLoader->WriteDigits("OVERWRITE"); } - - //_____________________________________________________________________________ + void AliTPC::Hits2DigitsSector(Int_t isec) { //------------------------------------------------------------------- @@ -1861,7 +1618,13 @@ void AliTPC::Hits2DigitsSector(Int_t isec) if(fDefaults == 0) SetDefaults(); - TTree *tH = gAlice->TreeH(); // pointer to the hits tree + TTree *tH = TreeH(); // pointer to the hits tree + if (tH == 0x0) + { + Fatal("Hits2DigitsSector","Can not find TreeH in folder"); + return; + } + Stat_t ntracks = tH->GetEntries(); if( ntracks > 0){ @@ -1889,7 +1652,10 @@ void AliTPC::Hits2DigitsSector(Int_t isec) Int_t i; - if (fDigitsArray->GetTree()==0) fDigitsArray->MakeTree(fDigitsFile); + if (fDigitsArray->GetTree()==0) + { + Fatal("Hits2DigitsSector","Tree not set in fDigitsArray"); + } for (i=0;iStoreRow(isec,i); Int_t ndig = dig->GetDigitSize(); - if (gDebug > 10) printf("*** Sector, row, compressed digits %d %d %d ***\n",isec,i,ndig); + + if (gDebug > 10) + printf("*** Sector, row, compressed digits %d %d %d ***\n",isec,i,ndig); fDigitsArray->ClearRow(isec,i); @@ -2437,25 +2205,30 @@ void AliTPC::Init() } //_____________________________________________________________________________ -void AliTPC::MakeBranch(Option_t* option, const char *file) +void AliTPC::MakeBranch(Option_t* option) { // // Create Tree branches for the TPC. // + if(GetDebug()) Info("MakeBranch",""); Int_t buffersize = 4000; char branchname[10]; sprintf(branchname,"%s",GetName()); + + const char *h = strstr(option,"H"); - AliDetector::MakeBranch(option,file); + if ( h && (fHitType<=1) && (fHits == 0x0)) fHits = new TClonesArray("AliTPChit", 176);//skowron 20.06.03 + + AliDetector::MakeBranch(option); const char *d = strstr(option,"D"); + + if (fDigits && fLoader->TreeD() && d) + { + MakeBranchInTree(gAlice->TreeD(), branchname, &fDigits, buffersize, 0); + } - if (fDigits && gAlice->TreeD() && d) { - MakeBranchInTree(gAlice->TreeD(), - branchname, &fDigits, buffersize, file); - } - - if (fHitType>1) MakeBranch2(option,file); // MI change 14.09.2000 + if (fHitType>1) MakeBranch2(option,0); // MI change 14.09.2000 } //_____________________________________________________________________________ @@ -2478,7 +2251,6 @@ void AliTPC::SetSecAL(Int_t sec) //----------------------------------------------------------------- // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl //----------------------------------------------------------------- - fSecAL = sec; } @@ -2492,7 +2264,6 @@ void AliTPC::SetSecAU(Int_t sec) //----------------------------------------------------------------- // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl //----------------------------------------------------------------- - fSecAU = sec; } @@ -2653,7 +2424,6 @@ AliHit(shunt,track) fQ = hits[3]; } - //________________________________________________________________________ // Additional code because of the AliTPCTrackHitsV2 @@ -2663,6 +2433,7 @@ void AliTPC::MakeBranch2(Option_t *option,const char *file) // Create a new branch in the current Root Tree // The branch of fHits is automatically split // MI change 14.09.2000 + if(GetDebug()) Info("MakeBranch2",""); if (fHitType<2) return; char branchname[10]; sprintf(branchname,"%s2",GetName()); @@ -2670,65 +2441,29 @@ void AliTPC::MakeBranch2(Option_t *option,const char *file) // Get the pointer to the header const char *cH = strstr(option,"H"); // - if (fTrackHits && gAlice->TreeH() && cH && fHitType&4) { - // AliObjectBranch * branch = new AliObjectBranch(branchname,"AliTPCTrackHitsV2",&fTrackHits, - // gAlice->TreeH(),fBufferSize,99); - //TBranch * branch = - gAlice->TreeH()->Branch(branchname,"AliTPCTrackHitsV2",&fTrackHits, - fBufferSize,99); - - // gAlice->TreeH()->GetListOfBranches()->Add(branch); - if (GetDebug()>1) - printf("* AliDetector::MakeBranch * Making Branch %s for trackhits\n",branchname); - const char folder [] = "RunMC/Event/Data"; - if (GetDebug()) - printf("%15s: Publishing %s to %s\n",ClassName(),branchname,folder); - Publish(folder,&fTrackHits,branchname); - if (file) { - TBranch *b = gAlice->TreeH()->GetBranch(branchname); - TDirectory *wd = gDirectory; - b->SetFile(file); - TIter next( b->GetListOfBranches()); - while ((b=(TBranch*)next())) { - b->SetFile(file); - } - wd->cd(); - if (GetDebug()>1) - cout << "Diverting branch " << branchname << " to file " << file << endl; - } - } + if (fTrackHits && TreeH() && cH && fHitType&4) + { + if(GetDebug()) Info("MakeBranch2","Making branch for Type 4 Hits"); + TreeH()->Branch(branchname,"AliTPCTrackHitsV2",&fTrackHits,fBufferSize,99); + } - if (fTrackHitsOld && gAlice->TreeH() && cH && fHitType&2) { + if (fTrackHitsOld && TreeH() && cH && fHitType&2) + { + if(GetDebug()) Info("MakeBranch2","Making branch for Type 2 Hits"); AliObjectBranch * branch = new AliObjectBranch(branchname,"AliTPCTrackHits",&fTrackHitsOld, - gAlice->TreeH(),fBufferSize,99); - //TBranch * branch = gAlice->TreeH()->Branch(branchname,"AliTPCTrackHitsV2",&fTrackHits, - // fBufferSize,99); - - gAlice->TreeH()->GetListOfBranches()->Add(branch); - if (GetDebug()>1) - printf("* AliDetector::MakeBranch * Making Branch %s for trackhits\n",branchname); - const char folder [] = "RunMC/Event/Data"; - if (GetDebug()) - printf("%15s: Publishing %s to %s\n",ClassName(),branchname,folder); - Publish(folder,&fTrackHitsOld,branchname); - if (file) { - TBranch *b = gAlice->TreeH()->GetBranch(branchname); - TDirectory *wd = gDirectory; - b->SetFile(file); - TIter next( b->GetListOfBranches()); - while ((b=(TBranch*)next())) { - b->SetFile(file); - } - wd->cd(); - if (GetDebug()>1) - cout << "Diverting branch " << branchname << " to file " << file << endl; - } - } + TreeH(),fBufferSize,99); + TreeH()->GetListOfBranches()->Add(branch); + } } void AliTPC::SetTreeAddress() { - if (fHitType<=1) AliDetector::SetTreeAddress(); +//Sets tree address for hits + if (fHitType<=1) + { + if (fHits == 0x0 ) fHits = new TClonesArray("AliTPChit", 176);//skowron 20.06.03 + AliDetector::SetTreeAddress(); + } if (fHitType>1) SetTreeAddress2(); } @@ -2737,28 +2472,40 @@ void AliTPC::SetTreeAddress2() // // Set branch address for the TrackHits Tree // + if(GetDebug()) Info("SetTreeAddress2",""); + TBranch *branch; char branchname[20]; sprintf(branchname,"%s2",GetName()); // // Branch address for hit tree - TTree *treeH = gAlice->TreeH(); + TTree *treeH = TreeH(); if ((treeH)&&(fHitType&4)) { branch = treeH->GetBranch(branchname); - if (branch) branch->SetAddress(&fTrackHits); + if (branch) + { + branch->SetAddress(&fTrackHits); + cout<<"AliTPC::SetTreeAddress2 fHitType&4 Setting"<GetBranch(branchname); - if (branch) branch->SetAddress(&fTrackHitsOld); + if (branch) + { + branch->SetAddress(&fTrackHitsOld); + cout<<"AliTPC::SetTreeAddress2 fHitType&2 Setting"<TreeTR(); + + TTree *treeTR = TreeTR(); if (treeTR && fTrackReferences) { branch = treeTR->GetBranch(GetName()); if (branch) branch->SetAddress(&fTrackReferences); } - } void AliTPC::FinishPrimary() @@ -2786,15 +2533,15 @@ void AliTPC::AddHit2(Int_t track, Int_t *vol, Float_t *hits) // cout<<"bad track number\n"; if (fTrackHits && fHitType&4) fTrackHits->AddHitKartez(vol[0],rtrack, hits[0], - hits[1],hits[2],(Int_t)hits[3]); + hits[1],hits[2],(Int_t)hits[3]); if (fTrackHitsOld &&fHitType&2 ) fTrackHitsOld->AddHitKartez(vol[0],rtrack, hits[0], - hits[1],hits[2],(Int_t)hits[3]); + hits[1],hits[2],(Int_t)hits[3]); } void AliTPC::ResetHits() -{ +{ if (fHitType&1) AliDetector::ResetHits(); if (fHitType>1) ResetHits2(); } @@ -2831,7 +2578,7 @@ AliHit* AliTPC::FirstHit2(Int_t track) // if(track>=0) { gAlice->ResetHits(); - gAlice->TreeH()->GetEvent(track); + TreeH()->GetEvent(track); } // if (fTrackHits && fHitType&4) { @@ -2907,7 +2654,7 @@ Bool_t AliTPC::TrackInVolume(Int_t id,Int_t track) // // return kTRUE; if (fTrackHitsOld && fHitType&2) { - TBranch * br = gAlice->TreeH()->GetBranch("fTrackHitsInfo"); + TBranch * br = TreeH()->GetBranch("fTrackHitsInfo"); br->GetEvent(track); AliObjectArray * ar = fTrackHitsOld->fTrackHitsInfo; for (UInt_t j=0;jGetSize();j++){ @@ -2916,8 +2663,8 @@ Bool_t AliTPC::TrackInVolume(Int_t id,Int_t track) } if (fTrackHits && fHitType&4) { - TBranch * br1 = gAlice->TreeH()->GetBranch("fVolumes"); - TBranch * br2 = gAlice->TreeH()->GetBranch("fNVolumes"); + TBranch * br1 = TreeH()->GetBranch("fVolumes"); + TBranch * br2 = TreeH()->GetBranch("fNVolumes"); br2->GetEvent(track); br1->GetEvent(track); Int_t *volumes = fTrackHits->GetVolumes(); @@ -2931,7 +2678,7 @@ Bool_t AliTPC::TrackInVolume(Int_t id,Int_t track) } if (fHitType&1) { - TBranch * br = gAlice->TreeH()->GetBranch("fSector"); + TBranch * br = TreeH()->GetBranch("fSector"); br->GetEvent(track); for (Int_t j=0;jGetEntriesFast();j++){ if ( ((AliTPChit*)fHits->At(j))->fSector==id) return kTRUE; @@ -3267,7 +3014,7 @@ void AliTPC::Digits2Reco(Int_t firstevent,Int_t lastevent) for(Int_t iev=firstevent;ievGet(paramName); diff --git a/TPC/AliTPC.h b/TPC/AliTPC.h index bc7831a04e5..3cdd502292b 100644 --- a/TPC/AliTPC.h +++ b/TPC/AliTPC.h @@ -12,8 +12,8 @@ #include "AliHit.h" #include "AliDigit.h" #include "TLorentzVector.h" -#include "TVirtualMC.h" +#include "AliTPCLoader.h" class TMatrix; @@ -60,6 +60,9 @@ protected: public: AliTPC(); AliTPC(const char *name, const char *title); + + virtual AliLoader* MakeLoader(const char* topfoldername); + virtual ~AliTPC(); virtual void AddHit(Int_t a1, Int_t *a2, Float_t *a3); Int_t DistancetoPrimitive(Int_t px, Int_t py); @@ -80,17 +83,17 @@ public: virtual void Hits2DigitsSector(Int_t isec); //MI change virtual void Init(); virtual Int_t IsVersion() const =0; - virtual void Digits2Clusters(TFile *of, Int_t eventnumber=0); - virtual void Clusters2Tracks(TFile *of); + virtual void Digits2Clusters(Int_t eventnumber=0); + virtual void Clusters2Tracks(); Int_t GetNsectors() {return fNsectors;} - virtual void MakeBranch(Option_t *opt=" ", const char *file=0 ); + virtual void MakeBranch(Option_t *opt=" "); virtual void ResetDigits(); virtual void SetSecAL(Int_t sec); virtual void SetSecAU(Int_t sec); virtual void SetSecLows(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6); virtual void SetSecUps (Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6, - Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12); + Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12); virtual void SetSens(Int_t sens); @@ -129,7 +132,6 @@ public: void SetHitType(Int_t type){fHitType =type;} //set type of hit container void SetDigitsSwitch(Int_t sw){fDigitsSwitch = sw;} void SetDefSwitch(Int_t def){fDefaults = def;} - virtual void Merge(TTree * intree, Int_t *mask, Int_t nin, Int_t outid); Float_t GetNoise(); //get Current noise void GenerNoise(Int_t tablasize); // make noise table Bool_t IsSectorActive(Int_t sec); // check if the sector is active @@ -160,7 +162,7 @@ public: Int_t fCurrentNoise; //!index of the noise in the noise table Bool_t* fActiveSectors; //!bool indicating which sectors are active - ClassDef(AliTPC,9) // Time Projection Chamber class + ClassDef(AliTPC,10) // Time Projection Chamber class }; diff --git a/TPC/AliTPCBuffer.cxx b/TPC/AliTPCBuffer.cxx index 378c1869d73..1bd01f49bdf 100644 --- a/TPC/AliTPCBuffer.cxx +++ b/TPC/AliTPCBuffer.cxx @@ -12,6 +12,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + /* $Id$ */ // Storing digits in a binary file diff --git a/TPC/AliTPCCluster.cxx b/TPC/AliTPCCluster.cxx deleted file mode 100644 index 6896d1d3816..00000000000 --- a/TPC/AliTPCCluster.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************** - * 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. * - **************************************************************************/ - -/* -$Log$ -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:34:02 kowal2 - -Clusters handling in a new data structure - -*/ - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Time Projection Chamber clusters objects // -// -// Origin: Marian Ivanov , GSI Darmstadt -// // -// // -// // -/////////////////////////////////////////////////////////////////////////////// -#include "AliTPC.h" -#include "AliTPCCluster.h" -#include "TClonesArray.h" -#include "TDirectory.h" - - -const Int_t kDefSize = 1; //defalut size - - -ClassImp(AliTPCClustersRow) - - -//***************************************************************************** -// -//_____________________________________________________________________________ -AliTPCClustersRow::AliTPCClustersRow() -{ - // - //default constructor - fNclusters=0; - fClusters = new TClonesArray("AliTPCcluster",kDefSize); - fParam = 0; -} -//_____________________________________________________________________________ -AliTPCClustersRow::AliTPCClustersRow(Int_t size) -{ - fNclusters=0; - fClusters = new TClonesArray("AliTPCcluster",size); -} - -//_____________________________________________________________________________ -const AliTPCcluster* AliTPCClustersRow::operator[](Int_t i) -{ - // - // return cluster at internal position i - // - if (fClusters==0) return 0; - void * cl = fClusters->UncheckedAt(i); - if (cl==0) return 0; - return (AliTPCcluster*)cl; -} -//_____________________________________________________________________________ -void AliTPCClustersRow::Sort() -{ - // sort cluster - if (fClusters) fClusters->Sort(); -} - -//_____________________________________________________________________________ -void AliTPCClustersRow::InsertCluster(const AliTPCcluster * c) -{ - // - // Add a simulated cluster copy to the list - // - if(!fClusters) fClusters=new TClonesArray("AliTPCcluster",1000); - TClonesArray &lclusters = *fClusters; - new(lclusters[fNclusters++]) AliTPCcluster(*c); -} - -//_____________________________________________________________________________ -Int_t AliTPCClustersRow::Find(Double_t y) const -{ - // - // return index of cluster nearest to given y position - // - AliTPCcluster* cl; - cl=(AliTPCcluster*)fClusters->UncheckedAt(0); - if (y <= cl->fY) return 0; - cl=(AliTPCcluster*)fClusters->UncheckedAt(fNclusters-1); - if (y > cl->fY) return fNclusters; - //if (y <= clusters[0]->fY) return 0; - //if (y > clusters[num_of_clusters-1]->fY) return num_of_clusters; - Int_t b=0, e=fNclusters-1, m=(b+e)/2; - // Int_t b=0, e=num_of_clusters-1, m=(b+e)/2; - for (; bUncheckedAt(m); - if (y > cl->fY) b=m+1; - // if (y > clusters[m]->fY) b=m+1; - else e=m; - } - return m; -} - - -//_____________________________________________________________________________ - -ClassImp(AliTPCClustersArray) - -AliTPCClustersArray::AliTPCClustersArray() -{ - fParam = 0; -} - -AliTPCClustersArray::~AliTPCClustersArray() -{ - // - //object is only owner of fParam - // - if (fParam) delete fParam; -} - -const AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row) -{ - // - //return clusters ((AliTPCClustersRow *) per given sector and padrow - // - if (fParam==0) return 0; - Int_t index = fParam->GetIndex(sector,row); - return (AliTPCClustersRow *)(*this)[index]; -} - -Bool_t AliTPCClustersArray::LoadRow(Int_t sector,Int_t row) -{ - // - //return clusters ((AliTPCClustersRow *) per given sector and padrow - // - if (fParam==0) return 0; - Int_t index = fParam->GetIndex(sector,row); - return LoadSegment(index); -} - -Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row) -{ - // - //return clusters ((AliTPCClustersRow *) per given sector and padrow - // - if (fParam==0) return 0; - Int_t index = fParam->GetIndex(sector,row); - StoreSegment(index); - return kTRUE; -} - - - -Bool_t AliTPCClustersArray::Setup(AliTPCParam *param) -{ - // - //setup function to adjust array parameters - // - if (param==0) return kFALSE; - fParam = new AliTPCParam(*param); - return MakeArray(fParam->GetNRowsTotal()); -} diff --git a/TPC/AliTPCCluster.h b/TPC/AliTPCCluster.h deleted file mode 100644 index ff4bbe063be..00000000000 --- a/TPC/AliTPCCluster.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef TPCClusters_H -#define TPCClusters_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* $Id$ */ - -//////////////////////////////////////////////// -// Manager class for TPC clusters // -//////////////////////////////////////////////// - -#include "AliDetector.h" -#include "AliHit.h" -#include "AliDigit.h" -#include "AliSegmentArray.h" -#include "AliTPCParam.h" - -#include -#include -#include - - -class TClonesArray; -class TObjArray; - - -class AliTPCClustersRow : public AliSegmentID{ -public: - AliTPCClustersRow(); - AliTPCClustersRow(Int_t size); - void InsertCluster(const AliTPCcluster* c ); //insert copy of cluster - const AliTPCcluster* operator[](Int_t i); - Int_t Find(Double_t y) const; //find nearest cluster in y direction - void Sort(); -public: - TClonesArray * fClusters; - Int_t fNclusters; - ClassDef(AliTPCClustersRow,1) // Cluster manager -}; - - -class AliTPCClustersArray : public AliSegmentArray { -public: - AliTPCClustersArray(); - ~AliTPCClustersArray(); - const AliTPCClustersRow * GetRow(Int_t sector,Int_t row); - Bool_t LoadRow(Int_t sector,Int_t row); - Bool_t StoreRow(Int_t sector,Int_t row); - Bool_t Setup(AliTPCParam *param); - //construct array according parameters in fParam - const AliTPCParam & GetParam() {return *fParam;} -private: - AliSegmentID * NewSegment(){ return (AliSegmentID*)new AliTPCClustersRow;} - AliTPCParam * fParam; //pointer to TPC parameters - //AliTPCClustersRow ** fRow; //pointer to array of pointers to cluster row - ClassDef(AliTPCClustersArray,1) // Cluster manager -}; - -#endif - diff --git a/TPC/AliTPCClusterFinder.cxx b/TPC/AliTPCClusterFinder.cxx index 3c98892e2ee..cc726f201f7 100644 --- a/TPC/AliTPCClusterFinder.cxx +++ b/TPC/AliTPCClusterFinder.cxx @@ -13,30 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2002/02/05 09:12:26 hristov -Small mods for gcc 3.02 - -Revision 1.6 2001/10/21 19:07:24 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.5 2001/01/26 19:57:22 hristov -Major upgrade of AliRoot code - -Revision 1.4 2000/10/05 16:08:15 kowal2 -Changes due to a new class AliComplexCluster. Forward declarations. - -Revision 1.3 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.2 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.1.2.1 2000/06/25 08:52:51 kowal2 -replacing AliClusterFinder - -*/ +/* $Id$ */ //----------------------------------------------------------------------------- // diff --git a/TPC/AliTPCClustersArray.cxx b/TPC/AliTPCClustersArray.cxx index ff5e7ab82fc..fde8834daa4 100644 --- a/TPC/AliTPCClustersArray.cxx +++ b/TPC/AliTPCClustersArray.cxx @@ -13,23 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2000/06/30 12:07:49 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.1 2000/06/09 07:09:29 kowal2 - -Clustering and tracking classes are splitted from the simulation ones - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:34:02 kowal2 - -Clusters handling in a new data structure - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliTPCClustersRow.cxx b/TPC/AliTPCClustersRow.cxx index ef5fe67b3dd..f26175987dc 100644 --- a/TPC/AliTPCClustersRow.cxx +++ b/TPC/AliTPCClustersRow.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - /* - $Log$ - */ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TPC/AliTPCComparison.C b/TPC/AliTPCComparison.C index e938a881f15..710497f7b7f 100644 --- a/TPC/AliTPCComparison.C +++ b/TPC/AliTPCComparison.C @@ -11,6 +11,8 @@ #ifndef __CINT__ #include "alles.h" #include "AliTPCtracker.h" + #include "AliRunLoader.h" + #include "AliMagF.h" #endif struct GoodTrackTPC { @@ -20,38 +22,72 @@ struct GoodTrackTPC { Float_t x,y,z; }; +Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const char* evfoldname); + Int_t AliTPCComparison(Int_t event=0) { + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + cerr<<"Doing comparison...\n"; const Int_t MAX=20000; - Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event); + Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const char* evfoldname = AliConfig::fgkDefaultEventFolderName);//declaration only gBenchmark->Start("AliTPCComparison"); - Int_t nentr=0,i=0; TObjArray tarray(MAX); - { /*Load tracks*/ - TFile *tf=TFile::Open("AliTPCtracks.root"); - if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 3;} + AliRunLoader *rl = AliRunLoader::Open("galice.root","COMPARISON"); + if (!rl) + { + cerr<<"Can't start sesion !\n"; + return 1; + } - char tname[100]; sprintf(tname,"TreeT_TPC_%d",event); - TTree *tracktree=(TTree*)tf->Get(tname); - if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n"; return 4;} + rl->LoadgAlice(); + if (rl->GetAliRun()) + AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()); + else + { + cerr<<"AliTPCComparison.C :Can't get AliRun !\n"; + return 1; + } + rl->UnloadgAlice(); + + AliLoader * tpcl = rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"AliTPCComparison.C : Can not find TPCLoader\n"; + delete rl; + return 3; + } - TBranch *tbranch=tracktree->GetBranch("tracks"); - nentr=(Int_t)tracktree->GetEntries(); - AliTPCtrack *iotrack=0; - for (i=0; iLoadTracks(); + + TTree *tracktree=tpcl->TreeT(); + if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n"; return 4;} + + TBranch *tbranch=tracktree->GetBranch("tracks"); + nentr=(Int_t)tracktree->GetEntries(); + AliTPCtrack *iotrack=0; + for (i=0; iSetAddress(&iotrack); tracktree->GetEvent(i); tarray.AddLast(iotrack); - } - delete tracktree; //Thanks to Mariana Bondila - tf->Close(); + } + tpcl->UnloadTracks(); } /* Generate a list of "good" tracks */ + GoodTrackTPC gt[MAX]; Int_t ngood=0; ifstream in("good_tracks_tpc"); @@ -70,7 +106,7 @@ Int_t AliTPCComparison(Int_t event=0) { if (!in.eof()) cerr<<"Read error (good_tracks_tpc) !\n"; } else { cerr<<"Marking good tracks (this will take a while)...\n"; - ngood=good_tracks_tpc(gt,MAX, event); + ngood=good_tracks_tpc(gt,MAX,"COMPARISON"); ofstream out("good_tracks_tpc"); if (out) { for (Int_t ngd=0; ngdStop("AliTPCComparison"); gBenchmark->Show("AliTPCComparison"); - + delete rl; return 0; } -Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { +Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const char* evfoldname) { Int_t nt=0; - TFile *file=TFile::Open("galice.root"); - if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);} - - if (!(gAlice=(AliRun*)file->Get("gAlice"))) { - cerr<<"gAlice have not been found on galice.root !\n"; - exit(5); - } - - Int_t np=gAlice->GetEvent(event); - - AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC"); + AliRunLoader* rl = AliRunLoader::GetRunLoader(evfoldname); + if (rl == 0x0) + { + ::Fatal("AliTPCComparison.C::good_tracks_tpc", + "Can not find Run Loader in Folder Named %s", + evfoldname); + } + AliLoader * tpcl = rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"AliTPCHits2Digits.C : Can not find TPCLoader\n"; + delete rl; + return 0; + } + + rl->LoadgAlice(); + + AliTPC *TPC=(AliTPC*)rl->GetAliRun()->GetDetector("TPC"); Int_t ver = TPC->IsVersion(); cerr<<"TPC version "<Get("75x40_100x60_150x60"); + rl->CdGAFile(); + AliTPCParamSR *digp=(AliTPCParamSR*)gDirectory->Get("75x40_100x60_150x60"); if (!digp) { cerr<<"TPC parameters have not been found !\n"; exit(6); } TPC->SetParam(digp); - + rl->LoadHeader(); + + Int_t np = rl->GetHeader()->GetNtrack(); + Int_t nrow_up=digp->GetNRowUp(); Int_t nrows=digp->GetNRowLow()+nrow_up; @@ -312,13 +359,11 @@ Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { switch (ver) { case 1: { - char cname[100]; sprintf(cname,"TreeC_TPC_%d",event); - TFile *cf=TFile::Open("AliTPCclusters.root"); - if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n";exit(5);} + tpcl->LoadRecPoints(); AliTPCClustersArray *pca=new AliTPCClustersArray, &ca=*pca; ca.Setup(digp); ca.SetClusterType("AliTPCcluster"); - ca.ConnectTree(cname); + ca.ConnectTree(tpcl->TreeR()); Int_t nrows=Int_t(ca.GetTree()->GetEntries()); for (Int_t n=0; nClose(); + tpcl->UnloadRecPoints(); } break; case 2: { - char dname[100]; sprintf(dname,"TreeD_75x40_100x60_150x60_%d",event); - TTree *TD=(TTree*)gDirectory->Get(dname); + tpcl->LoadDigits(); + TTree *TD=tpcl->TreeD(); + AliSimDigits da, *digits=&da; TD->GetBranch("Segment")->SetAddress(&digits); @@ -395,35 +441,45 @@ Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { } } delete[] count; - delete TD; //Thanks to Mariana Bondila + tpcl->UnloadDigits(); } break; default: cerr<<"Invalid TPC version !\n"; - file->Close(); + delete rl; exit(7); } - + rl->LoadKinematics(); + AliStack* stack = rl->Stack(); /** select tracks which are "good" enough **/ for (i=0; iParticle(i); - + TParticle *p = (TParticle*)stack->Particle(i); + if (p == 0x0) + { + cerr<<"Can not get particle "<Pt()<0.100) continue; if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue; Int_t j=p->GetFirstMother(); if (j>=0) { - TParticle *pp = (TParticle*)gAlice->Particle(j); + TParticle *pp = (TParticle*)stack->Particle(j); + if (pp == 0x0) + { + cerr<<"Can not get particle "<GetFirstMother()>=0) continue;//only one decay is allowed /* for cascade hyperons only Int_t jj=pp->GetFirstMother(); if (jj>=0) { - TParticle *ppp = (TParticle*)gAlice->Particle(jj); + TParticle *ppp = (TParticle*)stack->Particle(jj); if (ppp->GetFirstMother()>=0) continue;//two decays are allowed } */ @@ -437,9 +493,14 @@ Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { if (nt==max) {cerr<<"Too many good tracks !\n"; break;} cerr<UnloadKinematics(); /** check if there is also information at the entrance of the TPC **/ - TTree *TH=gAlice->TreeH(); np=(Int_t)TH->GetEntries(); + + tpcl->LoadHits(); + TTree *TH=tpcl->TreeH(); + TPC->SetTreeAddress(); + np=(Int_t)TH->GetEntries(); for (i=0; iResetHits(); TH->GetEvent(i); @@ -470,14 +531,11 @@ Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { } delete[] good; + + tpcl->UnloadHits(); + rl->UnloadgAlice(); - delete gAlice; gAlice=0; - - file->Close(); gBenchmark->Stop("AliTPCComparison"); gBenchmark->Show("AliTPCComparison"); return nt; } - - - diff --git a/TPC/AliTPCComparison2.C b/TPC/AliTPCComparison2.C index f4b219cc666..4d9d77ff30e 100644 --- a/TPC/AliTPCComparison2.C +++ b/TPC/AliTPCComparison2.C @@ -470,8 +470,8 @@ Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) { case 2: { sprintf(treeName,"TreeD_75x40_100x60_150x60_%d",event); - // TD=(TTree*)gDirectory->Get(treeName); - TD=(TTree*)fdigit->Get(treeName); + TD=(TTree*)fdigit->Get(treeName); // To be revised according to + // NewIO schema M.Kowalski TD->GetBranch("Segment")->SetAddress(&digits); count = new Int_t[np]; Int_t i; @@ -652,8 +652,3 @@ Int_t FindPrimaries(Int_t nparticles){ return nprch1; } - - - - - diff --git a/TPC/AliTPCDigitizer.cxx b/TPC/AliTPCDigitizer.cxx index 77c21172e5c..71162bce317 100644 --- a/TPC/AliTPCDigitizer.cxx +++ b/TPC/AliTPCDigitizer.cxx @@ -13,24 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2002/10/23 07:17:33 alibrary -Introducing Riostream.h - -Revision 1.7 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.3.6.1 2002/06/10 15:26:11 hristov -Merged with v3-08-02 - -Revision 1.6 2002/04/06 14:41:04 kowal2 -Added #include and log - -*/ - - - +/* $Id$ */ #include #include @@ -67,7 +50,7 @@ AliTPCDigitizer::AliTPCDigitizer(AliRunDigitizer* manager) fDebug =0; if (GetDebug()>2) cerr<<"AliTPCDigitizer::AliTPCDigitizer" - <<"(AliRunDigitizer* manager) was processed"<GetInputFolderName(0)); + if (rl == 0x0) + { + Error("ExecFast","Can not find Run Loader for input 0. Can not proceed."); + return; + } + rl->LoadgAlice(); + rl->GetAliRun(); + } AliTPC *pTPC = (AliTPC *) gAlice->GetModule("TPC"); AliTPCParam * param = pTPC->GetParam(); @@ -133,28 +133,47 @@ void AliTPCDigitizer::ExecFast(Option_t* option) Short_t **pdig= new Short_t*[nInputs]; //pointers to the expanded digits array Int_t **ptr= new Int_t*[nInputs]; //pointers to teh expanded tracks array + //create digits array for given sectors // make indexes + Stat_t nentries = 0;//number of entries in TreeS + AliSimDigits ** digarr = new AliSimDigits*[nInputs]; - for (Int_t i1=0;i1GetInputTreeTPCS(i1); - if (!treear) { - cerr<<"AliTPCDigitizer: Input tree with SDigits not found in" - <<" input "<< i1<GetInputFolderName(i1)); + gime = rl->GetLoader("TPCLoader"); + gime->LoadSDigits("read"); + TTree * treear = gime->TreeS(); + + if (!treear) + { + cerr<<"AliTPCDigitizer: Input tree with SDigits not found in" + <<" input "<< i1<GetEntries(); + + if (treear->GetIndex()==0) + treear->BuildIndex("fSegmentID","fSegmentID"); + treear->GetBranch("Segment")->SetAddress(&digarr[i1]); } - treear->GetBranch("Segment")->SetAddress(&digarr[i1]); - if (treear->GetIndex()==0) - treear->BuildIndex("fSegmentID","fSegmentID"); - } - Stat_t nentries = fManager->GetInputTreeTPCS(0)->GetEntries(); - + //create branch's in TPC treeD AliSimDigits * digrow = new AliSimDigits; - TTree * tree = fManager->GetTreeDTPC(); + + orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + ogime = orl->GetLoader("TPCLoader"); + + TTree * tree = ogime->TreeD(); + if (tree == 0x0) + { + ogime->MakeTree("D"); + tree = ogime->TreeD(); + } tree->Branch("Segment","AliSimDigits",&digrow); // @@ -164,25 +183,34 @@ void AliTPCDigitizer::ExecFast(Option_t* option) // //Loop over segments of the TPC - for (Int_t n=0; nGetInputTreeTPCS(0)->GetEvent(n); + for (Int_t n=0; nGetInputFolderName(0)); + gime = rl->GetLoader("TPCLoader"); + gime->TreeS()->GetEvent(n); digarr[0]->ExpandBuffer(); digarr[0]->ExpandTrackBuffer(); - for (Int_t i=1;iGetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); + for (Int_t i=1;iGetInputFolderName(i)); + gime = rl->GetLoader("TPCLoader"); + + gime->TreeS()->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); if ((digarr[0]->GetID()-digarr[i]->GetID())>0) - printf("problem - not corresponding segment in background event\n"); + printf("problem - not corresponding segment in background event\n"); digarr[i]->ExpandBuffer(); digarr[i]->ExpandTrackBuffer(); - } + + } Int_t sec, row; - if (!param->AdjustSectorRow(digarr[0]->GetID(),sec,row)) { + if (!param->AdjustSectorRow(digarr[0]->GetID(),sec,row)) + { cerr<<"AliTPC warning: invalid segment ID ! "<GetID()<SetID(digarr[0]->GetID()); @@ -197,68 +225,74 @@ void AliTPCDigitizer::ExecFast(Option_t* option) Int_t nElems = nrows*ncols; - for (Int_t i=0;iGetDigits(); - ptr[i] = digarr[i]->GetTracks(); - } + for (Int_t i=0;iGetDigits(); + ptr[i] = digarr[i]->GetTracks(); + } + Short_t *pdig1= digrow->GetDigits(); Int_t *ptr1= digrow->GetTracks() ; - // for (Int_t rows=0;rowsGetDigitFast(rows,col); - q += *(pdig[i]); - - for (Int_t tr=0;tr<3;tr++) { - // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); - Int_t lab = ptr[i][tr*nElems]; - if ( (lab > 1) && *(pdig[i])>zerosup) { - label[labptr]=lab+masks[i]; - labptr++; - } - } - pdig[i]++; - ptr[i]++; - - } - q/=16.; //conversion factor - // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); - Float_t noise = pTPC->GetNoise(); - q+=noise; + for (Int_t elem=0;elemGetDigitFast(rows,col); + q += *(pdig[i]); + + for (Int_t tr=0;tr<3;tr++) + { + // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); + Int_t lab = ptr[i][tr*nElems]; + if ( (lab > 1) && *(pdig[i])>zerosup) + { + label[labptr]=lab+masks[i]; + labptr++; + } + } + pdig[i]++; + ptr[i]++; + } + q/=16.; //conversion factor + // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); + Float_t noise = pTPC->GetNoise(); + q+=noise; q=TMath::Nint(q); - if (q > zerosup){ - - if(q > param->GetADCSat()) q = (Short_t)(param->GetADCSat()); - //digrow->SetDigitFast((Short_t)q,rows,col); - *pdig1 =Short_t(q); - for (Int_t tr=0;tr<3;tr++){ - if (trSetTrackIDFast(label[tr],rows,col,tr); - ptr1[tr*nElems] = label[tr]; - //else - // ((AliSimDigits*)digrow)->SetTrackIDFast(-1,rows,col,tr); - // ptr1[tr*nElems] = 1; - } - } - pdig1++; - ptr1++; - } + if (q > zerosup) + { + if(q > param->GetADCSat()) q = (Short_t)(param->GetADCSat()); + //digrow->SetDigitFast((Short_t)q,rows,col); + *pdig1 =Short_t(q); + for (Int_t tr=0;tr<3;tr++) + { + if (trCompresBuffer(1,zerosup); digrow->CompresTrackBuffer(1); tree->Fill(); if (fDebug>0) cerr<GetTreeDTPC()->Write(0,TObject::kOverwrite); + } //for (Int_t n=0; nGetOutputFolderName()); + ogime = orl->GetLoader("TPCLoader"); + ogime->WriteDigits("OVERWRITE"); + + //fManager->GetTreeDTPC()->Write(0,TObject::kOverwrite); + delete digrow; for (Int_t i1=0;i1GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); - AliTPC *pTPC = (AliTPC *) gAlice->GetModule("TPC"); + AliRunLoader *rl, *orl; + AliLoader *gime, *ogime; + + + orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + ogime = orl->GetLoader("TPCLoader"); + + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + gime = rl->GetLoader("TPCLoader"); + + rl->LoadgAlice(); + AliRun* alirun = rl->GetAliRun(); + + AliTPC *pTPC = (AliTPC *) alirun->GetModule("TPC"); AliTPCParam * param = pTPC->GetParam(); pTPC->GenerNoise(500000); //create teble with noise printf("noise %f \n", param->GetNoise()*param->GetNoiseNormFac()); @@ -290,58 +336,56 @@ void AliTPCDigitizer::ExecSave(Option_t* option) Int_t * masks = new Int_t[nInputs]; for (Int_t i=0; iGetMask(i); - // Short_t **pdig= new Short_t*[nInputs]; //pointers to the expanded digits array - //Int_t **ptr= new Int_t*[nInputs]; //pointers to teh expanded tracks array - //create digits array for given sectors - // make indexes - printf("TPC merging -2 -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); AliSimDigits ** digarr = new AliSimDigits*[nInputs]; - for (Int_t i1=0;i1GetInputTreeTPCS(i1); - printf("TPC merging -2.7 -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i1)); + gime = rl->GetLoader("TPCLoader"); + + TTree * treear = gime->TreeS(); TBranch * br = treear->GetBranch("fSegmentID"); if (br) br->GetFile()->cd(); - printf("TPC merging -2.75 -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); - //treear->BuildIndex("fSegmentID","fSegmentID"); if (!treear) { cerr<<" TPC - not existing input = \n"<GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); treear->GetBranch("Segment")->SetAddress(&digarr[i1]); - printf("TPC merging -2.9 -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); } - Stat_t nentries = fManager->GetInputTreeTPCS(0)->GetEntries(); + + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + gime = rl->GetLoader("TPCLoader"); + Stat_t nentries = gime->TreeS()->GetEntries(); //create branch's in TPC treeD AliSimDigits * digrow = new AliSimDigits; - TTree * tree = fManager->GetTreeDTPC(); - //if (tree->GetBranch("Segment") ) tree->GetBranch("Segment")->SetAddress(&digrow); - //else + TTree * tree = ogime->TreeD(); + tree->Branch("Segment","AliSimDigits",&digrow); - // - printf("TPC merging -3 -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); param->SetZeroSup(2); Int_t zerosup = param->GetZeroSup(); //Loop over segments of the TPC for (Int_t n=0; nGetInputTreeTPCS(0)->GetEvent(n); + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + gime = rl->GetLoader("TPCLoader"); + gime->TreeS()->GetEvent(n); + digarr[0]->ExpandBuffer(); digarr[0]->ExpandTrackBuffer(); for (Int_t i=1;iGetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); - //fManager->GetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),1); +// fManager->GetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); + rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i)); + gime = rl->GetLoader("TPCLoader"); + gime->TreeS()->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); digarr[i]->ExpandBuffer(); digarr[i]->ExpandTrackBuffer(); if ((digarr[0]->GetID()-digarr[i]->GetID())>0) - printf("problem\n"); + printf("problem\n"); } @@ -367,46 +411,46 @@ void AliTPCDigitizer::ExecSave(Option_t* option) for (Int_t rows=0;rowsGetDigitFast(rows,col); + q += digarr[i]->GetDigitFast(rows,col); //q += *(pdig[i]); - + for (Int_t tr=0;tr<3;tr++) { - Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); - //Int_t lab = ptr[i][tr*nElems]; + Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); + //Int_t lab = ptr[i][tr*nElems]; if ( (lab > 1) ) { label[labptr]=lab+masks[i]; labptr++; - } + } } - // pdig[i]++; - //ptr[i]++; - + // pdig[i]++; + //ptr[i]++; + } - q/=16.; //conversion factor - // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); - Float_t noise = pTPC->GetNoise(); - q+=noise; + q/=16.; //conversion factor + // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); + Float_t noise = pTPC->GetNoise(); + q+=noise; q=TMath::Nint(q); if (q > zerosup){ - - if(q > param->GetADCSat()) q = (Short_t)(param->GetADCSat()); - digrow->SetDigitFast((Short_t)q,rows,col); - // *pdig1 =Short_t(q); - for (Int_t tr=0;tr<3;tr++){ - if (trSetTrackIDFast(label[tr],rows,col,tr); - //ptr1[tr*nElems] = label[tr]; - //else - // ((AliSimDigits*)digrow)->SetTrackIDFast(-1,rows,col,tr); - // ptr1[tr*nElems] = 1; - } - } - //pdig1++; - //ptr1++; + + if(q > param->GetADCSat()) q = (Short_t)(param->GetADCSat()); + digrow->SetDigitFast((Short_t)q,rows,col); + // *pdig1 =Short_t(q); + for (Int_t tr=0;tr<3;tr++){ + if (trSetTrackIDFast(label[tr],rows,col,tr); + //ptr1[tr*nElems] = label[tr]; + //else + // ((AliSimDigits*)digrow)->SetTrackIDFast(-1,rows,col,tr); + // ptr1[tr*nElems] = 1; + } + } + //pdig1++; + //ptr1++; } } @@ -415,8 +459,18 @@ void AliTPCDigitizer::ExecSave(Option_t* option) tree->Fill(); if (fDebug>0) cerr<GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); - fManager->GetTreeDTPC()->Write(0,TObject::kOverwrite); +// printf("end TPC merging - end -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); + //fManager->GetTreeDTPC()->Write(0,TObject::kOverwrite); + ogime->WriteDigits("OVERWRITE"); + + for (Int_t i=1;iGetInputFolderName(i)); + gime = rl->GetLoader("TPCLoader"); + gime->UnloadSDigits(); + } + ogime->UnloadDigits(); + delete digrow; for (Int_t i1=0;i1IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} +// TFile *file=TFile::Open("galice.root"); +// if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} - TFile *cf=TFile::Open("galice.root"); - // if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} +// TFile *cf=TFile::Open("galice.root"); +// if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} - AliTPCParamSR *param=(AliTPCParamSR *)cf->Get("75x40_100x60"); + AliRunLoader* rl = AliRunLoader::Open(); + rl->GetEvent(eventn); + + AliLoader* tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"Can not get TPC Loader"<CdGAFile(); + AliTPCParam *param=(AliTPCParam *)gDirectory->Get("75x40_100x60"); if(param){ cerr<<"2 pad-length geom hits with 3 pad-lengths geom parameters\n"; delete param; @@ -46,18 +59,32 @@ Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFA AliTPCDigitsArray *digarr=new AliTPCDigitsArray; digarr->Setup(param); + + TTree* tree; + char cname[100]; if (!sdigits) - sprintf(cname,"TreeD_75x40_100x60_150x60_%d",eventn); + { + tpcl->LoadDigits(); + tree = tpcl->TreeD(); + } else - sprintf(cname,"TreeS_75x40_100x60_150x60_%d",eventn); + { + tpcl->LoadSDigits(); + tree = tpcl->TreeS(); + } // some "constants" Int_t markerColorSignal = 5; Int_t markerColorBgr = 2; Int_t MASK = 10000000; - digarr->ConnectTree(cname); + Int_t imarBgr=0; + Int_t imarSignal=0; + Int_t ncl=0; + + digarr->ConnectTree(tree); + Int_t nrows=Int_t(digarr->GetTree()->GetEntries()); Int_t all0=0; for (Int_t n=0; nAdjustSectorRow(s->GetID(),sec,row); Int_t npads, sign; { - const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); - if (sec < kNIS) { - npads = param->GetNPadsLow(row); - sign = (sec < kNIS/2) ? 1 : -1; - } else { - npads = param->GetNPadsUp(row); - sign = ((sec-kNIS) < kNOS/2) ? 1 : -1; - } + const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); + if (sec < kNIS) { + npads = param->GetNPadsLow(row); + sign = (sec < kNIS/2) ? 1 : -1; + } else { + npads = param->GetNPadsUp(row); + sign = ((sec-kNIS) < kNOS/2) ? 1 : -1; + } } AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row); - Int_t ncl=0; + ncl=0; if (digrow->First()){ - while(digrow->Next()) ncl++; - ncl++; + while(digrow->Next()) ncl++; + ncl++; } TPolyMarker3D *pm=new TPolyMarker3D(ncl); TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal - Int_t imarBgr=0; - Int_t imarSignal=0; + imarBgr=0; + imarSignal=0; if (digrow->First()) do { - Short_t dig=digrow->CurrentDigit(); - Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec); - Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow()); - Double_t x=param->GetPadRowRadii(sec,row); - if (digGetTrackID(digrow->CurrentRow(),digrow->CurrentColumn(),0); - Float_t cs, sn, tmp; - param->AdjustCosSin(sec,cs,sn); - tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; - if (trackId<0) continue; //if signal from croostalk - we don't have track ID information - if (trackId < MASK-1) { - pmSignal->SetPoint(imarSignal,x,y,z); - imarSignal++; - } else { - pm->SetPoint(imarBgr,x,y,z); - imarBgr++; - } + Short_t dig=digrow->CurrentDigit(); + Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec); + Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow()); + Double_t x=param->GetPadRowRadii(sec,row); +// cout<GetTrackID(digrow->CurrentRow(),digrow->CurrentColumn(),0); + Float_t cs, sn, tmp; + param->AdjustCosSin(sec,cs,sn); + tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; + if (trackId<0) continue; //if signal from croostalk - we don't have track ID information +// cout<<"Track ID > 0"; + if (trackId < MASK-1) { + pmSignal->SetPoint(imarSignal,x,y,z); + imarSignal++; + } else { + pm->SetPoint(imarBgr,x,y,z); + imarBgr++; + } } while (digrow->Next()); // change color for signal @@ -118,14 +148,17 @@ Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFA pmSignal->SetMarkerStyle(1); pmSignal->Draw(); all0+=imarSignal; +// cout<<"imarSignal ="<Close(); + //draw TPC skeleton - TGeometry *geom=(TGeometry*)file->Get("AliceGeom"); + rl->CdGAFile(); + TGeometry *geom=(TGeometry*)gDirectory->Get("AliceGeom"); TNode * main = (TNode*)((geom->GetListOfNodes())->First()); TIter next(main->GetListOfNodes()); TNode *module=0; @@ -143,8 +176,8 @@ Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFA geom->Draw("same"); //v->Draw(); c1->Modified(); c1->Update(); - - file->Close(); + + delete rl; return 0; } diff --git a/TPC/AliTPCFindClusters.C b/TPC/AliTPCFindClusters.C index 4cada652026..15267160720 100644 --- a/TPC/AliTPCFindClusters.C +++ b/TPC/AliTPCFindClusters.C @@ -13,26 +13,71 @@ #include "TStopwatch.h" #endif -Int_t AliTPCFindClusters(Int_t n=1) { - TFile *out=TFile::Open("AliTPCclusters.root","new"); - if (!out->IsOpen()) {cerr<<"Delete old AliTPCclusters.root !\n"; return 1;} - TFile *in=TFile::Open("rfio:galice.root"); - if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;} +Int_t AliTPCFindClusters(Int_t N=-1) + { + + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"Can not open session"<LoadgAlice()) + { + cerr<<"Error occured while l"<GetAliRun()->Field()->SolenoidField()); + + tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"Can not get TPC Loader"<Get("gAlice"))) { - cerr<<"gAlice have not been found on galice.root !\n"; - return 3; + gAlice=rl->GetAliRun(); + if (!gAlice) { + cerr<<"Can't get gAlice !\n"; + return 1; } - TDirectory *cwd = gDirectory; - AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); Int_t ver = TPC->IsVersion(); cerr<<"TPC version "<Get("75x40_100x60_150x60"); - if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;} + rl->CdGAFile(); + AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!dig) + { + dig=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + else + { + cout<<"TPC 75x40_100x60 geometry found"<GetNumberOfEvents(); + else n=N; + TStopwatch timer; switch (ver) { @@ -41,9 +86,12 @@ Int_t AliTPCFindClusters(Int_t n=1) { { AliTPCv1 &tpc=*((AliTPCv1*)TPC); tpc.SetParam(dig); timer.Start(); cwd->cd(); + tpc.SetLoader(tpcl); + tpcl->LoadHits("read"); + tpcl->LoadRecPoints("recreate"); for(Int_t i=0;iGetEvent(i); + rl->GetEvent(i); tpc.Hits2Clusters(out,i); } } @@ -52,27 +100,29 @@ Int_t AliTPCFindClusters(Int_t n=1) { cerr<<"Looking for clusters...\n"; { // delete gAlice; gAlice=0; - AliTPCv2 tpc; - tpc.SetParam(dig); timer.Start(); cwd->cd(); - for (Int_t i=0;iSetLoader(tpcl); + tpcl->LoadDigits("read"); + tpcl->LoadRecPoints("recreate"); + + tpc->SetParam(dig); timer.Start(); + for (Int_t i=0;iDigits2Clusters(i); + //AliTPCclusterer::Digits2Clusters(dig, out, i); } + delete tpc; } break; default: cerr<<"Invalid TPC version !\n"; + delete rl; return 5; } timer.Stop(); timer.Print(); - delete gAlice; gAlice=0; - - out->Close(); - - in->Close(); - + delete rl; return 0; } diff --git a/TPC/AliTPCFindTracks.C b/TPC/AliTPCFindTracks.C index 604a4399d53..3c67d7e3591 100644 --- a/TPC/AliTPCFindTracks.C +++ b/TPC/AliTPCFindTracks.C @@ -1,5 +1,9 @@ +/**************************************************************************** + * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * + ****************************************************************************/ + #ifndef __CINT__ - #include + #include #include "AliTPCParam.h" #include "AliTPCtracker.h" @@ -7,34 +11,81 @@ #include "TStopwatch.h" #endif -Int_t AliTPCFindTracks(Int_t eventn=1) { +Int_t AliTPCFindTracks(Int_t N=-1) { + cerr<<"Looking for tracks...\n"; - TFile *out=TFile::Open("AliTPCtracks.root","new"); - if (!out->IsOpen()) {cerr<<"Delete old AliTPCtracks.root !\n"; return 1;} + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice = 0x0; + } + + rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"Can not open session"<GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"Can not get TPC Loader"<LoadgAlice()) + { + cerr<<"Error occured while l"<GetAliRun()->Field()->SolenoidField()); + rl->CdGAFile(); + AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!dig) + { + dig=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + else + { + cout<<"TPC 75x40_100x60 geometry found"<IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 2;} + rl->UnloadgAlice() + + tpcl->LoadRecPoints("read"); + tpcl->LoadTracks("recreate"); - AliTPCParam *par=(AliTPCParam*)in->Get("75x40_100x60_150x60"); - if (!par) {cerr<<"Can't get TPC parameters !\n"; return 3;} - + Int_t eventn; + if (N<=0) + { + eventn = rl->GetNumberOfEvents(); + rl->UnloadHeader(); + } + else + eventn = N; + TStopwatch timer; - Int_t rc=0; - AliTPCtracker tracker(par); for (Int_t i=0;iClusters2Tracks(); + delete tracker; } timer.Stop(); timer.Print(); - delete par; //Thanks to Mariana Bondila - - in->Close(); - out->Close(); - + delete dig; //Thanks to Mariana Bondila + delete rl; return rc; } diff --git a/TPC/AliTPCHits2Digits.C b/TPC/AliTPCHits2Digits.C index b54e7a002aa..529900a3ea8 100644 --- a/TPC/AliTPCHits2Digits.C +++ b/TPC/AliTPCHits2Digits.C @@ -4,20 +4,25 @@ Int_t AliTPCHits2Digits(Int_t nevent=1) // new version by J.Belikov // Connect the Root Galice file containing Geometry, Kine and Hits + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } - const char * inFile_old = "galice.root"; - const char * inFile_new = "rfio:galice.root"; - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old); - if (file) {file->Close(); delete file;} - file = TFile::Open(inFile_new,"UPDATE"); - if (!file->IsOpen()) { - cerr<<"Can't open "<Get("gAlice"); + + rl->LoadgAlice(); + + gAlice = rl->GetAliRun(); if (!gAlice) { cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; return 2; @@ -27,6 +32,16 @@ Int_t AliTPCHits2Digits(Int_t nevent=1) // gAlice->GetEvent(0); AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); + AliLoader * tpcl = rl->GetLoader("TPCLoader"); + if ((TPC == 0x0) || (tpcl == 0x0)) + { + cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n"; +// delete rl; + return 3; + } + tpcl->LoadHits("READ"); + tpcl->LoadDigits("recreate"); + TStopwatch timer; timer.Start(); @@ -36,13 +51,14 @@ Int_t AliTPCHits2Digits(Int_t nevent=1) for(Int_t eventn =0;eventnGetEvent(eventn); + rl->GetEvent(eventn); TPC->SetActiveSectors(); // all sectors set active + for (Int_t i=0;i<72;i++) if (TPC->IsSectorActive(i)) printf("%d\t",i); TPC->Hits2Digits(eventn); } - delete gAlice; gAlice=0; - file->Close(); delete file; + delete rl; + timer.Stop(); timer.Print(); diff --git a/TPC/AliTPCHits2SDigits.C b/TPC/AliTPCHits2SDigits.C index acabef5cbb8..77e4b4eb21f 100644 --- a/TPC/AliTPCHits2SDigits.C +++ b/TPC/AliTPCHits2SDigits.C @@ -1,3 +1,18 @@ +#ifndef __CINT__ + #include "alles.h" + #include "AliRun.h" + #include "AliRunLoader.h" + #include "AliLoader.h" + #include "AliMagF.h" + #include "AliTPCtracker.h" + #include "AliITS.h" + #include "AliITSgeom.h" + #include "AliITSRecPoint.h" + #include "AliITSclusterV2.h" + #include "AliITSsimulationFastPoints.h" + #include "AliITStrackerV2.h" + +#endif Int_t AliTPCHits2SDigits(Int_t nevent=1) { @@ -5,29 +20,45 @@ Int_t AliTPCHits2SDigits(Int_t nevent=1) // Connect the Root Galice file containing Geometry, Kine and Hits - const char * inFile_old = "galice.root"; - const char * inFile_new = "galice.root"; - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old); - if (file) {file->Close(); delete file;} - file = TFile::Open(inFile_new,"UPDATE"); - if (!file->IsOpen()) { - cerr<<"Can't open "<GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + + AliRunLoader *rl = AliRunLoader::Open("galice.root","Event","update"); + if (!rl) + { + cerr<<"Can't load RunLoader from "<Get("gAlice"); + + rl->LoadgAlice(); + + gAlice = rl->GetAliRun(); if (!gAlice) { cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; + delete rl; return 2; } - - // gAlice->GetEvent(0); - AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); - + AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); + AliLoader * tpcl = rl->GetLoader("TPCLoader"); + if ((TPC == 0x0) || (tpcl == 0x0)) + { + cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n"; + delete rl; + return 3; + } + + tpcl->LoadHits("READ"); + tpcl->LoadSDigits("RECREATE"); + TStopwatch timer; timer.Start(); @@ -37,15 +68,16 @@ Int_t AliTPCHits2SDigits(Int_t nevent=1) for(Int_t eventn =0;eventnGetEvent(eventn); + rl->GetEvent(eventn); + TPC->SetTreeAddress(); TPC->SetActiveSectors(); // all sectors set active printf("\nActive sectors\n"); for (Int_t i=0;i<72;i++) if (TPC->IsSectorActive(i)) printf("%d\t",i); + TPC->Hits2SDigits2(eventn); } - delete gAlice; gAlice=0; - file->Close(); delete file; + delete rl; timer.Stop(); timer.Print(); diff --git a/TPC/AliTPCLoader.cxx b/TPC/AliTPCLoader.cxx new file mode 100644 index 00000000000..fd2abec9b04 --- /dev/null +++ b/TPC/AliTPCLoader.cxx @@ -0,0 +1,27 @@ +#include "AliTPCLoader.h" + +const TString AliTPCLoader::fgkDefaultHitsFileName = "TPC.Hits.root"; +const TString AliTPCLoader::fgkDefaultSDigitsFileName = "TPC.SDigits.root"; +const TString AliTPCLoader::fgkDefaultDigitsFileName = "TPC.Digits.root"; +const TString AliTPCLoader::fgkDefaultRecPointsFileName = "TPC.RecPoints.root"; +const TString AliTPCLoader::fgkDefaultTracksFileName = "TPC.Tracks.root"; + + +ClassImp(AliTPCLoader) +AliTPCLoader::AliTPCLoader() + { + } +/*****************************************************************************/ +AliTPCLoader::AliTPCLoader(const Char_t *name,const Char_t *topfoldername) + :AliLoader(name,topfoldername) +{ + if (GetDebug()) + Info("AliTPCLoader"," name = %s; topfolder = %s",name,topfoldername); +} +/*****************************************************************************/ + +AliTPCLoader::AliTPCLoader(const Char_t *name,TFolder *topfolder) + :AliLoader(name,topfolder) + { + } + diff --git a/TPC/AliTPCLoader.h b/TPC/AliTPCLoader.h new file mode 100644 index 00000000000..7a550a2b12e --- /dev/null +++ b/TPC/AliTPCLoader.h @@ -0,0 +1,37 @@ +#ifndef ALITPCGETTER_H +#define ALITPCGETTER_H + +//base class for loaders +//loader is common for reading data for all detectors +//Each detector has a loader data member +//loader is accessible via folder structure as well + +#include + + + +class AliTPCLoader: public AliLoader + { + public: + AliTPCLoader(); + AliTPCLoader(const Char_t *name,const Char_t *topfoldername); + AliTPCLoader(const Char_t *name,TFolder *topfolder); + + virtual ~AliTPCLoader(){};//----------------- + + protected: + + + private: + static const TString fgkDefaultHitsFileName; + static const TString fgkDefaultSDigitsFileName; + static const TString fgkDefaultDigitsFileName; + static const TString fgkDefaultRecPointsFileName; + static const TString fgkDefaultTracksFileName; + + + public: + ClassDef(AliTPCLoader,1) + }; + +#endif diff --git a/TPC/AliTPCPRF2D.cxx b/TPC/AliTPCPRF2D.cxx index dfcfa0294d4..7ec8a358f5c 100644 --- a/TPC/AliTPCPRF2D.cxx +++ b/TPC/AliTPCPRF2D.cxx @@ -13,46 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2001/10/21 19:07:24 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.7 2001/01/30 09:23:15 hristov -Streamers removed (R.Brun) - -Revision 1.6 2000/09/07 11:23:27 kowal2 -Improved algoritms, coding convensions applied. - -Revision 1.5 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.4.4.3 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.4.4.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.4.4.1 2000/06/14 16:48:24 kowal2 -Parameter setting improved. Removed compiler warnings - -Revision 1.4 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.3.8.2 2000/04/10 08:40:46 kowal2 - -Small changes by M. Ivanov, improvements of algorithms - -Revision 1.3.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.3 1999/10/05 17:15:46 fca -Minor syntax for the Alpha OSF - -Revision 1.2 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // AliTPCPRF2D - // diff --git a/TPC/AliTPCParam.cxx b/TPC/AliTPCParam.cxx index 2befb847ace..5b66a57d39d 100644 --- a/TPC/AliTPCParam.cxx +++ b/TPC/AliTPCParam.cxx @@ -13,78 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2003/01/28 16:42:43 hristov -Bug fix in Transform0to1 (M.Ivanov) - -Revision 1.17 2002/10/23 07:17:33 alibrary -Introducing Riostream.h - -Revision 1.16 2002/10/14 14:57:42 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.13.4.1 2002/06/10 15:26:11 hristov -Merged with v3-08-02 - -Revision 1.15 2002/05/07 17:24:02 kowal2 -Updated wires positions - -Revision 1.14 2002/03/29 06:57:45 kowal2 -Restored backward compatibility to use the hits from Dec. 2000 production. - -Revision 1.13 2002/03/18 17:59:13 kowal2 -Chnges in the pad geometry - 3 pad lengths introduced. - -Revision 1.12 2002/02/05 09:12:26 hristov -Small mods for gcc 3.02 - -Revision 1.11 2000/11/02 07:33:48 kowal2 -Automatic streamer generation. - -Revision 1.10 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.9 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.8.4.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.8.4.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.8.4.2 2000/06/14 16:48:24 kowal2 -Parameter setting improved. Removed compiler warnings - -Revision 1.8.4.1 2000/06/09 07:12:21 kowal2 - -Updated defaults - -Revision 1.8 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.7.8.2 2000/04/10 08:44:51 kowal2 - -New transformations added -Different pad and pad-rows geometries for different sectors - -Revision 1.7.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.7 1999/10/08 13:10:35 fca -Values in SetDefault are in radiants - -Revision 1.6 1999/10/08 06:27:59 fca -Defaults updated - -Revision 1.5 1999/10/05 17:18:27 fca -Correct GetWire check on even/odd fnWires - -Revision 1.4 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Manager and of geomety classes for set: TPC // diff --git a/TPC/AliTPCParamCR.cxx b/TPC/AliTPCParamCR.cxx index e1f95209034..ac03e735b30 100644 --- a/TPC/AliTPCParamCR.cxx +++ b/TPC/AliTPCParamCR.cxx @@ -13,31 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/03/18 17:59:13 kowal2 -Chnges in the pad geometry - 3 pad lengths introduced. - -Revision 1.5 2001/01/26 19:57:22 hristov -Major upgrade of AliRoot code - -Revision 1.4 2000/11/02 07:33:15 kowal2 -Improvements of the code. - -Revision 1.3 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.1 2000/06/14 16:48:24 kowal2 -Parameter setting improved. Removed compiler warnings - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:36:13 kowal2 - -New Detector parameters handling class - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Manager and of geomety classes for set: TPC // diff --git a/TPC/AliTPCParamSR.cxx b/TPC/AliTPCParamSR.cxx index a1eae05c775..08beb7fcdee 100644 --- a/TPC/AliTPCParamSR.cxx +++ b/TPC/AliTPCParamSR.cxx @@ -13,50 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.7.4.1 2002/07/24 10:09:01 alibrary -Updating VirtualMC - -Revision 1.9 2002/06/07 06:13:07 kowal2 -Corrected calculation of the cross talk in the outer sectors - -Revision 1.8 2002/06/05 15:37:31 kowal2 -Added cross-talk from the wires beyond the first and the last rows - -Revision 1.7 2002/03/18 17:59:13 kowal2 -Chnges in the pad geometry - 3 pad lengths introduced. - -Revision 1.6 2002/02/25 11:02:56 kowal2 -Changes towards speeding up the code. Thanks to Marian Ivanov. - -Revision 1.5 2001/12/06 07:49:30 kowal2 -corrected number of pads calculation - -Revision 1.4 2000/11/02 07:33:15 kowal2 -Improvements of the code. - -Revision 1.3 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.2.4.2 2000/06/14 16:48:24 kowal2 -Parameter setting improved. Removed compiler warnings - -Revision 1.2.4.1 2000/06/09 07:55:39 kowal2 - -Updated defaults - -Revision 1.2 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.1.4.2 2000/04/10 11:36:13 kowal2 - -New Detector parameters handling class - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // Manager and of geomety classes for set: TPC // diff --git a/TPC/AliTPCPid.cxx b/TPC/AliTPCPid.cxx index d9394395283..8e6cceaf83c 100644 --- a/TPC/AliTPCPid.cxx +++ b/TPC/AliTPCPid.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2003/03/04 07:36:15 kowal2 -Logs added - -*/ +/* $Id$ */ #include "AliTPCPid.h" #include "TMath.h" diff --git a/TPC/AliTPCRF1D.cxx b/TPC/AliTPCRF1D.cxx index 57a19b82550..cd3fd2e933e 100644 --- a/TPC/AliTPCRF1D.cxx +++ b/TPC/AliTPCRF1D.cxx @@ -13,38 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2002/02/12 16:07:43 kowal2 -coreccted bug in SetGauss +/* $Id$ */ -Revision 1.7 2001/01/26 19:57:22 hristov -Major upgrade of AliRoot code - -Revision 1.6 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.5.4.3 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.5.4.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.5.4.1 2000/06/14 16:48:24 kowal2 -Parameter setting improved. Removed compiler warnings - -Revision 1.5 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.4.8.2 2000/04/10 08:53:09 kowal2 - -Updates by M. Ivanov - - -Revision 1.4 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ //----------------------------------------------------------------------------- // diff --git a/TPC/AliTPCSDigits2Digits.C b/TPC/AliTPCSDigits2Digits.C index dfa6857d3e2..50a0e833ba6 100644 --- a/TPC/AliTPCSDigits2Digits.C +++ b/TPC/AliTPCSDigits2Digits.C @@ -9,30 +9,54 @@ Int_t AliTPCSDigits2Digits(Int_t nevent=1) // Connect the Root Galice file containing Geometry, Kine and Hits - const char * inFile_old = "galice.root"; + const char * inFile_old = "galice.root"; const char * inFile_new = "galice.root"; + + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old); if (file) {file->Close(); delete file;} - file = TFile::Open(inFile_new,"UPDATE"); - if (!file->IsOpen()) { + + AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","update"); + + if (!rl) { cerr<<"Can't open "<Get("gAlice"); + + rl->LoadgAlice(); + + gAlice = rl->GetAliRun(); if (!gAlice) { cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; + delete rl; return 2; } - - // gAlice->GetEvent(0); - AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); + AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); + + AliLoader * tpcl = rl->GetLoader("TPCLoader"); - AliTPCParamSR *dig=(AliTPCParamSR *)file->Get("75x40_100x60"); + if ((TPC == 0x0) || (tpcl == 0x0)) + { + cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n"; +// delete rl; + return 3; + } + + tpcl->LoadSDigits("READ"); + tpcl->LoadDigits("RECREATE"); + rl->CdGAFile(); + AliTPCParamSR *dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60"); if(dig){ cerr<<"2 pad-length geom hits with 3 pad-lengths geom digits\n"; delete dig; @@ -51,16 +75,16 @@ Int_t AliTPCSDigits2Digits(Int_t nevent=1) for(Int_t eventn =0;eventnGetEvent(eventn); - + cout<<"rl->GetEvent(eventn);\n"; + rl->GetEvent(eventn); + cout<<"TPC->SDigits2Digits2(eventn);\n"; TPC->SDigits2Digits2(eventn); } - delete gAlice; gAlice=0; - file->Close(); delete file; timer.Stop(); timer.Print(); + delete rl; return 0; }; diff --git a/TPC/AliTPCTrackHits.cxx b/TPC/AliTPCTrackHits.cxx index 570be0ffc5c..477326b239e 100644 --- a/TPC/AliTPCTrackHits.cxx +++ b/TPC/AliTPCTrackHits.cxx @@ -13,24 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.4.10.1 2002/08/28 15:06:52 alibrary -Updating to v3-09-01 - -Revision 1.5 2002/08/25 15:54:29 kowal2 -Protection against overflows in TMath::Nint. +/* $Id$ */ -Revision 1.4 2001/01/10 09:35:27 kowal2 -Changes to obey the coding rules. - -Revision 1.3 2000/11/02 10:22:50 kowal2 -Logs added - -*/ /////////////////////////////////////////////////////////////////////////////// // // // Time Projection Chamber track hits object // diff --git a/TPC/AliTPCTrackHitsV2.cxx b/TPC/AliTPCTrackHitsV2.cxx index 54c98fc47bf..6c308cd6dc0 100644 --- a/TPC/AliTPCTrackHitsV2.cxx +++ b/TPC/AliTPCTrackHitsV2.cxx @@ -13,24 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.4.6.1 2002/07/26 12:12:55 alibrary -Updating VirtualMC - -Revision 1.5 2002/07/25 16:56:52 hristov -fSize set to zero in Clear(). The size of the array is checked in First() (M.Ivanov) +/* $Id$ */ -Revision 1.4 2002/03/01 10:19:06 hristov -Additional protection (M.Ivanov) - -Revision 1.1 2002/01/21 17:14:21 kowal2 -New track hits using root containers. - -*/ /////////////////////////////////////////////////////////////////////////////// // // // Time Projection Chamber track hits object // diff --git a/TPC/AliTPCcluster.cxx b/TPC/AliTPCcluster.cxx index b169298ec8a..107417824f5 100644 --- a/TPC/AliTPCcluster.cxx +++ b/TPC/AliTPCcluster.cxx @@ -13,15 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.1.2.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -*/ +/* $Id$ */ //----------------------------------------------------------------- // Implementation of the TPC cluster class diff --git a/TPC/AliTPCclusterer.cxx b/TPC/AliTPCclusterer.cxx index ac5605270e7..aeb503fd5cd 100644 --- a/TPC/AliTPCclusterer.cxx +++ b/TPC/AliTPCclusterer.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.7.6.1 2002/06/10 15:26:12 hristov -Merged with v3-08-02 - -Revision 1.9 2002/05/09 06:57:09 kowal2 -Protection against nonexisting input tree - -Revision 1.8 2002/03/29 06:57:45 kowal2 -Restored backward compatibility to use the hits from Dec. 2000 production. - -Revision 1.7 2001/10/21 19:04:55 hristov -Several patches were done to adapt the barel reconstruction to the multi-event case. Some memory leaks were corrected. (Yu.Belikov) - -Revision 1.6 2001/08/30 09:28:48 hristov -TTree names are explicitly set via SetName(name) and then Write() is called - -Revision 1.5 2001/07/20 14:32:44 kowal2 -Processing of many events possible now - -Revision 1.4 2001/04/17 08:06:27 hristov -Possibility to define the magnetic field in the reconstruction (Yu.Belikov) - -Revision 1.3 2000/10/05 16:14:01 kowal2 -Forward declarations. - -Revision 1.2 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.1.2.1 2000/06/25 08:53:55 kowal2 -Splitted from AliTPCtracking - -*/ +/* $Id$ */ //------------------------------------------------------- // Implementation of the TPC clusterer @@ -67,6 +32,8 @@ Splitted from AliTPCtracking #include "AliTPCParam.h" #include #include +#include "AliRunLoader.h" +#include "AliLoader.h" void AliTPCclusterer::FindPeaks(Int_t k,Int_t max, AliBin *b,Int_t *idx,UInt_t *msk,Int_t& n) { @@ -120,37 +87,31 @@ AliTPCcluster &c) { } //_____________________________________________________________________________ -void AliTPCclusterer::Digits2Clusters(const AliTPCParam *par, TFile *of, Int_t eventn) +void AliTPCclusterer::Digits2Clusters(const AliTPCParam *par, AliLoader *of, Int_t eventn) { //----------------------------------------------------------------- // This is a simple cluster finder. //----------------------------------------------------------------- + AliRunLoader* rl = (AliRunLoader*)of->GetEventFolder()->FindObject(AliRunLoader::fgkRunLoaderName); + rl->GetEvent(eventn); TDirectory *savedir=gDirectory; - if (!of->IsOpen()) { + if (of->TreeR() == 0x0) of->MakeTree("R"); + + + if (of == 0x0) + { cerr<<"AliTPC::Digits2Clusters(): output file not open !\n"; return; - } + } const Int_t kMAXZ=par->GetMaxTBin()+2; - char dname[100]; - char cname[100]; - if (eventn==-1) { - - // for backward compatibility - - sprintf(dname,"TreeD_75x40_100x60_150x60"); - sprintf(cname,"TreeC_TPC"); - } - else { - sprintf(dname,"TreeD_75x40_100x60_150x60_%d",eventn); - sprintf(cname,"TreeC_TPC_%d",eventn); - } - TTree *t = (TTree *)gDirectory->Get(dname); + + TTree *t = (TTree *)of->TreeD(); if (!t) { - cerr<<"Input tree with "<GetBranch("Segment")->SetAddress(&dummy); Stat_t nentries = t->GetEntries(); - of->cd(); + cout<<"Got "<Write(par->GetTitle()); +// ((AliTPCParam*)par)->Write(par->GetTitle()); + AliTPCClustersArray carray; carray.Setup(par); carray.SetClusterType("AliTPCcluster"); - carray.MakeTree(); + + TTree* treeR = of->TreeR(); + carray.MakeTree(treeR); Int_t nclusters=0; - for (Int_t n=0; nGetEvent(n); + for (Int_t n=0; nGetEvent(n); + if (!par->AdjustSectorRow(digarr.GetID(),sec,row)) { cerr<<"AliTPC warning: invalid segment ID ! "<SetName(cname); - carray.GetTree()->Write(); + of->WriteRecPoints("OVERWRITE"); + savedir->cd(); - delete t; //Thanks to Mariana Bondila +// delete t; //Thanks to Mariana Bondila } diff --git a/TPC/AliTPCclusterer.h b/TPC/AliTPCclusterer.h index 48bedac2077..0b12df79e0c 100644 --- a/TPC/AliTPCclusterer.h +++ b/TPC/AliTPCclusterer.h @@ -17,10 +17,11 @@ class TFile; class AliTPCParam; class AliTPCcluster; +class AliLoader; class AliTPCclusterer { public: - static void Digits2Clusters(const AliTPCParam *par, TFile *of, Int_t eventn=1); + static void Digits2Clusters(const AliTPCParam *par, AliLoader *of, Int_t eventn=1); private: class AliBin { diff --git a/TPC/AliTPCclustererMI.cxx b/TPC/AliTPCclustererMI.cxx index 82cc2d80cf3..f721615028d 100644 --- a/TPC/AliTPCclustererMI.cxx +++ b/TPC/AliTPCclustererMI.cxx @@ -13,15 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2003/03/05 11:16:15 kowal2 -Logs added - -*/ - - - +/* $Id$ */ //------------------------------------------------------- // Implementation of the TPC clusterer @@ -38,7 +30,6 @@ Logs added #include "AliDigits.h" #include "AliSimDigits.h" #include "AliTPCParam.h" -#include "AliTPCBuffer160.h" #include "Riostream.h" #include @@ -46,11 +37,10 @@ ClassImp(AliTPCclustererMI) -AliTPCclustererMI::AliTPCclustererMI(const AliTPCParam* par) +AliTPCclustererMI::AliTPCclustererMI() { fInput =0; fOutput=0; - fParam = par; } void AliTPCclustererMI::SetInput(TTree * tree) { @@ -413,11 +403,9 @@ void AliTPCclustererMI::AddCluster(AliTPCclusterMI &c){ if (kj<0) kj=0; if (kj>=fMaxTime-3) kj=fMaxTime-4; // ki and kj shifted to "real" coordinata - if (fRowDig) { - c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,0)-2,0); - c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,1)-2,1); - c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,2)-2,2); - } + c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,0)-2,0); + c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,1)-2,1); + c.SetLabel(fRowDig->GetTrackIDFast(kj,ki,2)-2,2); Float_t s2 = c.GetSigmaY2(); @@ -524,216 +512,78 @@ void AliTPCclustererMI::Digits2Clusters(const AliTPCParam *par, Int_t eventn) } while (digarr.Next()); digarr.ExpandTrackBuffer(); - FindClusters(); - - fOutput->Fill(); - delete clrow; - nclusters+=fNcluster; - delete[] fBins; - delete[] fResBins; - } - cerr<<"Number of found clusters : "<Write(); - savedir->cd(); -} - -void AliTPCclustererMI::Digits2Clusters(const char* fileName) -{ -//----------------------------------------------------------------- -// This is a cluster finder for raw data. -// -// It assumes, that the input file contains uncompressed data -// in TPC Altro format without mini headers. -// It also assumes, that the data is sorted in a such a way that -// data from different pad rows is not mixed. The order of pads -// in a pad row can be random. -//----------------------------------------------------------------- - - TDirectory* savedir = gDirectory; - - AliTPCBuffer160 buffer(fileName, 0); // buffer for reading raw data - fRowDig = NULL; - if (!fOutput) { - Error("Digits2Clusters", "output tree not initialised !\n"); - return; - } - fOutput->GetCurrentFile()->cd(); - const_cast(fParam)->Write(); - - Int_t nclusters = 0; - - fMaxTime = fParam->GetMaxTBin() + 6; // add 3 virtual time bins before and 3 after - const Int_t kNIS = fParam->GetNInnerSector(); - const Int_t kNOS = fParam->GetNOuterSector(); - fZWidth = fParam->GetZWidth(); - Int_t zeroSup = fParam->GetZeroSup(); - Int_t offset = 1; - - Int_t nWords, iPad, iRow; - Int_t prevSector = -1; - Int_t prevRow = -1; - fBins = NULL; - while (buffer.ReadTrailerBackward(nWords, iPad, iRow, fSector) == 0) { - Int_t nSkip = (4 - (nWords % 4)) % 4; - - // when the sector or row number has changed ... - if ((fSector != prevSector) || (iRow != prevRow)) { - - // ... find clusters in the previous pad row, and ... - if (fBins) { - FindClusters(); - - fOutput->Fill(); - delete fRowCl; - nclusters += fNcluster; - delete[] fBins; - delete[] fResBins; - } - - // ... prepare for the next pad row - fRowCl = new AliTPCClustersRow; - fRowCl->SetClass("AliTPCclusterMI"); - fRowCl->SetArray(1); - - fRowCl->SetID(fParam->GetIndex(fSector, iRow)); - fOutput->GetBranch("Segment")->SetAddress(&fRowCl); - fRx = fParam->GetPadRowRadii(fSector, iRow); - - if (fSector < kNIS) { - fMaxPad = fParam->GetNPadsLow(iRow); - fSign = (fSector < kNIS/2) ? 1 : -1; - } else { - fMaxPad = fParam->GetNPadsUp(iRow); - fSign = ((fSector-kNIS) < kNOS/2) ? 1 : -1; - } - fPadLength = fParam->GetPadPitchLength(fSector, iRow); - fPadWidth = fParam->GetPadPitchWidth(); - - fMaxBin = fMaxTime*(fMaxPad+6); // add 3 virtual pads before and 3 after - fBins = new Int_t[fMaxBin]; - fResBins = new Int_t[fMaxBin]; //fBins with residuals after 1 finder loop - memset(fBins, 0, sizeof(Int_t)*fMaxBin); - - prevSector = fSector; - prevRow = iRow; + //add virtual charge at the edge + for (Int_t i=0; i0){ + Float_t amp2 = fBins[i+4*fMaxTime]; + if (amp2==0) amp2=0.5; + Float_t sigma2 = GetSigmaY2(i); + amp0 = (amp1*amp1/amp2)*TMath::Exp(-1./sigma2); + if (gDebug>4) printf("\n%f\n",amp0); + } + fBins[i+2*fMaxTime] = Int_t(amp0); + amp0 = 0; + amp1 = fBins[(fMaxPad+2)*fMaxTime+i]; + if (amp1>0){ + Float_t amp2 = fBins[i+(fMaxPad+1)*fMaxTime]; + if (amp2==0) amp2=0.5; + Float_t sigma2 = GetSigmaY2(i); + amp0 = (amp1*amp1/amp2)*TMath::Exp(-1./sigma2); + if (gDebug>4) printf("\n%f\n",amp0); + } + fBins[(fMaxPad+3)*fMaxTime+i] = Int_t(amp0); } - // fill fBins with digits data - for (Int_t iWord = 0; iWord < nSkip; iWord++) { - if (buffer.GetNextBackWord() != 0x2AA) { - Error("Digits2Clusters", "could not read dummy data\n"); - break; + memcpy(fResBins,fBins, fMaxBin*2); + // + fNcluster=0; + //first loop - for "gold cluster" + fLoop=1; + Int_t *b=&fBins[-1]+2*fMaxTime; + Int_t crtime = Int_t((fParam->GetZLength()-1.05*fRx)/fZWidth-5); + + for (Int_t i=2*fMaxTime; i 0) { - Int_t bunchLength = buffer.GetNextBackWord() - 2; - if (bunchLength < 0) { - Error("Digits2Clusters", "could not read bunch length\n"); - break; - } - Int_t timeBin = buffer.GetNextBackWord(); - if (timeBin < 0) { - Error("Digits2Clusters", "could not read time bin\n"); - break; - } - for (Int_t iTimeBin = timeBin; iTimeBin > timeBin-bunchLength; iTimeBin--) { - Int_t dig = buffer.GetNextBackWord(); - if (dig < 0) { - Error("Digits2Clusters", "could not read sample amplitude\n"); - break; - } - dig += offset; - if (dig <= zeroSup) continue; - Int_t i = iPad + 3; - Int_t j = iTimeBin + 3; - fBins[i*fMaxTime+j] = dig; - } - nWords -= 2+bunchLength; + //memcpy(fBins,fResBins, fMaxBin*2); + //second loop - for rest cluster + /* + fLoop=2; + b=&fResBins[-1]+2*fMaxTime; + for (Int_t i=2*fMaxTime; iFill(); - delete fRowCl; - nclusters += fNcluster; + delete clrow; + nclusters+=fNcluster; delete[] fBins; delete[] fResBins; - } - - Info("Digits2Clusters", "Number of found clusters : %d\n", nclusters); - + } + cerr<<"Number of found clusters : "<Write(); savedir->cd(); } - -void AliTPCclustererMI::FindClusters() -{ - //add virtual charge at the edge - for (Int_t i=0; i0){ - Float_t amp2 = fBins[i+4*fMaxTime]; - if (amp2==0) amp2=0.5; - Float_t sigma2 = GetSigmaY2(i); - amp0 = (amp1*amp1/amp2)*TMath::Exp(-1./sigma2); - if (gDebug>4) printf("\n%f\n",amp0); - } - fBins[i+2*fMaxTime] = Int_t(amp0); - amp0 = 0; - amp1 = fBins[(fMaxPad+2)*fMaxTime+i]; - if (amp1>0){ - Float_t amp2 = fBins[i+(fMaxPad+1)*fMaxTime]; - if (amp2==0) amp2=0.5; - Float_t sigma2 = GetSigmaY2(i); - amp0 = (amp1*amp1/amp2)*TMath::Exp(-1./sigma2); - if (gDebug>4) printf("\n%f\n",amp0); - } - fBins[(fMaxPad+3)*fMaxTime+i] = Int_t(amp0); - } - -// memcpy(fResBins,fBins, fMaxBin*2); - memcpy(fResBins,fBins, fMaxBin); - // - fNcluster=0; - //first loop - for "gold cluster" - fLoop=1; - Int_t *b=&fBins[-1]+2*fMaxTime; - Int_t crtime = Int_t((fParam->GetZLength()-1.05*fRx)/fZWidth-5); - - for (Int_t i=2*fMaxTime; iLoadMacro("$(ALICE_ROOT)/macros/grun.C"); - grun(); + grun(n); - -AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); + AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); Int_t ver=gAlice->GetDetector("TPC")->IsVersion(); - delete gAlice; gAlice=0; - + + AliRunLoader* rl = gAlice->GetRunLoader(); + if (rl == 0x0) + { + cerr<<"Can not get run loader from gAlice"< Proceeding witg digitization \n\n\n"; if ((ver!=1)&&(ver!=2)) { cerr<<"Invalid TPC version: "<Field()->SolenoidField()); if (ver==2) { gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCHits2Digits.C"); - if (rc=AliTPCHits2Digits()) return rc; + if (rc=AliTPCHits2Digits(n)) return rc; //gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCDisplayDigits.C"); //if (rc=AliTPCDisplayDigits(1,1)) return rc; @@ -32,13 +41,13 @@ AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); //Test TPC reconstruction gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindClusters.C"); - if (rc=AliTPCFindClusters()) return rc; + if (rc=AliTPCFindClusters(n)) return rc; //gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCDisplayClusters.C"); //if (rc=AliTPCDisplayClusters()) return rc; gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindTracks.C"); - if (rc=AliTPCFindTracks()) return rc; + if (rc=AliTPCFindTracks(n)) return rc; gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS"); gROOT->ProcessLine(".L $(ALICE_ROOT)/TPC/AliTPCComparison.C++"); diff --git a/TPC/AliTPCtrack.cxx b/TPC/AliTPCtrack.cxx index c5970e463f7..d8a565fbcc5 100644 --- a/TPC/AliTPCtrack.cxx +++ b/TPC/AliTPCtrack.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.9.4.3 2003/07/10 17:09:51 hristov +Merging to v3-10-00 + +Revision 1.22 2003/05/22 13:48:21 hristov +First implementation of ESD classes (Yu.Belikov) + Revision 1.21 2003/05/22 10:46:46 hristov Using access methods instead of data members diff --git a/TPC/AliTPCtrackPid.cxx b/TPC/AliTPCtrackPid.cxx index 2d915d96007..e55be39e2ad 100644 --- a/TPC/AliTPCtrackPid.cxx +++ b/TPC/AliTPCtrackPid.cxx @@ -13,9 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ #include "AliTPCtrackPid.h" diff --git a/TPC/AliTPCtracker.cxx b/TPC/AliTPCtracker.cxx index ab37003d078..dee9237690b 100644 --- a/TPC/AliTPCtracker.cxx +++ b/TPC/AliTPCtracker.cxx @@ -13,140 +13,76 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.34 2003/05/22 13:57:48 hristov -First implementation of ESD classes (Yu.Belikov) - -Revision 1.32 2003/04/10 10:36:54 hristov -Code for unified TPC/TRD tracking (S.Radomski) - -Revision 1.31 2003/03/19 17:14:11 hristov -Load/UnloadClusters added to the base class and the derived classes changed correspondingly. Possibility to give 2 input files for ITS and TPC tracks in PropagateBack. TRD tracker uses fEventN from the base class (T.Kuhr) - -Revision 1.30 2003/02/28 16:13:32 hristov -Typos corrected - -Revision 1.29 2003/02/28 15:18:16 hristov -Corrections suggested by J.Chudoba - -Revision 1.28 2003/02/27 16:15:52 hristov -Code for inward refitting (S.Radomski) - -Revision 1.27 2003/02/25 16:47:58 hristov -allow back propagation for more than 1 event (J.Chudoba) - -Revision 1.26 2003/02/19 08:49:46 hristov -Track time measurement (S.Radomski) - -Revision 1.25 2003/01/28 16:43:35 hristov -Additional protection: to be discussed with the Root team (M.Ivanov) - -Revision 1.24 2002/11/19 16:13:24 hristov -stdlib.h included to declare exit() on HP - -Revision 1.23 2002/11/19 11:50:08 hristov -Removing CONTAINERS (Yu.Belikov) - -Revision 1.19 2002/07/19 07:31:40 kowal2 -Improvement in tracking by J. Belikov - -Revision 1.18 2002/05/13 07:33:52 kowal2 -Added protection in Int_t AliTPCtracker::AliTPCRow::Find(Double_t y) const -in the case of defined region of interests. - -Revision 1.17 2002/03/18 17:59:13 kowal2 -Chnges in the pad geometry - 3 pad lengths introduced. - -Revision 1.16 2001/11/08 16:39:03 hristov -Additional protection (M.Masera) - -Revision 1.15 2001/11/08 16:36:33 hristov -Updated V2 stream of tracking (Yu.Belikov). The new long waited features are: 1) Possibility to pass the primary vertex position to the trackers (both for the TPC and the ITS) 2) Possibility to specify the number of tracking passes together with applying (or not applying) the vertex constraint (ITS only) 3) Possibility to make some use of partial PID provided by the TPC when doing tracking in the ITS (ITS only) 4) V0 reconstruction with a helix minimisation of the DCA. (new macros: AliV0FindVertices.C and AliV0Comparison.C) 4a) ( Consequence of the 4) ) All the efficiencies and resolutions are from now on calculated including *secondary*particles* too. (Don't be surprised by the drop in efficiency etc) - -Revision 1.14 2001/10/21 19:04:55 hristov -Several patches were done to adapt the barel reconstruction to the multi-event case. Some memory leaks were corrected. (Yu.Belikov) - -Revision 1.13 2001/07/23 12:01:30 hristov -Initialisation added - -Revision 1.12 2001/07/20 14:32:44 kowal2 -Processing of many events possible now - -Revision 1.11 2001/05/23 08:50:10 hristov -Weird inline removed - -Revision 1.10 2001/05/16 14:57:25 alibrary -New files for folders and Stack - -Revision 1.9 2001/05/11 07:16:56 hristov -Fix needed on Sun and Alpha - -Revision 1.8 2001/05/08 15:00:15 hristov -Corrections for tracking in arbitrary magnenetic field. Changes towards a concept of global Alice track. Back propagation of reconstructed tracks (Yu.Belikov) - -Revision 1.5 2000/12/20 07:51:59 kowal2 -Changes suggested by Alessandra and Paolo to avoid overlapped -data fields in encapsulated classes. - -Revision 1.4 2000/11/02 07:27:16 kowal2 -code corrections - -Revision 1.2 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.1.2.1 2000/06/25 08:53:55 kowal2 -Splitted from AliTPCtracking - -*/ +/* $Id$ */ //------------------------------------------------------- // Implementation of the TPC tracker // // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //------------------------------------------------------- + #include #include #include +#include +#include #include -#include "AliESD.h" - #include "AliTPCtracker.h" #include "AliTPCcluster.h" #include "AliTPCParam.h" -#include "AliClusters.h" - -#include "TVector2.h" - -#include - -ClassImp(AliTPCtracker) +#include "AliTPCClustersRow.h" +#include "AliTPCcluster.h" //_____________________________________________________________________________ -AliTPCtracker::AliTPCtracker(const AliTPCParam *par): -AliTracker(), fkNIS(par->GetNInnerSector()/2), fkNOS(par->GetNOuterSector()/2) +AliTPCtracker::AliTPCtracker(const AliTPCParam *par, Int_t eventn, const char* evfoldname): +AliTracker(), fkNIS(par->GetNInnerSector()/2), fkNOS(par->GetNOuterSector()/2), +fEvFolderName(evfoldname) { //--------------------------------------------------------------------- // The main TPC tracker constructor //--------------------------------------------------------------------- + cout<<"fkNIS = "<GetEvent(fEventN); + + AliLoader* tpcl = rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + Error("AliTPCtracker","Can not get TPC Laoder from Run Loader"); + return; + } + if (tpcl->TreeR() == 0x0) tpcl->LoadRecPoints("read"); + TTree* treeR = tpcl->TreeR(); + if (treeR == 0x0) + { + cout<<"Error: Can not get TreeR\n"; + } + fClustersArray.Setup(par); + fClustersArray.SetClusterType("AliTPCcluster"); + fClustersArray.ConnectTree(treeR); + + fSeeds=0; } //_____________________________________________________________________________ @@ -160,96 +96,6 @@ AliTPCtracker::~AliTPCtracker() { fSeeds->Delete(); delete fSeeds; } - - // [SR, 01.04.2003] - if (fBarrelFile) { - fBarrelFile->Close(); - delete fBarrelFile; - } -} - -//_____________________________________________________________________________ - -void AliTPCtracker::SetBarrelTree(const char *mode) { - // - // Creates a tree for BarrelTracks - // mode = "back" or "refit" - // - // [SR, 01.04.2003] - // - - if (!IsStoringBarrel()) return; - - TDirectory *sav = gDirectory; - if (!fBarrelFile) fBarrelFile = new TFile("AliBarrelTracks.root", "UPDATE"); - - char buff[40]; - sprintf(buff, "BarrelTPC_%d_%s", GetEventNumber(), mode); - - fBarrelFile->cd(); - fBarrelTree = new TTree(buff, "Barrel TPC tracks"); - - if (!fBarrelArray) fBarrelArray = new TClonesArray("AliBarrelTrack", 4); - for(Int_t i=0; i<4; i++) new((*fBarrelArray)[i]) AliBarrelTrack(); - - fBarrelTree->Branch("tracks", &fBarrelArray); - - sav->cd(); -} -//_____________________________________________________________________________ - -void AliTPCtracker::StoreBarrelTrack(AliTPCtrack *ps, Int_t refPlane, Int_t isIn) { - // - // Stores Track at a given reference plane - // - // refPlane: 1-4 - // isIn: 1 - backward, 2 - refit - // - - if (!IsStoringBarrel()) return; - if (refPlane < 0 || refPlane > 4) return; - if (isIn > 2) return; - - static Int_t nClusters; - static Int_t nWrong; - static Double_t chi2; - static Int_t index; - - Int_t newClusters, newWrong; - Double_t newChi2; - - if ( (refPlane == 1 && isIn == kTrackBack) || - (refPlane == 4 && isIn == kTrackRefit) ) { - - fBarrelArray->Clear(); - nClusters = nWrong = 0; - chi2 = 0.0; - index = 0; - } - - // propagate - Double_t refX = 0; - if (refPlane == 1) refX = fParam->GetInnerRadiusLow(); - if (refPlane == 2) refX = fParam->GetInnerRadiusUp(); - if (refPlane == 3) refX = fParam->GetOuterRadiusLow(); - if (refPlane == 4) refX = fParam->GetOuterRadiusUp(); - - ps->PropagateTo(refX); - - fBarrelTrack = (AliBarrelTrack*)(*fBarrelArray)[index++]; - ps->GetBarrelTrack(fBarrelTrack); - - newClusters = ps->GetNumberOfClusters() - nClusters; - newWrong = ps->GetNWrong() - nWrong; - newChi2 = ps->GetChi2() - chi2; - - nClusters = ps->GetNumberOfClusters(); - nWrong = ps->GetNWrong(); - chi2 = ps->GetChi2(); - - fBarrelTrack->SetNClusters(newClusters, newChi2); - fBarrelTrack->SetNWrongClusters(newWrong); - fBarrelTrack->SetRefPlane(refPlane, isIn); } //_____________________________________________________________________________ @@ -344,97 +190,99 @@ Double_t f3(Double_t x1,Double_t y1, return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); } -Int_t AliTPCtracker::LoadClusters() { - return LoadClusters(gFile); -} - //_____________________________________________________________________________ -Int_t AliTPCtracker::LoadClusters(const TFile *cf) { +void AliTPCtracker::LoadOuterSectors() { //----------------------------------------------------------------- - // This function loads TPC clusters. + // This function fills outer TPC sectors with clusters. //----------------------------------------------------------------- - if (!((TFile*)cf)->IsOpen()) { - cerr<<"AliTPCtracker::LoadClusters : "<< - "file with clusters has not been open !\n"; - return 1; + UInt_t index; + TTree* tree = fClustersArray.GetTree(); + if (tree == 0x0) + { + Error("LoadOuterSectors","Can not get tree from fClustersArray"); + return; + } + Int_t j=Int_t(tree->GetEntries()); + cout<<"fClustersArray.GetTree()->GetEntries() = "<AdjustSectorRow(s->GetID(),sec,row); + if (secGetArray()->GetEntriesFast(); + while (ncl--) { + AliTPCcluster *c=(AliTPCcluster*)(*clrow)[ncl]; + index=(((sec<<8)+row)<<16)+ncl; + fOuterSec[(sec-fkNIS*2)%fkNOS][row].InsertCluster(c,index); + } } - Char_t name[100]; - sprintf(name,"TreeC_TPC_%d",GetEventNumber()); - TTree *cTree=(TTree*)((TFile*)cf)->Get(name); - if (!cTree) { - cerr<<"AliTPCtracker::LoadClusters : "<< - "can't get the tree with TPC clusters !\n"; - return 2; - } + fN=fkNOS; + fSectors=fOuterSec; +} - TBranch *branch=cTree->GetBranch("Segment"); - if (!branch) { - cerr<<"AliTPCtracker::LoadClusters : "<< - "can't get the segment branch !\n"; - return 3; +//_____________________________________________________________________________ +void AliTPCtracker::UnloadOuterSectors() { + //----------------------------------------------------------------- + // This function clears outer TPC sectors. + //----------------------------------------------------------------- + Int_t nup=fOuterSec->GetNRows(); + for (Int_t i=0; iSetAddress(&addr); - - Int_t nentr=(Int_t)cTree->GetEntries(); - - for (Int_t i=0; iGetEvent(i); - - Int_t ncl=carray.GetArray()->GetEntriesFast(); + fN=0; + fSectors=0; +} - Int_t nir=fInnerSec->GetNRows(), nor=fOuterSec->GetNRows(); - Int_t id=carray.GetID(); - if ((id<0) || (id>2*(fkNIS*nir + fkNOS*nor))) { - cerr<<"AliTPCtracker::LoadClusters : "<< - "wrong index !\n"; - exit(1); - } - Int_t outindex = 2*fkNIS*nir; - if (idGetEntries()); + for (Int_t i=0; iAdjustSectorRow(s->GetID(),sec,row); + if (sec>=fkNIS*2) continue; + AliTPCClustersRow *clrow=fClustersArray.GetRow(sec,row); + Int_t ncl=clrow->GetArray()->GetEntriesFast(); + while (ncl--) { + AliTPCcluster *c=(AliTPCcluster*)(*clrow)[ncl]; + index=(((sec<<8)+row)<<16)+ncl; + fInnerSec[sec%fkNIS][row].InsertCluster(c,index); } - carray.GetArray()->Clear(); } - delete cTree; - return 0; + + fN=fkNIS; + fSectors=fInnerSec; } //_____________________________________________________________________________ -void AliTPCtracker::UnloadClusters() { +void AliTPCtracker::UnloadInnerSectors() { //----------------------------------------------------------------- - // This function unloads TPC clusters. + // This function clears inner TPC sectors. //----------------------------------------------------------------- - Int_t i; - for (i=0; iGetNRows(); - for (Int_t n=0; nGetNRows(); - for (Int_t n=0; nGetNRows(); + for (Int_t i=0; iGetY() > y+road) break; - if (c->IsUsed()) continue; - if ((c->GetZ()-z)*(c->GetZ()-z) > 16.*(t.GetSigmaZ2()+sz2)) continue; - Double_t chi2=t.GetPredictedChi2(c); - if (chi2 > maxchi2) continue; - maxchi2=chi2; - cl=c; + AliTPCcluster *c=(AliTPCcluster*)(krow[i]); + if (c->GetY() > y+road) break; + if (c->IsUsed()) continue; + if ((c->GetZ()-z)*(c->GetZ()-z) > 16.*(t.GetSigmaZ2()+sz2)) continue; + Double_t chi2=t.GetPredictedChi2(c); + if (chi2 > maxchi2) continue; + maxchi2=chi2; + cl=c; index=krow.GetIndex(i); } } @@ -512,94 +356,6 @@ Int_t AliTPCtracker::FollowProlongation(AliTPCseed& t, Int_t rf) { return 1; } -//_____________________________________________________________________________ - -Int_t AliTPCtracker::FollowRefitInward(AliTPCseed *seed, AliTPCtrack *track) { - // - // This function propagates seed inward TPC using old clusters - // from the track. - // - // Sylwester Radomski, GSI - // 26.02.2003 - // - - Double_t alpha=seed->GetAlpha() - fSectors->GetAlphaShift(); - TVector2::Phi_0_2pi(alpha); - Int_t s=Int_t(alpha/fSectors->GetAlpha())%fN; - - Int_t idx=-1, sec=-1, row=-1; - Int_t nc = seed->GetNumber(); - - idx=track->GetClusterIndex(nc); - sec=(idx&0xff000000)>>24; - row=(idx&0x00ff0000)>>16; - - if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; } - else { if (sec < fkNIS) row=-1; } - - Int_t nr=fSectors->GetNRows(); - for (Int_t i=nr-1; i>=0; i--) { - - //cout << endl; - //cout << i << "\t" << nc << "\t"<< row << "\t" << seed->Pt() << "\t" << track->Pt() << "\t\t"; - - Double_t x=fSectors->GetX(i); - if (!seed->PropagateTo(x)) return 0; - - // Change sector and rotate seed if necessary - - Double_t ymax=fSectors->GetMaxY(i); - Double_t y=seed->GetY(); - - if (y > ymax) { - s = (s+1) % fN; - if (!seed->Rotate(fSectors->GetAlpha())) return 0; - } else if (y <-ymax) { - s = (s-1+fN) % fN; - if (!seed->Rotate(-fSectors->GetAlpha())) return 0; - } - - // try to find a cluster - - AliTPCcluster *cl=0; - Int_t index = 0; - Double_t maxchi2 = kMaxCHI2; - - if (row==i) { - - //cout << row << endl; - // accept already found cluster - AliTPCcluster *c=(AliTPCcluster*)GetCluster(idx); - Double_t chi2 = seed->GetPredictedChi2(c); - - index=idx; - cl=c; - maxchi2=chi2; - - //cout << c->GetY() << "\t" << seed->GetY() << "\t" << track->GetY(); - - if (--nc >= 0 /* track->GetNumberOfClusters()*/ ) { - idx=track->GetClusterIndex(nc); - sec=(idx&0xff000000)>>24; - row=(idx&0x00ff0000)>>16; - } - - if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; } - else { if (sec < fkNIS) row=-1; } - - } - - if (cl) { - Float_t l=fSectors->GetPadPitchWidth(); - Float_t corr=1.; if (i>63) corr=0.67; // new (third) pad response ! - seed->SetSampledEdx(cl->GetQ()/l*corr,seed->GetNumberOfClusters()); - seed->Update(cl,maxchi2,index); - } - } - - seed->SetNumber(nc); - return 1; -} //_____________________________________________________________________________ Int_t AliTPCtracker::FollowBackProlongation @@ -613,22 +369,18 @@ Int_t AliTPCtracker::FollowBackProlongation Int_t s=Int_t(alpha/fSectors->GetAlpha())%fN; Int_t idx=-1, sec=-1, row=-1; - //Int_t nc=seed.GetLabel(); //index of the cluster to start with - Int_t nc=seed.GetNumber(); - + Int_t nc=seed.GetLabel(); //index of the cluster to start with if (nc--) { idx=track.GetClusterIndex(nc); sec=(idx&0xff000000)>>24; row=(idx&0x00ff0000)>>16; } - if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; } - else { if (sec < fkNIS) row=-1; } + if (fSectors==fInnerSec) { if (sec >= 2*fkNIS) row=-1; } + else { if (sec < 2*fkNIS) row=-1; } Int_t nr=fSectors->GetNRows(); for (Int_t i=0; iGetX(i), ymax=fSectors->GetMaxY(i); - //cout << i << "\t" << nc << "\t" << row << "\t" << track.GetNumberOfClusters() << endl; - if (!seed.PropagateTo(x)) return 0; Double_t y=seed.GetY(); @@ -653,12 +405,9 @@ Int_t AliTPCtracker::FollowBackProlongation return 0; } + Int_t accepted=seed.GetNumberOfClusters(); if (row==i) { - - //if (fSectors == fInnerSec && row == 0) - //cout << "row == " << row << endl; - //try to accept already found cluster AliTPCcluster *c=(AliTPCcluster*)GetCluster(idx); Double_t chi2; @@ -670,8 +419,8 @@ Int_t AliTPCtracker::FollowBackProlongation idx=track.GetClusterIndex(nc); sec=(idx&0xff000000)>>24; row=(idx&0x00ff0000)>>16; } - if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; } - else { if (sec < fkNIS) row=-1; } + if (fSectors==fInnerSec) { if (sec >= 2*fkNIS) row=-1; } + else { if (sec < 2*fkNIS) row=-1; } } if (!cl) { @@ -680,14 +429,14 @@ Int_t AliTPCtracker::FollowBackProlongation if (accepted>27) if (krow) { for (Int_t i=krow.Find(y-road); iGetY() > y+road) break; - if (c->IsUsed()) continue; - if ((c->GetZ()-z)*(c->GetZ()-z)>16.*(seed.GetSigmaZ2()+sz2)) continue; - Double_t chi2=seed.GetPredictedChi2(c); - if (chi2 > maxchi2) continue; - maxchi2=chi2; - cl=c; + AliTPCcluster *c=(AliTPCcluster*)(krow[i]); + if (c->GetY() > y+road) break; + if (c->IsUsed()) continue; + if ((c->GetZ()-z)*(c->GetZ()-z)>16.*(seed.GetSigmaZ2()+sz2)) continue; + Double_t chi2=seed.GetPredictedChi2(c); + if (chi2 > maxchi2) continue; + maxchi2=chi2; + cl=c; index=krow.GetIndex(i); } } @@ -702,8 +451,7 @@ Int_t AliTPCtracker::FollowBackProlongation } - //seed.SetLabel(nc); - seed.SetNumber(nc); + seed.SetLabel(nc); return 1; } @@ -713,44 +461,47 @@ void AliTPCtracker::MakeSeeds(Int_t i1, Int_t i2) { //----------------------------------------------------------------- // This function creates track seeds. //----------------------------------------------------------------- + cout<<" Making Seeds i1="<GetAlpha(), shift=fSectors->GetAlphaShift(); + Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); Double_t cs=cos(alpha), sn=sin(alpha); - Double_t x1 =fSectors->GetX(i1); - Double_t xx2=fSectors->GetX(i2); + Double_t x1 =fOuterSec->GetX(i1); + Double_t xx2=fOuterSec->GetX(i2); - for (Int_t ns=0; nsGetY(), z1=kr1[is]->GetZ(); for (Int_t js=0; js < nl+nm+nu; js++) { - const AliTPCcluster *kcl; + const AliTPCcluster *kcl; Double_t x2, y2, z2; Double_t x3=GetX(), y3=GetY(), z3=GetZ(); - if (jsGetY(); z2=kcl->GetZ(); x2= xx2*cs+y2*sn; y2=-xx2*sn+y2*cs; - } else - if (jsGetY(); z2=kcl->GetZ(); - } else { - const AliTPCRow& kr2=fSectors[(ns+1)%fN][i2]; - kcl=kr2[js-nl-nm]; + } else { + const AliTPCRow& kr2=fOuterSec[(ns+1)%fkNOS][i2]; + kcl=kr2[js-nl-nm]; y2=kcl->GetY(); z2=kcl->GetZ(); x2=xx2*cs-y2*sn; y2=xx2*sn+y2*cs; - } + } Double_t zz=z1 - (z1-z3)/(x1-x3)*(x1-x2); if (TMath::Abs(zz-z2)>5.) continue; @@ -758,33 +509,33 @@ void AliTPCtracker::MakeSeeds(Int_t i1, Int_t i2) { Double_t d=(x2-x1)*(0.-y2)-(0.-x2)*(y2-y1); if (d==0.) {cerr<<"MakeSeeds warning: Straight seed !\n"; continue;} - x[0]=y1; - x[1]=z1; - x[4]=f1(x1,y1,x2,y2,x3,y3); - if (TMath::Abs(x[4]) >= 0.0066) continue; - x[2]=f2(x1,y1,x2,y2,x3,y3); - //if (TMath::Abs(x[4]*x1-x[2]) >= 0.99999) continue; - x[3]=f3(x1,y1,x2,y2,z1,z2); - if (TMath::Abs(x[3]) > 1.2) continue; - Double_t a=asin(x[2]); - Double_t zv=z1 - x[3]/x[4]*(a+asin(x[4]*x1-x[2])); - if (TMath::Abs(zv-z3)>10.) continue; + x[0]=y1; + x[1]=z1; + x[4]=f1(x1,y1,x2,y2,x3,y3); + if (TMath::Abs(x[4]) >= 0.0066) continue; + x[2]=f2(x1,y1,x2,y2,x3,y3); + //if (TMath::Abs(x[4]*x1-x[2]) >= 0.99999) continue; + x[3]=f3(x1,y1,x2,y2,z1,z2); + if (TMath::Abs(x[3]) > 1.2) continue; + Double_t a=asin(x[2]); + Double_t zv=z1 - x[3]/x[4]*(a+asin(x[4]*x1-x[2])); + if (TMath::Abs(zv-z3)>10.) continue; Double_t sy1=kr1[is]->GetSigmaY2(), sz1=kr1[is]->GetSigmaZ2(); Double_t sy2=kcl->GetSigmaY2(), sz2=kcl->GetSigmaZ2(); //Double_t sy3=400*3./12., sy=0.1, sz=0.1; Double_t sy3=25000*x[4]*x[4]+0.1, sy=0.1, sz=0.1; - Double_t f40=(f1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; - Double_t f42=(f1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; - Double_t f43=(f1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; - Double_t f20=(f2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; - Double_t f22=(f2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; - Double_t f23=(f2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; - Double_t f30=(f3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; - Double_t f31=(f3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; - Double_t f32=(f3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; - Double_t f34=(f3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; + Double_t f40=(f1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; + Double_t f42=(f1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; + Double_t f43=(f1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; + Double_t f20=(f2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; + Double_t f22=(f2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; + Double_t f23=(f2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; + Double_t f30=(f3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; + Double_t f31=(f3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; + Double_t f32=(f3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; + Double_t f34=(f3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; c[0]=sy1; c[1]=0.; c[2]=sz1; @@ -796,13 +547,17 @@ void AliTPCtracker::MakeSeeds(Int_t i1, Int_t i2) { c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; UInt_t index=kr1.GetIndex(is); - AliTPCseed *track=new AliTPCseed(index, x, c, x1, ns*alpha+shift); - Float_t l=fSectors->GetPadPitchWidth(); + AliTPCseed *track=new AliTPCseed(index, x, c, x1, ns*alpha+shift); + Float_t l=fOuterSec->GetPadPitchWidth(); track->SetSampledEdx(kr1[is]->GetQ()/l,0); Int_t rc=FollowProlongation(*track, i2); if (rc==0 || track->GetNumberOfClusters()<(i1-i2)/2) delete track; - else fSeeds->AddLast(track); + else + { + fSeeds->AddLast(track); + cout<<"Adding seed "<GetEntries()<<"\r"; + } } } } @@ -849,402 +604,189 @@ Int_t AliTPCtracker::ReadSeeds(const TFile *inp) { } //_____________________________________________________________________________ -Int_t AliTPCtracker::Clusters2Tracks(AliESD *event) { - //----------------------------------------------------------------- - // This is a track finder. - // The clusters must be already loaded ! - //----------------------------------------------------------------- - - //find track seeds - Int_t nup=fOuterSec->GetNRows(), nlow=fInnerSec->GetNRows(); - Int_t nrows=nlow+nup; - if (fSeeds==0) { - Int_t gap=Int_t(0.125*nrows), shift=Int_t(0.5*gap); - fSectors=fOuterSec; fN=fkNOS; - fSeeds=new TObjArray(15000); - MakeSeeds(nup-1, nup-1-gap); - MakeSeeds(nup-1-shift, nup-1-shift-gap); - } - fSeeds->Sort(); - - Int_t nseed=fSeeds->GetEntriesFast(); - for (Int_t i=0; iUncheckedAt(i), &t=*pt; - if (!FollowProlongation(t)) { - delete fSeeds->RemoveAt(i); - continue; - } - - //tracking in the inner sectors - fSectors=fInnerSec; fN=fkNIS; - - Double_t alpha=t.GetAlpha() - fInnerSec->GetAlphaShift(); - if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); - if (alpha < 0. ) alpha += 2.*TMath::Pi(); - Int_t ns=Int_t(alpha/fInnerSec->GetAlpha())%fkNIS; - - alpha=ns*fInnerSec->GetAlpha()+fInnerSec->GetAlphaShift()-t.GetAlpha(); - - if (t.Rotate(alpha)) { - if (FollowProlongation(t)) { - if (t.GetNumberOfClusters() >= Int_t(0.4*nrows)) { - t.CookdEdx(); - CookLabel(pt,0.1); //For comparison only - pt->PropagateTo(fParam->GetInnerRadiusLow()); - AliESDtrack iotrack; - iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); - - event->AddTrack(&iotrack); - - UseClusters(&t); - } - } - } - delete fSeeds->RemoveAt(i); - } - - cerr<<"Number of found tracks : "<GetNumberOfTracks()<Clear(); delete fSeeds; fSeeds=0; - - return 0; -} - -//_____________________________________________________________________________ -Int_t AliTPCtracker::Clusters2Tracks(const TFile *inp, TFile *out) { +Int_t AliTPCtracker::Clusters2Tracks() +{ //----------------------------------------------------------------- // This is a track finder. //----------------------------------------------------------------- - TDirectory *savedir=gDirectory; + Int_t retval = 0; - if (inp) { - TFile *in=(TFile*)inp; - if (!in->IsOpen()) { - cerr<<"AliTPCtracker::Clusters2Tracks(): input file is not open !\n"; - return 1; + AliRunLoader* rl = AliRunLoader::GetRunLoader(fEvFolderName); + if (rl == 0x0) + { + Error("Clusters2Tracks","Can not get RL from specified folder %s",fEvFolderName.Data()); + return 1; + } + + retval = rl->GetEvent(fEventN); + if (retval) + { + Error("Clusters2Tracks","Error while getting event %d",fEventN); + return 1; + } + + AliLoader* tpcl = rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + Error("Clusters2Tracks","Can not get TPC Laoder from Run Loader"); + return 1; + } + + if ( tpcl->TreeR() == 0x0) + { + retval = tpcl->LoadRecPoints("READ"); + if (retval) + { + Error("Clusters2Tracks","Error while loading Reconstructed Points"); + return 1; } - } - - if (!out->IsOpen()) { - cerr<<"AliTPCtracker::Clusters2Tracks(): output file is not open !\n"; - return 2; - } - - LoadClusters(); - - out->cd(); + } + + if (tpcl->TreeT() == 0x0) tpcl->MakeTree("T"); - char tname[100]; - sprintf(tname,"TreeT_TPC_%d",GetEventNumber()); - TTree tracktree(tname,"Tree with TPC tracks"); + TTree &tracktree = *(tpcl->TreeT()); + + TBranch* br= tracktree.GetBranch("tracks"); + if (br) + { + Error("Clusters2Tracks","Branch \"tracks\" already exists in TreeT for TPC"); + return 1; + } + AliTPCtrack *iotrack=0; - tracktree.Branch("tracks","AliTPCtrack",&iotrack,32000,3); + tracktree.Branch("tracks","AliTPCtrack",&iotrack,32000,0); + + LoadOuterSectors(); //find track seeds Int_t nup=fOuterSec->GetNRows(), nlow=fInnerSec->GetNRows(); Int_t nrows=nlow+nup; if (fSeeds==0) { Int_t gap=Int_t(0.125*nrows), shift=Int_t(0.5*gap); - fSectors=fOuterSec; fN=fkNOS; - fSeeds=new TObjArray(15000); MakeSeeds(nup-1, nup-1-gap); MakeSeeds(nup-1-shift, nup-1-shift-gap); - } + } fSeeds->Sort(); - Int_t found=0; + //tracking in outer sectors Int_t nseed=fSeeds->GetEntriesFast(); - - cout << fInnerSec->GetNRows() << " " << fOuterSec->GetNRows() << endl; - - for (Int_t i=0; icd(); - - UnloadClusters(); - fSeeds->Clear(); delete fSeeds; fSeeds=0; - - return 0; -} -//_____________________________________________________________________________ - -Int_t AliTPCtracker::RefitInward(TFile *in, TFile *out) { - // - // The function propagates tracks throught TPC inward - // using already associated clusters. - // - // in - file with back propagated tracks - // outs - file with inward propagation - // - // Sylwester Radomski, GSI - // 26.02.2003 - // - - if (!in->IsOpen()) { - cout << "Input File not open !\n" << endl; - return 1; - } - - if (!out->IsOpen()) { - cout << "Output File not open !\n" << endl; - return 2; - } - - TDirectory *savedir = gDirectory; - LoadClusters(); - - // Connect to input tree - in->cd(); - TTree *inputTree = (TTree*)in->Get("seedsTPCtoTRD_0"); - TBranch *inBranch = inputTree->GetBranch("tracks"); - AliTPCtrack *inTrack = 0; - inBranch->SetAddress(&inTrack); - - Int_t nTracks = (Int_t)inputTree->GetEntries(); - - // Create output tree - out->cd(); - AliTPCtrack *outTrack = new AliTPCtrack(); - TTree *outputTree = new TTree("tracksTPC_0","Refited TPC tracks"); - outputTree->Branch("tracks", "AliTPCtrack", &outTrack, 32000, 3); - - // [SR, 01.04.2003] - Barrel tracks - if (IsStoringBarrel()) SetBarrelTree("refit"); - - Int_t nRefited = 0; - - for(Int_t t=0; t < nTracks; t++) { - - cout << t << "\r"; - - inputTree->GetEvent(t); - inTrack->ResetCovariance(); - AliTPCseed *seed = new AliTPCseed(*inTrack, inTrack->GetAlpha()); - - /* - //cout << inTrack->GetNumberOfClusters() << endl; - if (inTrack->GetNumberOfClusters() == 158) { - cout << inTrack->GetNumberOfClusters() << endl; - cout << endl; - for(Int_t c=0; cGetNumberOfClusters(); c++) { - Int_t idx = inTrack->GetClusterIndex(c); - Int_t row=(idx&0x00ff0000)>>16; - cout << c << " " << row << endl; - } - } - */ - - if (IsStoringBarrel()) StoreBarrelTrack(seed, 4, 2); - - seed->SetNumber(inTrack->GetNumberOfClusters()-1); - fSectors = fOuterSec; - Int_t res = FollowRefitInward(seed, inTrack); - UseClusters(seed); - Int_t nc = seed->GetNumberOfClusters(); - - if (IsStoringBarrel()) StoreBarrelTrack(seed, 3, 2); - if (IsStoringBarrel()) StoreBarrelTrack(seed, 2, 2); - - fSectors = fInnerSec; - res = FollowRefitInward(seed, inTrack); - UseClusters(seed, nc); - - if (IsStoringBarrel()) StoreBarrelTrack(seed, 1, 2); - - if (res) { - seed->PropagateTo(fParam->GetInnerRadiusLow()); - outTrack = (AliTPCtrack*)seed; - outTrack->SetLabel(inTrack->GetLabel()); - outputTree->Fill(); - nRefited++; - } - - if (IsStoringBarrel()) fBarrelTree->Fill(); - delete seed; - } - - cout << "Refitted " << nRefited << " tracks." << endl; + } + UnloadInnerSectors(); + UnloadOuterSectors(); - out->cd(); - outputTree->Write(); - - // [SR, 01.04.2003] - if (IsStoringBarrel()) { - fBarrelFile->cd(); - fBarrelTree->Write(); - fBarrelFile->Flush(); - - delete fBarrelArray; - delete fBarrelTree; - } + tpcl->WriteTracks("OVERWRITE"); - if (inputTree) delete inputTree; - if (outputTree) delete outputTree; - - savedir->cd(); - UnloadClusters(); + cerr<<"Number of found tracks : "<GetNumberOfTracks(); - Info("PropagateBack", "Number of ESD tracks: %d\n", nentr); - - Int_t ntrk=0; - for (Int_t i=0; iGetTrack(i); - ULong_t status=esd->GetStatus(); - - if ( (status & AliESDtrack::kTPCin ) == 0 ) continue; - if ( (status & AliESDtrack::kTPCout) != 0 ) continue; - - const AliTPCtrack t(*esd); - AliTPCseed s(t,t.GetAlpha()); - - if (status==AliESDtrack::kTPCin) s.ResetCovariance(); - else if ( (status & AliESDtrack::kITSout) == 0 ) continue; - - Int_t nc=t.GetNumberOfClusters(); - s.SetNumber(nc); //set number of the cluster to start with - - //inner sectors - fSectors=fInnerSec; fN=fkNIS; - - Double_t alpha=s.GetAlpha() - fSectors->GetAlphaShift(); - if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); - if (alpha < 0. ) alpha += 2.*TMath::Pi(); - Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN; - alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift(); - alpha-=s.GetAlpha(); - - if (!s.Rotate(alpha)) continue; - if (!FollowBackProlongation(s,t)) continue; - - - //outer sectors - fSectors=fOuterSec; fN=fkNOS; - - alpha=s.GetAlpha() - fSectors->GetAlphaShift(); - if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); - if (alpha < 0. ) alpha += 2.*TMath::Pi(); - ns=Int_t(alpha/fSectors->GetAlpha())%fN; - - alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift(); - alpha-=s.GetAlpha(); - - if (!s.Rotate(alpha)) continue; - if (!FollowBackProlongation(s,t)) continue; - { - Int_t nrows=fOuterSec->GetNRows()+fInnerSec->GetNRows(); - if (s.GetNumberOfClusters() < Int_t(0.4*nrows)) continue; - } - s.PropagateTo(fParam->GetOuterRadiusUp()); - s.CookdEdx(); - CookLabel(&s,0.1); //For comparison only - UseClusters(&s); - esd->UpdateTrackParams(&s,AliESDtrack::kTPCout); - ntrk++; - } - cerr<<"Number of back propagated tracks: "<GetEvent(fEventN); + if (retval) + { + Error("Clusters2Tracks","Error while getting event %d",fEventN); + return 1; + } + + AliLoader* tpcl = rl->GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + Error("Clusters2Tracks","Can not get TPC Laoder from Run Loader"); + return 1; + } - if (!in->IsOpen()) { - cerr<<"AliTPCtracker::PropagateBack(): "; - cerr<<"file with TPC (or back propagated ITS) tracks is not open !\n"; + AliLoader* itsl = rl->GetLoader("ITSLoader"); + if (tpcl == 0x0) + { + Error("Clusters2Tracks","Can not get ITS Laoder from Run Loader"); return 1; - } + } + + if (itsl->TreeT() == 0x0) itsl->LoadTracks(); - if (!out->IsOpen()) { - cerr<<"AliTPCtracker::PropagateBack(): "; - cerr<<"file for back propagated TPC tracks is not open !\n"; - return 2; + TTree *bckTree=itsl->TreeT(); + if (!bckTree) { + cerr<<"AliTPCtracker::PropagateBack() "; + cerr<<"can't get a tree with back propagated ITS tracks !\n"; + return 3; } + + AliTPCtrack *bckTrack=new AliTPCtrack; + bckTree->SetBranchAddress("tracks",&bckTrack); - LoadClusters(); - in->cd(); - char tName[100]; - sprintf(tName,"TreeT_ITSb_%d",GetEventNumber()); - TTree *bckTree=(TTree*)in->Get(tName); - if (!bckTree && inp2) bckTree=(TTree*)in2->Get(tName); + TFile* in = 0x0; + TFile* out = 0x0; + cout<<"And NOW there will be a segmentation violation!!!!\n"; + bckTree=(TTree*)in->Get("TreeT_ITSb_0"); if (!bckTree) { cerr<<"AliTPCtracker::PropagateBack() "; cerr<<"can't get a tree with back propagated ITS tracks !\n"; - //return 3; + return 3; } - AliTPCtrack *bckTrack=new AliTPCtrack; - if (bckTree) bckTree->SetBranchAddress("tracks",&bckTrack); - sprintf(tName,"TreeT_TPC_%d",GetEventNumber()); - TTree *tpcTree=(TTree*)in->Get(tName); + + TTree *tpcTree=(TTree*)in->Get("TreeT_TPC_0"); if (!tpcTree) { cerr<<"AliTPCtracker::PropagateBack() "; cerr<<"can't get a tree with TPC tracks !\n"; @@ -1253,77 +795,12 @@ Int_t AliTPCtracker::PropagateBack(const TFile *inp, const TFile *inp2, TFile *o AliTPCtrack *tpcTrack=new AliTPCtrack; tpcTree->SetBranchAddress("tracks",&tpcTrack); - // [SR, 01.04.2003] - Barrel tracks - if (IsStoringBarrel()) SetBarrelTree("back"); - - //*** Prepare an array of tracks to be back propagated +//*** Prepare an array of tracks to be back propagated Int_t nup=fOuterSec->GetNRows(), nlow=fInnerSec->GetNRows(); Int_t nrows=nlow+nup; - // - // Match ITS tracks with old TPC tracks - // the tracks do not have to be sorted [SR, GSI, 18.02.2003] - // - // the algorithm is linear and uses LUT for sorting - // cost of the algorithm: 2 * number of tracks - // - - TObjArray tracks(15000); - Int_t i=0; - Int_t tpcN= (Int_t)tpcTree->GetEntries(); - Int_t bckN= (bckTree)? (Int_t)bckTree->GetEntries() : 0; - - // look up table - const Int_t nLab = 200000; // limit on number of primaries (arbitrary) - Int_t lut[nLab]; - for(Int_t i=0; iGetEvent(i); - Int_t lab = TMath::Abs(bckTrack->GetLabel()); - if (lab < nLab) lut[lab] = i; - else { - cerr << "AliTPCtracker: The size of the LUT is too small\n"; - } - } - } - - for (Int_t i=0; iGetEvent(i); - Double_t alpha=tpcTrack->GetAlpha(); - - if (!bckTree) { - - // No ITS - use TPC track only - - tpcTrack->ResetCovariance(); - AliTPCseed * seed = new AliTPCseed(*tpcTrack, tpcTrack->GetAlpha()); - - fSeeds->AddLast(seed); - tracks.AddLast(new AliTPCtrack(*tpcTrack)); - - } else { - - // with ITS - // discard not prolongated tracks (to be discussed) - - Int_t lab = TMath::Abs(tpcTrack->GetLabel()); - if (lab > nLab || lut[lab] < 0) continue; - - bckTree->GetEvent(lut[lab]); - bckTrack->Rotate(alpha-bckTrack->GetAlpha()); - - fSeeds->AddLast(new AliTPCseed(*bckTrack,bckTrack->GetAlpha())); - tracks.AddLast(new AliTPCtrack(*tpcTrack)); - } - } - - // end of matching - - /* TObjArray tracks(15000); - Int_t i=0, j=0; + Int_t i=0,j=0; Int_t tpcN=(Int_t)tpcTree->GetEntries(); Int_t bckN=(Int_t)bckTree->GetEntries(); if (jGetEvent(j++); @@ -1341,62 +818,38 @@ Int_t AliTPCtracker::PropagateBack(const TFile *inp, const TFile *inp2, TFile *o } tracks.AddLast(new AliTPCtrack(*tpcTrack)); } - */ - - out->cd(); - - // tree name seedsTPCtoTRD as expected by TRD and as - // discussed and decided in Strasbourg (May 2002) - // [SR, GSI, 18.02.2003] - - sprintf(tName,"seedsTPCtoTRD_%d",GetEventNumber()); - TTree backTree(tName,"Tree with back propagated TPC tracks"); + out->cd(); + TTree backTree("TreeT_TPCb_0","Tree with back propagated TPC tracks"); AliTPCtrack *otrack=0; backTree.Branch("tracks","AliTPCtrack",&otrack,32000,0); - // - Int_t nRefPlane; - Int_t found=0; +//*** Back propagation through inner sectors + LoadInnerSectors(); Int_t nseed=fSeeds->GetEntriesFast(); - - // loop changed [SR, 01.04.2003] - for (i=0; iClear(); - AliTPCseed *ps=(AliTPCseed*)fSeeds->UncheckedAt(i), &s=*ps; const AliTPCtrack *pt=(AliTPCtrack*)tracks.UncheckedAt(i), &t=*pt; - ps->ResetNWrong(); - ps->ResetNRotation(); - - if (IsStoringBarrel()) StoreBarrelTrack(ps, 1, 1); - - // Load outer sectors - fSectors=fInnerSec; - fN=fkNIS; - Int_t nc=t.GetNumberOfClusters(); - //s.SetLabel(nc-1); //set number of the cluster to start with - s.SetNumber(nc); + s.SetLabel(nc-1); //set number of the cluster to start with - if (FollowBackProlongation(s,t)) UseClusters(&s); - else { - fSeeds->RemoveAt(i); + if (FollowBackProlongation(s,t)) { + UseClusters(&s); continue; } + delete fSeeds->RemoveAt(i); + } + UnloadInnerSectors(); - if (IsStoringBarrel()) StoreBarrelTrack(ps, 2, 1); - if (IsStoringBarrel()) StoreBarrelTrack(ps, 3, 1); - - // Load outer sectors - fSectors=fOuterSec; - fN=fkNOS; - - nc=s.GetNumberOfClusters(); +//*** Back propagation through outer sectors + LoadOuterSectors(); + Int_t found=0; + for (i=0; iUncheckedAt(i), &s=*ps; + if (!ps) continue; + Int_t nc=s.GetNumberOfClusters(); + const AliTPCtrack *pt=(AliTPCtrack*)tracks.UncheckedAt(i), &t=*pt; Double_t alpha=s.GetAlpha() - fSectors->GetAlphaShift(); if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); @@ -1407,44 +860,24 @@ Int_t AliTPCtracker::PropagateBack(const TFile *inp, const TFile *inp2, TFile *o alpha-=s.GetAlpha(); if (s.Rotate(alpha)) { - if (FollowBackProlongation(s,t)) { - if (s.GetNumberOfClusters() >= Int_t(0.4*nrows)) { - s.CookdEdx(); - s.SetLabel(t.GetLabel()); - UseClusters(&s,nc); - - // Propagate to outer reference plane for comparison reasons - // reason for keeping fParam object [SR, GSI, 18.02.2003] - - ps->PropagateTo(fParam->GetOuterRadiusUp()); - otrack=ps; - backTree.Fill(); - - if (IsStoringBarrel()) StoreBarrelTrack(ps, 4, 1); - cerr<= Int_t(0.4*nrows)) { + s.CookdEdx(); + s.SetLabel(t.GetLabel()); + UseClusters(&s,nc); + otrack=ps; + backTree.Fill(); + cerr<Fill(); delete fSeeds->RemoveAt(i); } + UnloadOuterSectors(); - - out->cd(); backTree.Write(); - // [SR, 01.04.2003] - if (IsStoringBarrel()) { - fBarrelFile->cd(); - fBarrelTree->Write(); - fBarrelFile->Flush(); - - delete fBarrelArray; - delete fBarrelTree; - } - - savedir->cd(); cerr<<"Number of seeds: "<>16; Int_t ncl=(index&0x0000ffff)>>00; - const AliTPCcluster *cl=0; - - if (secfClustersArray.GetRow(sec,row); + return (AliCluster*)(*clrow)[ncl]; } //__________________________________________________________________________ @@ -1551,6 +974,7 @@ void AliTPCtracker::AliTPCSector::Setup(const AliTPCParam *par, Int_t f) { f2PadPitchLength=f1PadPitchLength; fN=par->GetNRowLow(); +// cout<<"par->GetNRowLow() = "<GetNRowLow()<<" fN = "<GetPadRowRadiiLow(i)); } else { @@ -1569,39 +993,19 @@ void AliTPCtracker::AliTPCSector::Setup(const AliTPCParam *par, Int_t f) { } //_________________________________________________________________________ -void AliTPCtracker:: -AliTPCRow::InsertCluster(const AliTPCcluster* c, Int_t sec, Int_t row) { +void +AliTPCtracker::AliTPCRow::InsertCluster(const AliTPCcluster* c, UInt_t index) { //----------------------------------------------------------------------- // Insert a cluster into this pad row in accordence with its y-coordinate //----------------------------------------------------------------------- if (fN==kMaxClusterPerRow) { cerr<<"AliTPCRow::InsertCluster(): Too many clusters !\n"; return; } - - Int_t index=(((sec<<8)+row)<<16)+fN; - - if (fN==0) { - fIndex[0]=index; - fClusterArray[0]=*c; fClusters[fN++]=fClusterArray; - return; - } - - if (fN==fSize) { - Int_t size=fSize*2; - AliTPCcluster *buff=new AliTPCcluster[size]; - memcpy(buff,fClusterArray,fSize*sizeof(AliTPCcluster)); - for (Int_t i=0; iGetY()); memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTPCcluster*)); memmove(fIndex +i+1 ,fIndex +i,(fN-i)*sizeof(UInt_t)); - fIndex[i]=index; - fClusters[i]=fClusterArray+fN; fClusterArray[fN++]=*c; + fIndex[i]=index; fClusters[i]=c; fN++; } //___________________________________________________________________ @@ -1627,24 +1031,17 @@ void AliTPCtracker::AliTPCseed::CookdEdx(Double_t low, Double_t up) { //----------------------------------------------------------------- Int_t i; Int_t nc=GetNumberOfClusters(); - - Int_t swap;//stupid sorting - do { - swap=0; - for (i=0; iGetLoader("TPCLoader"); + if (tpcloader == 0x0) + { + Error("BuildTPCtracks","Can not get TPC Loader from Run Loader."); + return 3; + } + +/********************************************/ + TFile *fileDB=0; TTree *covTreePi[50]; TTree *covTreeKa[50]; @@ -224,8 +228,13 @@ Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out) { infile->cd(); // Get gAlice object from file - if(!(gAlice=(AliRun*)infile->Get("gAlice"))) { - cerr<<"gAlice has not been found on galice.root !\n"; + + rl->LoadgAlice(); + rl->LoadHeader(); + tpcloader->LoadHits("read"); + + if(!(gAlice=rl->GetAliRun())) { + cerr<<"Can not get gAlice from Run Loader !\n"; return 1; } @@ -244,6 +253,8 @@ Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out) { AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC"); Int_t ver = TPC->IsVersion(); cerr<<"+++ TPC version "<CdGAFile(); AliTPCParam *digp=(AliTPCParam*)infile->Get("75x40_100x60"); if(digp){ delete digp; @@ -309,11 +320,11 @@ Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out) { // Create the seeds for the TPC tracks at the inner radius of TPC if(fColl==0) { // Get TreeH with hits - TTree *TH = gAlice->TreeH(); + TTree *TH = tpcloader->TreeH(); MakeSeedsFromHits(TPC,TH,sArray); } else { // Get TreeTR with track references - TTree *TTR = gAlice->TreeTR(); + TTree *TTR = rl->TreeTR(); MakeSeedsFromRefs(TTR,sArray); } diff --git a/TPC/AliTPCtrackerParam.h b/TPC/AliTPCtrackerParam.h index de2f445afb3..dbf4c59c0ec 100644 --- a/TPC/AliTPCtrackerParam.h +++ b/TPC/AliTPCtrackerParam.h @@ -40,7 +40,8 @@ class AliTPCtrackerParam { // ///////////////////////////////////////////////////////////////////////// public: - AliTPCtrackerParam(const Int_t coll=0,const Double_t Bz=0.4,const Int_t n=1); + AliTPCtrackerParam(const Int_t coll=0,const Double_t Bz=0.4,const Int_t n=1, + const char* evfoldname = AliConfig::fgkDefaultEventFolderName); virtual ~AliTPCtrackerParam(); // this function performs the parameterized tracking @@ -128,6 +129,8 @@ class AliTPCtrackerParam { //******* end of internal class **************** private: + TString fEvFolderName;//! name of data folder + Int_t fNevents; // number of events in the file to be processed Double_t fBz; // value of the z component of L3 field (Tesla) Int_t fColl; // collision code (0: PbPb6000; 1: pp) diff --git a/TPC/AliTPCv0.cxx b/TPC/AliTPCv0.cxx index 1ef437197bb..5ce219090b4 100644 --- a/TPC/AliTPCv0.cxx +++ b/TPC/AliTPCv0.cxx @@ -13,95 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.29 2002/11/21 22:43:32 alibrary -Removing AliMC and AliMCProcess - -Revision 1.28 2002/10/23 07:17:34 alibrary -Introducing Riostream.h - -Revision 1.27 2001/06/12 07:07:41 kowal2 -New files for folder and stack - -Revision 1.26 2001/05/08 16:03:06 kowal2 -Geometry update according to the latest technical spec. - -Revision 1.25 2001/04/27 15:23:06 kowal2 -Correct materian in the central part of the inner containment vessel - -Revision 1.24 2001/04/26 06:15:11 kowal2 -Corrected bug in the inner containment vessel (cones) - -Revision 1.23 2001/04/24 11:17:33 kowal2 -New TPC geometry. - -Revision 1.22 2001/03/13 13:07:33 kowal2 -Corrected bug in the TPC mother volume geometry. -Thanks to A. Morsch - -Revision 1.21 2000/11/14 10:48:57 kowal2 -Correct material used for TSA4. Thanks to J. Barbosa. - -Revision 1.20 2000/11/06 17:24:10 kowal2 -Corrected bug in the outer containment vessel and -the outer field cage geometry. -Thanks to J. Barbosa. - -Revision 1.19 2000/11/02 16:55:24 kowal2 -Corrected bug in the inner containment vessel geometry. -Thanks to J. Belikov - -Revision 1.18 2000/11/02 07:24:11 kowal2 -Correction in the TPC geometry. -Changes due to the new hit structure. - -Revision 1.17 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.16 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.15.2.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.15.2.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.15.2.2 2000/06/16 12:58:13 kowal2 -Changed parameter settings - -Revision 1.15.2.1 2000/06/09 07:15:07 kowal2 - -Defaults loaded automatically (hard-wired) -Optional parameters can be set via macro called in the constructor - -Revision 1.15 2000/05/15 10:00:30 kowal2 -Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova - -Revision 1.14 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.13.8.2 2000/04/10 08:33:44 kowal2 - -Updated readout chambers - -Revision 1.13.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.13 1999/11/04 17:28:06 fca -Correct barrel part of HV Degrader - -Revision 1.12 1999/10/08 06:27:23 fca -Corrected bug in the HV degrader geometry, thanks to G.Tabary - -Revision 1.11 1999/10/04 13:39:54 fca -Correct array index problem - -Revision 1.10 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // /////////////////////////////////////////////////////////////////////////////// @@ -117,18 +29,19 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// -#include +#include + #include +#include #include #include -#include "AliTPCv0.h" -#include "AliRun.h" -#include -#include -#include "AliConst.h" +#include -#include "AliTPCParamSR.h" +#include "AliConst.h" +#include "AliRun.h" #include "AliTPCDigitsArray.h" +#include "AliTPCParamSR.h" +#include "AliTPCv0.h" ClassImp(AliTPCv0) diff --git a/TPC/AliTPCv1.cxx b/TPC/AliTPCv1.cxx index 8b06c9f66df..6cf6cf3d6a6 100644 --- a/TPC/AliTPCv1.cxx +++ b/TPC/AliTPCv1.cxx @@ -13,99 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.32 2002/11/21 22:43:32 alibrary -Removing AliMC and AliMCProcess - -Revision 1.31 2002/10/23 07:17:34 alibrary -Introducing Riostream.h - -Revision 1.30 2001/06/12 07:07:41 kowal2 -New files for folder and stack - -Revision 1.29 2001/05/08 16:03:06 kowal2 -Geometry update according to the latest technical spec. - -Revision 1.28 2001/04/27 15:23:07 kowal2 -Correct materian in the central part of the inner containment vessel - -Revision 1.27 2001/04/26 06:15:12 kowal2 -Corrected bug in the inner containment vessel (cones) - -Revision 1.26 2001/04/24 11:17:33 kowal2 -New TPC geometry. - -Revision 1.25 2001/03/13 13:07:34 kowal2 -Corrected bug in the TPC mother volume geometry. -Thanks to A. Morsch - -Revision 1.24 2000/11/30 11:48:50 kowal2 -TLorentzVector.h adde to satisfy the latest changes by Federico - -Revision 1.23 2000/11/14 10:48:57 kowal2 -Correct material used for TSA4. Thanks to J. Barbosa. - -Revision 1.22 2000/11/06 17:24:10 kowal2 -Corrected bug in the outer containment vessel and -the outer field cage geometry. -Thanks to J. Barbosa. - -Revision 1.21 2000/11/02 16:55:24 kowal2 -Corrected bug in the inner containment vessel geometry. -Thanks to J. Belikov - -Revision 1.20 2000/11/02 07:24:11 kowal2 -Correction in the TPC geometry. -Changes due to the new hit structure. - -Revision 1.19 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.18 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.17.2.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.17.2.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.17.2.2 2000/06/16 12:58:13 kowal2 -Changed parameter settings - -Revision 1.17.2.1 2000/06/09 07:15:07 kowal2 - -Defaults loaded automatically (hard-wired) -Optional parameters can be set via macro called in the constructor - -Revision 1.17 2000/05/15 10:00:30 kowal2 -Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova - -Revision 1.16 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.15.8.2 2000/04/10 08:29:48 kowal2 - -Different pad geometry for different sectors -Updated readouch chambers geometry - -Revision 1.15.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.15 1999/11/04 17:28:07 fca -Correct barrel part of HV Degrader - -Revision 1.14 1999/10/08 06:27:23 fca -Corrected bug in the HV degrader geometry, thanks to G.Tabary - -Revision 1.13 1999/10/04 13:39:54 fca -Correct array index problem - -Revision 1.12 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // /////////////////////////////////////////////////////////////////////////////// @@ -121,23 +29,23 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// -#include +#include + +#include #include +#include +#include #include -#include #include -#include "AliTPCv1.h" -#include "AliRun.h" -#include -#include -#include "TLorentzVector.h" +#include #include "AliConst.h" - +#include "AliRun.h" +#include "AliTPCDigitsArray.h" #include "AliTPCParam.h" #include "AliTPCParamSR.h" -#include "AliTPCDigitsArray.h" -#include +#include "AliTPCv1.h" +#include "TLorentzVector.h" ClassImp(AliTPCv1) diff --git a/TPC/AliTPCv2.cxx b/TPC/AliTPCv2.cxx index e0e5493b201..dfe6fef301c 100644 --- a/TPC/AliTPCv2.cxx +++ b/TPC/AliTPCv2.cxx @@ -13,139 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.47 2003/03/04 15:16:54 kowal2 -Geometry corrected for an overlap - -Revision 1.46 2003/02/11 16:54:07 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.45 2003/01/14 10:50:20 alibrary -Cleanup of STEER coding conventions - -Revision 1.44 2002/11/21 22:43:32 alibrary -Removing AliMC and AliMCProcess - -Revision 1.43 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.40.6.2 2002/07/24 10:09:01 alibrary -Updating VirtualMC - -Revision 1.42 2002/06/12 14:56:56 kowal2 -Added track length to the reference hits - -Revision 1.41 2002/05/27 14:33:15 hristov -The new class AliTrackReference used (M.Ivanov) - -Revision 1.40 2002/01/21 17:12:00 kowal2 -New track hits structure using root containers - -Revision 1.39 2001/05/16 14:57:25 alibrary -New files for folders and Stack - -Revision 1.38 2001/05/08 16:03:06 kowal2 -Geometry update according to the latest technical spec. - -Revision 1.37 2001/04/27 15:23:07 kowal2 -Correct materian in the central part of the inner containment vessel - -Revision 1.36 2001/04/26 06:15:12 kowal2 -Corrected bug in the inner containment vessel (cones) - -Revision 1.35 2001/04/24 11:17:33 kowal2 -New TPC geometry. - -Revision 1.34 2001/04/23 10:20:18 hristov -Constant casted to avoid ambiguity - -Revision 1.33 2001/04/20 08:16:47 kowal2 -Protection against too small betaGamma. Thanks to Ivana and Yves. - -Revision 1.32 2001/03/13 13:07:34 kowal2 -Corrected bug in the TPC mother volume geometry. -Thanks to A. Morsch - -Revision 1.31 2000/11/30 11:48:50 kowal2 -TLorentzVector.h adde to satisfy the latest changes by Federico - -Revision 1.30 2000/11/14 10:48:57 kowal2 -Correct material used for TSA4. Thanks to J. Barbosa. - -Revision 1.29 2000/11/06 17:24:10 kowal2 -Corrected bug in the outer containment vessel and -the outer field cage geometry. -Thanks to J. Barbosa. - -Revision 1.28 2000/11/02 16:55:24 kowal2 -Corrected bug in the inner containment vessel geometry. -Thanks to J. Belikov - -Revision 1.27 2000/11/02 07:24:11 kowal2 -Correction in the TPC geometry. -Changes due to the new hit structure. - -Revision 1.26 2000/10/05 16:16:29 kowal2 -Corrections of the hit recording algorithm. - -Revision 1.25 2000/10/02 21:28:18 fca -Removal of useless dependecies via forward declarations - -Revision 1.24 2000/08/28 10:02:30 kowal2 -Corrected bug in the StepManager - -Revision 1.23 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.22 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.21.2.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.21.2.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.21.2.2 2000/06/16 12:58:13 kowal2 -Changed parameter settings - -Revision 1.21.2.1 2000/06/09 07:15:07 kowal2 - -Defaults loaded automatically (hard-wired) -Optional parameters can be set via macro called in the constructor - -Revision 1.21 2000/05/15 10:00:30 kowal2 -Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova - -Revision 1.20 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.19.8.2 2000/04/10 08:31:52 kowal2 - -Different geometry for different sectors -Updated readout chambers -Some modifications to StepManager by J.Belikov - -Revision 1.19.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.19 1999/11/04 17:28:07 fca -Correct barrel part of HV Degrader - -Revision 1.18 1999/10/14 16:52:08 fca -Only use PDG codes and not GEANT ones - -Revision 1.17 1999/10/08 06:27:23 fca -Corrected bug in the HV degrader geometry, thanks to G.Tabary - -Revision 1.16 1999/10/04 13:39:54 fca -Correct array index problem - -Revision 1.15 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // /////////////////////////////////////////////////////////////////////////////// @@ -163,7 +31,9 @@ Introduction of the Copyright and cvs Log #include +#include #include +#include #include #include "AliConst.h" @@ -173,7 +43,6 @@ Introduction of the Copyright and cvs Log #include "AliTPCParamSR.h" #include "AliTPCTrackHitsV2.h" #include "AliTPCv2.h" -#include "TLorentzVector.h" ClassImp(AliTPCv2) @@ -238,14 +107,14 @@ void AliTPCv2::CreateGeometry() // --------------------------------------------------- // sector specification check - // --------------------------------------------------- + // --------------------------------------------------- if (fSecAL >= 0) { ifl1 = 0; for (i = 0; i < 6; ++i) { if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) { - ifl1 = 1; - printf("%s: *** SECTOR %d selected\n",ClassName(),fSecLows[i]); + ifl1 = 1; + printf("%s: *** SECTOR %d selected\n",ClassName(),fSecLows[i]); } } diff --git a/TPC/AliTPCv3.cxx b/TPC/AliTPCv3.cxx index e3bb774c87c..5ca11ce7a33 100644 --- a/TPC/AliTPCv3.cxx +++ b/TPC/AliTPCv3.cxx @@ -13,117 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.32 2003/01/14 10:50:20 alibrary -Cleanup of STEER coding conventions - -Revision 1.31 2002/11/21 22:43:33 alibrary -Removing AliMC and AliMCProcess - -Revision 1.30 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.29.6.2 2002/07/24 10:09:01 alibrary -Updating VirtualMC - -Revision 1.29 2002/01/21 17:12:00 kowal2 -New track hits structure using root containers - -Revision 1.28 2001/06/12 07:07:41 kowal2 -New files for folder and stack - -Revision 1.27 2001/05/08 16:03:06 kowal2 -Geometry update according to the latest technical spec. - -Revision 1.26 2001/04/27 15:23:07 kowal2 -Correct materian in the central part of the inner containment vessel - -Revision 1.25 2001/04/26 06:15:12 kowal2 -Corrected bug in the inner containment vessel (cones) - -Revision 1.24 2001/04/24 11:22:01 kowal2 -Protection against too small betagamma - -Revision 1.23 2001/04/24 11:17:33 kowal2 -New TPC geometry. - -Revision 1.22 2001/03/13 13:07:34 kowal2 -Corrected bug in the TPC mother volume geometry. -Thanks to A. Morsch - -Revision 1.21 2000/11/30 11:48:50 kowal2 -TLorentzVector.h adde to satisfy the latest changes by Federico - -Revision 1.20 2000/11/14 10:48:57 kowal2 -Correct material used for TSA4. Thanks to J. Barbosa. - -Revision 1.19 2000/11/06 17:24:10 kowal2 -Corrected bug in the outer containment vessel and -the outer field cage geometry. -Thanks to J. Barbosa. - -Revision 1.18 2000/11/02 16:55:24 kowal2 -Corrected bug in the inner containment vessel geometry. -Thanks to J. Belikov - -Revision 1.17 2000/11/02 07:24:11 kowal2 -Correction in the TPC geometry. -Changes due to the new hit structure. - -Revision 1.16 2000/10/02 21:28:18 fca -Removal of useless dependecies via forward declarations - -Revision 1.15 2000/07/10 20:57:39 hristov -Update of TPC code and macros by M.Kowalski - -Revision 1.14 2000/06/30 12:07:50 kowal2 -Updated from the TPC-PreRelease branch - -Revision 1.13.2.4 2000/06/26 07:39:42 kowal2 -Changes to obey the coding rules - -Revision 1.13.2.3 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -Revision 1.13.2.2 2000/06/16 12:58:13 kowal2 -Changed parameter settings - -Revision 1.13.2.1 2000/06/09 07:15:07 kowal2 - -Defaults loaded automatically (hard-wired) -Optional parameters can be set via macro called in the constructor - -Revision 1.13 2000/05/15 10:00:30 kowal2 -Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova - -Revision 1.12 2000/04/17 09:37:33 kowal2 -removed obsolete AliTPCDigitsDisplay.C - -Revision 1.11.8.2 2000/04/10 08:36:12 kowal2 - -Updated readout chambers -Some modifications to StepManager by M. Kowalski - -Revision 1.11.8.1 2000/04/10 07:56:53 kowal2 -Not used anymore - removed - -Revision 1.11 1999/11/04 17:28:07 fca -Correct barrel part of HV Degrader - -Revision 1.10 1999/10/14 16:52:08 fca -Only use PDG codes and not GEANT ones - -Revision 1.9 1999/10/08 06:27:23 fca -Corrected bug in the HV degrader geometry, thanks to G.Tabary - -Revision 1.8 1999/10/04 13:39:55 fca -Correct array index problem - -Revision 1.7 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ // /////////////////////////////////////////////////////////////////////////////// @@ -141,10 +31,11 @@ Introduction of the Copyright and cvs Log #include -#include -#include #include +#include #include +#include +#include #include "AliConst.h" #include "AliRun.h" diff --git a/TPC/TPCLinkDef.h b/TPC/TPCLinkDef.h index eb8f880e9b6..ea252a50b6d 100644 --- a/TPC/TPCLinkDef.h +++ b/TPC/TPCLinkDef.h @@ -44,6 +44,8 @@ #pragma link C++ class AliTPCDigitsArray+; +#pragma link C++ class AliTPCClusterFinder+; + #pragma link C++ class AliTPCTrackHits+; #pragma link C++ class AliTPCTrackHitsV2+; @@ -56,6 +58,8 @@ #pragma link C++ class AliTPCclusterer-; #pragma link C++ class AliTPCDigitizer; #pragma link C++ class AliTPCtrackerParam; + +#pragma link C++ class AliTPCLoader+; #pragma link C++ class AliTPCkineGrid; // points used in new cluster finder diff --git a/TPC/TestTPCTrackHits.cxx b/TPC/TestTPCTrackHits.cxx index 313048dddba..58184a46d37 100644 --- a/TPC/TestTPCTrackHits.cxx +++ b/TPC/TestTPCTrackHits.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2000/11/02 10:22:50 kowal2 -Logs added - -*/ +/* $Id$ */ /* Author : MI diff --git a/TPC/alles.h b/TPC/alles.h index 9ccf6b16e84..f5668561dd5 100644 --- a/TPC/alles.h +++ b/TPC/alles.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,10 @@ //ALIROOT headers #include "TParticle.h" #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" +#include "AliStack.h" +#include "AliHeader.h" //TPC headers #include "AliTPC.h" diff --git a/TPC/libTPC.pkg b/TPC/libTPC.pkg index af30b16e71e..29acc3a9619 100644 --- a/TPC/libTPC.pkg +++ b/TPC/libTPC.pkg @@ -1,11 +1,12 @@ -SRCS:= AliTPC.cxx AliTPCv0.cxx AliTPCv1.cxx AliTPCv2.cxx \ - AliTPCv3.cxx AliDetectorParam.cxx AliTPCParam.cxx \ - AliTPCParamSR.cxx AliTPCParamCR.cxx AliTPCPRF2D.cxx \ - AliTPCRF1D.cxx \ - AliSimDigits.cxx AliDigitsArray.cxx AliTPCDigitsArray.cxx \ - AliComplexCluster.cxx AliClusters.cxx AliClustersArray.cxx \ - AliTPCClustersRow.cxx \ - AliTPCClustersArray.cxx \ +SRCS:= AliTPCLoader.cxx\ + AliTPCClusterFinder.cxx AliTPC.cxx AliTPCv0.cxx AliTPCv1.cxx AliTPCv2.cxx \ + AliTPCv3.cxx AliDetectorParam.cxx AliTPCParam.cxx \ + AliTPCParamSR.cxx AliTPCParamCR.cxx AliTPCPRF2D.cxx \ + AliTPCRF1D.cxx \ + AliSimDigits.cxx AliDigitsArray.cxx AliTPCDigitsArray.cxx \ + AliComplexCluster.cxx AliClusters.cxx AliClustersArray.cxx \ + AliTPCClustersRow.cxx \ + AliTPCClustersArray.cxx \ AliTPCcluster.cxx AliTPCclusterer.cxx \ AliTPCtrack.cxx AliTPCtracker.cxx \ AliTPCTrackHits.cxx\ diff --git a/TPC/template.cxx b/TPC/template.cxx index cc3e70f5987..b46291c788c 100644 --- a/TPC/template.cxx +++ b/TPC/template.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1.2.2 2000/04/10 11:40:46 kowal2 - -Needed for tracking - -*/ +/* $Id$ */ static int PropagateTo(TVector &x, Double_t fX, Double_t xk) { if (TMath::Abs(x(2)*xk - x(3)) >= 0.999) { diff --git a/TPHIC/AliGenTPHIC.cxx b/TPHIC/AliGenTPHIC.cxx index 79c5b69734e..bc8574001fb 100644 --- a/TPHIC/AliGenTPHIC.cxx +++ b/TPHIC/AliGenTPHIC.cxx @@ -18,6 +18,12 @@ /* $Log$ +Revision 1.1.2.1 2003/05/20 17:27:07 hristov +Merging with v3-09-09 + +Revision 1.1 2003/05/09 09:18:11 hristov +Adding TPHIC + */ // Event generator of two-photon processes diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 3640db5f76c..f7b5e710f60 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -13,153 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.45 2003/02/11 16:54:07 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.44 2003/01/28 14:38:18 cblume -Add track length to track references - -Revision 1.43 2002/11/21 22:38:47 alibrary -Removing AliMC and AliMCProcess - -Revision 1.42 2002/10/22 15:53:08 alibrary -Introducing Riostream.h - -Revision 1.41 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.36.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.40 2002/06/13 08:11:56 cblume -Add the track references - -Revision 1.39 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.38 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.37 2002/03/25 20:01:49 cblume -Introduce parameter class - -Revision 1.36 2002/02/11 14:25:27 cblume -Geometry update, compressed hit structure - -Revision 1.35 2001/11/14 12:08:44 cblume -Remove unneccessary header files - -Revision 1.34 2001/11/14 10:50:45 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.33 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.32 2001/10/08 06:57:33 hristov -Branches for TRD digits are created only during the digitisation - -Revision 1.31 2001/08/30 09:30:30 hristov -The split level of branches is set to 99 - -Revision 1.30 2001/05/28 17:07:58 hristov -Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) - -Revision 1.29 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.28 2001/05/16 14:57:27 alibrary -New files for folders and Stack - -Revision 1.27 2001/05/08 07:05:02 hristov -Loop variable declared once (HP, Sun) - -Revision 1.26 2001/05/07 08:03:22 cblume -Generate also hits in the amplification region - -Revision 1.25 2001/03/13 09:30:35 cblume -Update of digitization. Moved digit branch definition to AliTRD - -Revision 1.24 2001/01/26 19:56:49 hristov -Major upgrade of AliRoot code - -Revision 1.23 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.17.2.6 2000/10/15 23:29:08 cblume -Introduced more detailed geometry for the display - -Revision 1.17.2.5 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.17.2.4 2000/10/04 16:34:57 cblume -Replace include files by forward declarations - -Revision 1.17.2.3 2000/09/22 14:45:17 cblume -Included changes for the tracking - -Revision 1.17.2.2 2000/09/18 13:25:13 cblume -Included LoadPoints() method to display the TR photons - -Revision 1.22 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.21 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.20 2000/06/08 18:32:57 cblume -Make code compliant to coding conventions - -Revision 1.19 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.18 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.21 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.20 2000/06/08 18:32:57 cblume -Make code compliant to coding conventions - -Revision 1.19 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.18 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.17.2.1 2000/05/08 14:28:59 cblume -Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray - -Revision 1.17 2000/02/28 19:10:26 cblume -Include the new TRD classes - -Revision 1.16.2.2 2000/02/28 17:53:24 cblume -Introduce TRD geometry classes - -Revision 1.16.2.1 2000/02/28 17:04:19 cblume -Include functions and data members for AliTRDrecPoint - -Revision 1.16 2000/01/19 17:17:35 fca -Introducing a list of lists of hits -- more hits allowed for detector now - -Revision 1.15 1999/11/02 17:04:25 fca -Small syntax change for HP compiler - -Revision 1.14 1999/11/02 16:57:02 fca -Avoid non ansi warnings on HP compilers - -Revision 1.13 1999/11/02 16:35:56 fca -New version of TRD introduced - -Revision 1.12 1999/11/01 20:41:51 fca -Added protections against using the wrong version of FRAME - -Revision 1.11 1999/09/29 09:24:34 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -172,35 +26,35 @@ Introduction of the Copyright and cvs Log #include #include +#include +#include +#include #include #include -#include -#include #include -#include -#include #include -#include - -#include "AliRun.h" +#include +#include +#include + #include "AliConst.h" #include "AliDigit.h" +#include "AliLoader.h" #include "AliMagF.h" - -#include "AliTrackReference.h" - +#include "AliRun.h" #include "AliTRD.h" -#include "AliTRDhit.h" -#include "AliTRDpoints.h" +#include "AliTRDcluster.h" +#include "AliTRDclusterizer.h" #include "AliTRDdigit.h" #include "AliTRDdigitizer.h" -#include "AliTRDclusterizer.h" -#include "AliTRDgeometryHole.h" +#include "AliTRDdigitsManager.h" #include "AliTRDgeometryFull.h" +#include "AliTRDgeometryHole.h" +#include "AliTRDhit.h" +#include "AliTRDpoints.h" #include "AliTRDrecPoint.h" -#include "AliTRDcluster.h" -#include "AliTRDdigitsManager.h" #include "AliTRDtrackHits.h" +#include "AliTrackReference.h" ClassImp(AliTRD) @@ -375,12 +229,14 @@ void AliTRD::Hits2Digits() // // Create digits // - + if (!fLoader->TreeH()) fLoader->LoadHits("read"); + SetTreeAddress(); + AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" ,"TRD digitizer class"); digitizer->SetDebug(GetDebug()); digitizer->SetEvent(gAlice->GetEvNumber()); - + // Initialization digitizer->InitDetector(); @@ -388,7 +244,9 @@ void AliTRD::Hits2Digits() digitizer->MakeDigits(); // Write the digits into the input file - if (digitizer->MakeBranch(fDigitsFile)) { + + if (!fLoader->TreeD()) fLoader->MakeTree("D"); + if (digitizer->MakeBranch(fLoader->TreeD())) { digitizer->WriteDigits(); @@ -405,6 +263,8 @@ void AliTRD::Hits2SDigits() // // Create summable digits // + if (!fLoader->TreeH()) fLoader->LoadHits("read"); + SetTreeAddress(); AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" ,"TRD digitizer class"); @@ -421,7 +281,9 @@ void AliTRD::Hits2SDigits() digitizer->MakeDigits(); // Write the digits into the input file - if (digitizer->MakeBranch(fDigitsFile)) { + if (!fLoader->TreeS()) fLoader->MakeTree("S"); + + if (digitizer->MakeBranch(fLoader->TreeS())) { digitizer->WriteDigits(); @@ -452,13 +314,20 @@ void AliTRD::SDigits2Digits() // Read the s-digits via digits manager AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager(); + sdigitsManager->SetDebug(GetDebug()); sdigitsManager->SetSDigits(kTRUE); - if (fDigitsFile) { - sdigitsManager->Open(fDigitsFile); - } sdigitsManager->CreateArrays(); - sdigitsManager->ReadDigits(); + + if (!fLoader->TreeS()) + if (fLoader->LoadSDigits("read")) + { + Error("SDigits2Digits","Error while reading SDigits for event %d",gAlice->GetEvNumber()); + return; + } + if (!fLoader->TreeS()) return; + + sdigitsManager->ReadDigits(fLoader->TreeS()); // Add the s-digits to the input list digitizer->AddSDigitsManager(sdigitsManager); @@ -467,10 +336,9 @@ void AliTRD::SDigits2Digits() digitizer->SDigits2Digits(); // Store the digits - if (digitizer->MakeBranch(fDigitsFile)) { - + if (!fLoader->TreeD()) fLoader->MakeTree("D"); + if (digitizer->MakeBranch(fLoader->TreeD())){ digitizer->WriteDigits(); - } } @@ -1093,7 +961,7 @@ void AliTRD::LoadPoints(Int_t track) } //_____________________________________________________________________________ -void AliTRD::MakeBranch(Option_t* option, const char *file) +void AliTRD::MakeBranch(Option_t* option) { // // Create Tree branches for the TRD digits. @@ -1105,14 +973,14 @@ void AliTRD::MakeBranch(Option_t* option, const char *file) const char *cD = strstr(option,"D"); - AliDetector::MakeBranch(option,file); + AliDetector::MakeBranch(option); if (fDigits && gAlice->TreeD() && cD) { - MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file); + MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0); } if (fHitType > 1) { - MakeBranch2(option,file); + MakeBranch2(option,0); } } @@ -1153,13 +1021,15 @@ void AliTRD::SetTreeAddress() Char_t branchname[15]; + if ( fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliTRDhit",405); AliDetector::SetTreeAddress(); TBranch *branch; - TTree *treeR = gAlice->TreeR(); + TTree *treeR = fLoader->TreeR(); if (treeR) { sprintf(branchname,"%scluster",GetName()); + if (fRecPoints == 0x0) fRecPoints = new TObjArray(400); if (fRecPoints) { branch = treeR->GetBranch(branchname); if (branch) { @@ -1317,7 +1187,7 @@ AliHit* AliTRD::FirstHit2(Int_t track) if (track >= 0) { gAlice->ResetHits(); - gAlice->TreeH()->GetEvent(track); + TreeH()->GetEvent(track); } if (fTrackHits) { @@ -1367,45 +1237,14 @@ void AliTRD::MakeBranch2(Option_t *option, const char *file) if (!fTrackHits) { fTrackHits = new AliTRDtrackHits(); - } - - if (fTrackHits && gAlice->TreeH() && cH) { - - gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits" - ,&fTrackHits - ,fBufferSize,99); - - if (GetDebug() > 1) { - printf(" Making Branch %s for trackhits\n" - ,branchname); - } - - const char kFolder[] = "RunMC/Event/Data"; - - if (GetDebug()) { - printf(" %15s: Publishing %s to %s\n" - ,ClassName(),branchname,kFolder); - } + } - Publish(kFolder,&fTrackHits,branchname); - - if (file) { - TBranch *b = gAlice->TreeH()->GetBranch(branchname); - TDirectory *wd = gDirectory; - b->SetFile(file); - TIter next(b->GetListOfBranches()); - while ((b = (TBranch*) next())) { - b->SetFile(file); - } - wd->cd(); - if (GetDebug() > 1) { - printf(" Diverting branch %s to file %s\n" - ,branchname,file); - } - } - - } + if (fTrackHits && TreeH() && cH) + { + TreeH()->Branch(branchname,"AliTRDtrackHits",&fTrackHits,fBufferSize,99); + Info("MakeBranch2","Making Branch %s for trackhits",branchname); + } } //_____________________________________________________________________________ @@ -1414,20 +1253,27 @@ void AliTRD::SetTreeAddress2() // // Set the branch address for the trackHits tree // + cout<<"AliTRD::SetTreeAddress2()"<TreeH(); + TTree *treeH = TreeH(); if ((treeH) && (fHitType > 0)) { branch = treeH->GetBranch(branchname); - if (branch) { - branch->SetAddress(&fTrackHits); - } + if (branch) + { + branch->SetAddress(&fTrackHits); + cout<<"Success"< #include "AliDetector.h" #include @@ -48,7 +49,7 @@ class AliTRD : public AliDetector { TObjArray *RecPoints() const { return fRecPoints; }; virtual void Init(); virtual Int_t IsVersion() const = 0; - virtual void MakeBranch(Option_t* option, const char *file=0); + virtual void MakeBranch(Option_t* option); virtual void ResetDigits(); virtual void ResetRecPoints(); virtual void StepManager() = 0; @@ -116,7 +117,7 @@ class AliTRD : public AliDetector { AliTRDtrackHits *fTrackHits; //! Compressed hits for a given track Int_t fHitType; // Switch for the different hit data structures - ClassDef(AliTRD,5) // Transition Radiation Detector base class + ClassDef(AliTRD,6) // Transition Radiation Detector base class }; diff --git a/TRD/AliTRDanaDigits.C b/TRD/AliTRDanaDigits.C index 81c055cd059..266d6cb946a 100644 --- a/TRD/AliTRDanaDigits.C +++ b/TRD/AliTRDanaDigits.C @@ -28,26 +28,12 @@ void AliTRDanaDigits() Int_t track; - // Connect the AliRoot file containing Geometry, Kine, Hits, and digits - TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile); - if (!gafl) { - cout << "Open the ALIROOT-file " << alifile << endl; - gafl = new TFile(alifile); - } - else { - cout << alifile << " is already open" << endl; - } - - // Get AliRun object from file or create it if not on file - gAlice = (AliRun*) gafl->Get("gAlice"); - if (gAlice) - cout << "AliRun object found on file" << endl; - else - gAlice = new AliRun("gAlice","Alice test program"); - - // Import the Trees for the event nEvent in the file - Int_t nparticles = gAlice->GetEvent(nEvent); - if (nparticles <= 0) break; + AliRunLoader* rl = AliRunLoader::Open(alifile); + AliLoader* loader = rl->GetLoader("TRDLoader"); + rl->LoadDigits(); + + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); // Get the pointer to the detector object trd = (AliTRDv1*) gAlice->GetDetector("TRD"); @@ -69,8 +55,8 @@ void AliTRDanaDigits() digitsManager->SetDebug(1); // Read the digits from the file - digitsManager->Open(alifile); - digitsManager->ReadDigits(); + + digitsManager->ReadDigits(loader->TreeD()); // Get the detector number Int_t iDet = 514; @@ -109,5 +95,5 @@ void AliTRDanaDigits() matrix->ProjRow(); matrix->ProjCol(); matrix->ProjTime(); - + delete rl; } diff --git a/TRD/AliTRDarrayF.cxx b/TRD/AliTRDarrayF.cxx index 9f1ebf08baf..881a4bae8d2 100644 --- a/TRD/AliTRDarrayF.cxx +++ b/TRD/AliTRDarrayF.cxx @@ -13,21 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 14:35:38 cblume -Add float array - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDarrayI.cxx b/TRD/AliTRDarrayI.cxx index 69d56c2cd6c..aed8018db16 100644 --- a/TRD/AliTRDarrayI.cxx +++ b/TRD/AliTRDarrayI.cxx @@ -13,46 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2000/11/01 14:53:20 cblume -Merge with TRD-develop - - -Revision 1.1.4.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:35:54 cblume -Update - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:35:54 cblume -Update - -Revision 1.1 2000/02/28 18:57:18 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDcluster.cxx b/TRD/AliTRDcluster.cxx index 252c0b7ed66..bc8b8c72a91 100644 --- a/TRD/AliTRDcluster.cxx +++ b/TRD/AliTRDcluster.cxx @@ -13,35 +13,20 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4.10.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC +/* $Id$ */ -Revision 1.6 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.4 2001/05/07 08:08:05 cblume -Update of TRD code - -Revision 1.3 2000/12/08 16:07:02 cblume -Update of the tracking by Sergei - -Revision 1.2 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.1 2000/09/22 14:47:52 cblume -Add the tracking code - -*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD cluster // +// // +/////////////////////////////////////////////////////////////////////////////// #include "AliTRDcluster.h" -#include "AliTRDgeometry.h" #include "AliTRDrecPoint.h" ClassImp(AliTRDcluster) - //_____________________________________________________________________________ AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster() { @@ -102,26 +87,27 @@ void AliTRDcluster::AddTrackIndex(Int_t *track) // ones are stored first; // - const Int_t size = 9; + const Int_t kSize = 9; - Int_t entries[size][2], i, j, index; + Int_t entries[kSize][2], i, j, index; - Bool_t index_added; + Bool_t indexAdded; - for (i=0; i= 0) { - while ( (!index_added) && ( j < size ) ) { + while ( (!indexAdded) && ( j < kSize ) ) { if ((entries[j][0]==index) || (entries[j][1]==0)) { entries[j][0]=index; entries[j][1]=entries[j][1]+1; - index_added=kTRUE; + indexAdded=kTRUE; } j++; } @@ -132,7 +118,7 @@ void AliTRDcluster::AddTrackIndex(Int_t *track) Int_t swap=1, tmp0, tmp1; while ( swap > 0) { swap=0; - for(i=0; i<(size-1); i++) { + for(i=0; i<(kSize-1); i++) { if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { if ((entries[i][1] < entries[i+1][1]) || ((entries[i][1] == entries[i+1][1]) && diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index 02b1d8bb4a1..e3f018a2859 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -13,94 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2003/03/19 17:16:23 hristov -Fixes for the file managment(T.Kuhr) - -Revision 1.17 2003/02/10 11:09:26 cblume -Further modifications in OpenOutput and WriteCluster - -Revision 1.16 2003/02/07 09:45:24 cblume -Modification in OpenOutput() for many events in single file - -Revision 1.15 2002/11/07 15:52:09 cblume -Update of tracking code for tilted pads - -Revision 1.14 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.11.6.2 2002/10/11 07:26:37 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.13 2002/09/18 09:20:53 cblume -Write the parameter class into the cluster file - -Revision 1.12 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.11 2001/11/27 08:50:33 hristov -BranchOld replaced by Branch - -Revision 1.10 2001/11/14 10:50:45 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.9 2001/10/21 18:30:02 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.8 2001/05/07 08:06:44 cblume -Speedup of the code. Create only AliTRDcluster - -Revision 1.7 2001/03/30 14:40:14 cblume -Update of the digitization parameter - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - - -Revision 1.1.4.5 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.4.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.2 2000/09/22 14:49:49 cblume -Adapted to tracking code - -Revision 1.5 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:08:03 cblume -Remove the class AliTRDcluster - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:08:03 cblume -Remove the class AliTRDcluster - -Revision 1.1 2000/02/28 18:57:58 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -113,6 +26,9 @@ Add new TRD classes #include #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" + #include "AliTRD.h" #include "AliTRDclusterizer.h" #include "AliTRDcluster.h" @@ -129,10 +45,6 @@ AliTRDclusterizer::AliTRDclusterizer():TNamed() // AliTRDclusterizer default constructor // - fInputFile = NULL; - fInputFileCreated = kFALSE; - fOutputFile = NULL; - fOutputFileCreated = kFALSE; fClusterTree = NULL; fTRD = 0; fEvent = 0; @@ -149,8 +61,6 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title) // AliTRDclusterizer default constructor // - fInputFile = NULL; - fOutputFile = NULL; fClusterTree = NULL; fEvent = 0; fVerbose = 0; @@ -176,16 +86,6 @@ AliTRDclusterizer::~AliTRDclusterizer() // AliTRDclusterizer destructor // - if (fInputFile && fInputFileCreated) { - fInputFile->Close(); - delete fInputFile; - } - - if (fOutputFile && fOutputFileCreated) { - fOutputFile->Close(); - delete fOutputFile; - } - } //_____________________________________________________________________________ @@ -207,8 +107,6 @@ void AliTRDclusterizer::Copy(TObject &c) // Copy function // - ((AliTRDclusterizer &) c).fInputFile = NULL; - ((AliTRDclusterizer &) c).fOutputFile = NULL; ((AliTRDclusterizer &) c).fClusterTree = NULL; ((AliTRDclusterizer &) c).fEvent = 0; ((AliTRDclusterizer &) c).fVerbose = fVerbose; @@ -222,120 +120,64 @@ Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent) // // Opens the AliROOT file. Output and input are in the same file // - - OpenInput(name,nEvent); - OpenOutput(name); - + fRunLoader = AliRunLoader::Open(name); + if (!fRunLoader) + { + Error("Open","Can not open session for file %s.",name); + return kFALSE; + } + + OpenInput(nEvent); + OpenOutput(); return kTRUE; - } -//_____________________________________________________________________________ -Bool_t AliTRDclusterizer::Open(const Char_t *inname, const Char_t *outname - , Int_t nEvent) -{ - // - // Opens the AliROOT file. Output and input are in different files - // - - OpenInput(inname,nEvent); - OpenOutput(outname); - - return kTRUE; - -} //_____________________________________________________________________________ -Bool_t AliTRDclusterizer::OpenOutput(const Char_t *name) +Bool_t AliTRDclusterizer::OpenOutput() { // // Open the output file // - TDirectory *savedir = NULL; - - if (!fInputFile) { - printf(" "); - printf("No input file defined\n"); - return kFALSE; - } - - if (strcmp(name,fInputFile->GetName()) != 0) { - savedir = gDirectory; - TFile *file = (TFile *) gROOT->FindObject(name); - if (file) { - printf(" "); - printf("Use same file for output: %s.\n",name); - fOutputFile = file; - fOutputFile->cd(); - } - else { - printf(" "); - printf("Open the output file %s.\n",name); - fOutputFile = new TFile(name,"RECREATE"); - fOutputFileCreated = kTRUE; - } - } - else { - fOutputFile = fInputFile; - } - - // Create a tree for the cluster - Char_t treeName[12]; sprintf(treeName,"TreeR%d_TRD",fEvent); - fClusterTree = new TTree(treeName,"TRD cluster"); TObjArray *ioArray = 0; + + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + loader->MakeTree("R"); + fClusterTree = loader->TreeR(); fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0); - if (savedir) { - savedir->cd(); - } return kTRUE; } //_____________________________________________________________________________ -Bool_t AliTRDclusterizer::OpenInput(const Char_t *name, Int_t nEvent) +Bool_t AliTRDclusterizer::OpenInput(Int_t nEvent) { // // Opens a ROOT-file with TRD-hits and reads in the digits-tree // // Connect the AliRoot file containing Geometry, Kine, and Hits - fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name); - if (!fInputFile) { - printf("AliTRDclusterizer::OpenInput -- "); - printf("Open the ALIROOT-file %s.\n",name); - fInputFile = new TFile(name,"UPDATE"); - fInputFileCreated = kTRUE; - } - else { - printf("AliTRDclusterizer::OpenInput -- "); - printf("%s is already open.\n",name); - } + fRunLoader->LoadgAlice(); + gAlice = fRunLoader->GetAliRun(); - // Get AliRun object from file - if (gAlice) { - delete gAlice; - gAlice = 0; - } - if (!(gAlice)) gAlice = (AliRun *) fInputFile->Get("gAlice"); if (!(gAlice)) { - printf("AliTRDclusterizer::OpenInput -- "); - printf("Could not find AliRun object.\n"); - return kFALSE; + fRunLoader->LoadgAlice(); + gAlice = fRunLoader->GetAliRun(); + if (!(gAlice)) { + printf("AliTRDclusterizer::OpenInput -- "); + printf("Could not find AliRun object.\n"); + return kFALSE; + } } fEvent = nEvent; // Import the Trees for the event nEvent in the file - Int_t nparticles = gAlice->GetEvent(fEvent); - if (nparticles <= 0) { - printf("AliTRDclusterizer::OpenInput -- "); - printf("No entries in the trees for event %d.\n",fEvent); - return kFALSE; - } - + fRunLoader->GetEvent(fEvent); + // Get the TRD object fTRD = (AliTRD*) gAlice->GetDetector("TRD"); if (!fTRD) { @@ -362,11 +204,6 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) return kFALSE; } - TDirectory *savedir = gDirectory; - - if (fOutputFile) { - fOutputFile->cd(); - } TBranch *branch = fClusterTree->GetBranch("TRDcluster"); if (!branch) { @@ -406,25 +243,22 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) fClusterTree->Write(); AliTRDgeometry *geo = fTRD->GetGeometry(); - if (!fOutputFile->Get("TRDgeometry")) { - geo->SetName("TRDgeometry"); - geo->Write(); - } - if (!fOutputFile->Get("TRDparameter")) { - fPar->Write(); - } - + geo->SetName("TRDgeometry"); + geo->Write(); + fPar->Write(); + return kTRUE; } - savedir->cd(); - + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + loader->WriteDigits("OVERWRITE"); + printf("AliTRDclusterizer::WriteClusters -- "); printf("Unexpected detector index %d.\n",det); return kFALSE; - + } diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index ecf98f90f01..cdcf2f29dbe 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -8,7 +8,7 @@ #include class TFile; - +class AliRunLoader; class AliTRDparameter; /////////////////////////////////////////////////////// @@ -25,26 +25,22 @@ class AliTRDclusterizer : public TNamed { virtual ~AliTRDclusterizer(); AliTRDclusterizer &operator=(const AliTRDclusterizer &c); - virtual void Copy(TObject &c); - virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); - virtual Bool_t Open(const Char_t *inname, const Char_t *outname, Int_t nEvent = 0); - virtual Bool_t OpenInput(const Char_t *name, Int_t nEvent = 0); - virtual Bool_t OpenOutput(const Char_t *name); - virtual Bool_t MakeClusters() = 0; - virtual Bool_t WriteClusters(Int_t det); - - void SetVerbose(Int_t v = 1) { fVerbose = v; }; - + virtual void Copy(TObject &c); + virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); + + virtual Bool_t OpenInput(Int_t nEvent = 0); + virtual Bool_t OpenOutput(); + virtual Bool_t MakeClusters() = 0; + virtual Bool_t WriteClusters(Int_t det); virtual void SetParameter(AliTRDparameter *par) { fPar = par; }; + void SetVerbose(Int_t v = 1) { fVerbose = v; }; AliTRDparameter *GetParameter() const { return fPar; }; protected: - TFile *fInputFile; //! AliROOT input file - Bool_t fInputFileCreated; //! flag set if input file was created - TFile *fOutputFile; //! AliROOT output file - Bool_t fOutputFileCreated; //! flag set if output file was created + AliRunLoader * fRunLoader; //! Run Loader + TTree *fClusterTree; //! Tree with the cluster AliTRD *fTRD; //! The TRD object AliTRDparameter *fPar; // TRD digitization parameter object diff --git a/TRD/AliTRDclusterizerV0.cxx b/TRD/AliTRDclusterizerV0.cxx index d26376dd8da..b836ca1feb6 100644 --- a/TRD/AliTRDclusterizerV0.cxx +++ b/TRD/AliTRDclusterizerV0.cxx @@ -13,75 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10.6.1 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.11 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.10 2001/12/05 15:04:34 hristov -Changes related to the corrections of AliRecPoint - -Revision 1.9 2001/05/28 17:07:58 hristov -Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) - -Revision 1.8 2001/05/07 08:06:44 cblume -Speedup of the code. Create only AliTRDcluster - -Revision 1.7 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.4.6 2000/10/16 01:16:53 cblume -Changed timebin 0 to be the one closest to the readout - -Revision 1.1.4.5 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.4.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.2 2000/09/22 14:49:49 cblume -Adapted to tracking code - -Revision 1.5 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:08:41 cblume -Replace AliTRDcluster by AliTRDrecPoint - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:08:41 cblume -Replace AliTRDcluster by AliTRDrecPoint - -Revision 1.1 2000/02/28 18:58:33 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -188,7 +120,7 @@ Bool_t AliTRDclusterizerV0::MakeClusters() AliTRDhit *hit; // Get the pointer to the hit tree - TTree *hitTree = gAlice->TreeH(); + TTree *hitTree = fTRD->TreeH(); // Get the pointer to the reconstruction tree TTree *clusterTree = gAlice->TreeR(); diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index 0dda7b96688..ed1ab356034 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -13,78 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.18 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.17 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.16 2002/03/25 20:01:30 cblume -Introduce parameter class - -Revision 1.15 2001/11/14 12:09:11 cblume -Use correct name for digitizer - -Revision 1.14 2001/11/14 10:50:45 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.13 2001/05/28 17:07:58 hristov -Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) - -Revision 1.12 2001/05/21 17:42:58 hristov -Constant casted to avoid the ambiguity - -Revision 1.11 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.10 2001/05/07 08:06:44 cblume -Speedup of the code. Create only AliTRDcluster - -Revision 1.9 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.4.5 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.4.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.2 2000/09/22 14:49:49 cblume -Adapted to tracking code - -Revision 1.8 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.7 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.6 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.5 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.4 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.3 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:09:01 cblume -Introduce AliTRDdigitsManager - -Revision 1.1 2000/02/28 18:58:54 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -98,6 +27,8 @@ Add new TRD classes #include #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliTRD.h" #include "AliTRDclusterizerV1.h" @@ -192,17 +123,16 @@ Bool_t AliTRDclusterizerV1::ReadDigits() // Reads the digits arrays from the input aliroot file // - if (!fInputFile) { + if (!fRunLoader) { printf(" "); printf("No input file open\n"); return kFALSE; } - - fDigitsManager->Open(fInputFile->GetName()); - fDigitsManager->SetEvent(fEvent); + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + if (!loader->TreeD()) loader->LoadDigits(); // Read in the digit arrays - return (fDigitsManager->ReadDigits()); + return (fDigitsManager->ReadDigits(loader->TreeD())); } diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h index da30c6ea06e..f4f5cca9a9b 100644 --- a/TRD/AliTRDclusterizerV1.h +++ b/TRD/AliTRDclusterizerV1.h @@ -12,6 +12,7 @@ /////////////////////////////////////////////////////// class AliTRDdigitsManager; +class AliTRDparameter; class AliTRDclusterizerV1 : public AliTRDclusterizer { @@ -36,7 +37,6 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer { virtual Float_t Unfold(Float_t eps, Int_t plane, Float_t *padSignal); ClassDef(AliTRDclusterizerV1,5) // TRD-Cluster finder, slow simulator - }; #endif diff --git a/TRD/AliTRDdataArray.cxx b/TRD/AliTRDdataArray.cxx index 89f6f95eda2..23a04b36e77 100644 --- a/TRD/AliTRDdataArray.cxx +++ b/TRD/AliTRDdataArray.cxx @@ -13,39 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.4.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.6 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.5 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.4 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.3 2000/05/18 07:56:44 cblume -Added #include - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 15:13:59 cblume -Introduce boundary checking - -Revision 1.1 2000/02/28 18:59:19 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDdataArrayF.cxx b/TRD/AliTRDdataArrayF.cxx index 26030303b5c..77ae5683d3e 100644 --- a/TRD/AliTRDdataArrayF.cxx +++ b/TRD/AliTRDdataArrayF.cxx @@ -13,51 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.11 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.10 2002/02/11 14:27:54 cblume -Geometry and hit structure update - -Revision 1.9 2001/05/07 08:08:05 cblume -Update of TRD code - -Revision 1.8 2000/11/23 14:34:08 cblume -Fixed bug in expansion routine of arrays (initialize buffers properly) - -Revision 1.7 2000/11/20 08:56:07 cblume -Cleanup of data arrays - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 15:14:34 cblume -Add new data array classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDdataArrayI.cxx b/TRD/AliTRDdataArrayI.cxx index c8a4c76234e..62d216cb178 100644 --- a/TRD/AliTRDdataArrayI.cxx +++ b/TRD/AliTRDdataArrayI.cxx @@ -13,57 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.10.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.11 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.11 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.10 2002/02/11 14:27:54 cblume -Geometry and hit structure update - -Revision 1.9 2001/05/07 08:08:05 cblume -Update of TRD code - -Revision 1.8 2000/11/23 14:34:08 cblume -Fixed bug in expansion routine of arrays (initialize buffers properly) - -Revision 1.7 2000/11/20 08:56:07 cblume -Cleanup of data arrays - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 15:14:34 cblume -Add new data array classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDdigit.cxx b/TRD/AliTRDdigit.cxx index e051686251c..4922aa7c8c8 100644 --- a/TRD/AliTRDdigit.cxx +++ b/TRD/AliTRDdigit.cxx @@ -15,33 +15,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.2.4 2000/10/17 02:27:34 cblume -Get rid of global constants - -Revision 1.1.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/09/22 14:42:05 cblume -Changed data members to UShort_t - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 14:40:29 cblume -Introduce raw digit bit flag and DecodeAmp() - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index efff3f3f3fb..f9abbb7a0ea 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -13,159 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.42 2002/12/13 13:31:44 cblume -Add ADC offset and change default digitazation parameters - -Revision 1.41 2002/10/21 09:10:32 cblume -Fix type conversion warnings - -Revision 1.40 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.33.6.3 2002/10/11 07:26:37 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.39 2002/10/08 20:46:12 cblume -Do coupling factors before noise is applied - -Revision 1.38 2002/04/30 08:30:40 cblume -gAlice now only read by AliRunDigitizer. Therefore it is just deleted in AliTRDmerge.C - -Revision 1.37 2002/04/29 11:50:47 cblume -Change initialization of gAlice in the merging case - -Revision 1.36 2002/04/12 12:13:23 cblume -Add Jiris changes - -Revision 1.35 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.34 2002/03/25 20:00:44 cblume -Introduce parameter class and regions of interest for merging - -Revision 1.33 2002/02/12 17:32:03 cblume -Rearrange the deleting of the list of sdigitsmanager - -Revision 1.32 2002/02/12 16:07:21 cblume -Add new constructor - -Revision 1.31 2002/02/11 14:27:11 cblume -New pad plane design, new TRF+PRF, tail cancelation, cross talk - -Revision 1.30 2001/11/19 08:44:08 cblume -Fix bugs reported by Rene - -Revision 1.29 2001/11/14 19:44:25 hristov -Numeric const casted (Alpha) - -Revision 1.28 2001/11/14 16:35:58 cblume -Inherits now from AliDetector - -Revision 1.27 2001/11/14 10:50:45 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.26 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.25 2001/06/27 09:54:44 cblume -Moved fField initialization to InitDetector() - -Revision 1.24 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.23 2001/05/07 08:04:48 cblume -New TRF and PRF. Speedup of the code. Digits from amplification region included - -Revision 1.22 2001/03/30 14:40:14 cblume -Update of the digitization parameter - -Revision 1.21 2001/03/13 09:30:35 cblume -Update of digitization. Moved digit branch definition to AliTRD - -Revision 1.20 2001/02/25 20:19:00 hristov -Minor correction: loop variable declared only once for HP, Sun - -Revision 1.19 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.18 2001/01/26 19:56:57 hristov -Major upgrade of AliRoot code - -Revision 1.17 2000/12/08 12:53:27 cblume -Change in Copy() function for HP-compiler - -Revision 1.16 2000/12/07 12:20:46 cblume -Go back to array compression. Use sampled PRF to speed up digitization - -Revision 1.15 2000/11/23 14:34:08 cblume -Fixed bug in expansion routine of arrays (initialize buffers properly) - -Revision 1.14 2000/11/20 08:54:44 cblume -Switch off compression as default - -Revision 1.13 2000/11/10 14:57:52 cblume -Changes in the geometry constants for the DEC compiler - -Revision 1.12 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.4.9 2000/10/26 17:00:22 cblume -Fixed bug in CheckDetector() - -Revision 1.1.4.8 2000/10/23 13:41:35 cblume -Added protection against Log(0) in the gas gain calulation - -Revision 1.1.4.7 2000/10/17 02:27:34 cblume -Get rid of global constants - -Revision 1.1.4.6 2000/10/16 01:16:53 cblume -Changed timebin 0 to be the one closest to the readout - -Revision 1.1.4.5 2000/10/15 23:34:29 cblume -Faster version of the digitizer - -Revision 1.1.4.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.2 2000/09/22 14:41:10 cblume -Bug fix in PRF. Included time response. New structure - -Revision 1.10 2000/10/05 07:27:53 cblume -Changes in the header-files by FCA - -Revision 1.9 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.8 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.7 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.6 2000/06/07 16:27:32 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.5 2000/05/09 16:38:57 cblume -Removed PadResponse(). Merge problem - -Revision 1.4 2000/05/08 15:53:45 cblume -Resolved merge conflict - -Revision 1.3 2000/04/28 14:49:27 cblume -Only one declaration of iDict in MakeDigits() - -Revision 1.1.4.1 2000/05/08 14:42:04 cblume -Introduced AliTRDdigitsManager - -Revision 1.1 2000/02/28 19:00:13 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -206,8 +54,13 @@ Add new TRD classes #include #include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" +#include "AliConfig.h" #include "AliMagF.h" #include "AliRunDigitizer.h" +#include "AliRunLoader.h" +#include "AliLoader.h" #include "AliTRD.h" #include "AliTRDhit.h" @@ -228,7 +81,6 @@ AliTRDdigitizer::AliTRDdigitizer() // AliTRDdigitizer default constructor // - fInputFile = 0; fDigitsManager = 0; fSDigitsManagerList = 0; fSDigitsManager = 0; @@ -255,13 +107,20 @@ AliTRDdigitizer::AliTRDdigitizer(const Text_t *name, const Text_t *title) // AliTRDdigitizer constructor // - fInputFile = 0; + fDigitsManager = NULL; + fSDigitsManager = NULL; + fSDigitsManagerList = NULL; + fTRD = NULL; + fGeo = NULL; + + //NewIO: These data members probably are not needed anymore fDigitsManager = 0; fSDigitsManagerList = 0; fSDigitsManager = 0; fTRD = 0; fGeo = 0; fPar = 0; + //End NewIO comment fMasks = 0; fEvent = 0; fCompress = kTRUE; @@ -285,7 +144,6 @@ AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager // AliTRDdigitizer constructor // - fInputFile = 0; fDigitsManager = 0; fSDigitsManagerList = 0; fSDigitsManager = 0; @@ -314,13 +172,15 @@ AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager) // AliTRDdigitizer constructor // - fInputFile = 0; + + fDigitsManager = 0; fSDigitsManagerList = 0; fSDigitsManager = 0; fTRD = 0; fGeo = 0; fPar = 0; + fMasks = 0; fEvent = 0; fCompress = kTRUE; @@ -353,11 +213,6 @@ AliTRDdigitizer::~AliTRDdigitizer() // AliTRDdigitizer destructor // - if (fInputFile) { - fInputFile->Close(); - delete fInputFile; - fInputFile = 0; - } if (fDigitsManager) { delete fDigitsManager; @@ -400,7 +255,6 @@ void AliTRDdigitizer::Copy(TObject &d) // Copy function // - ((AliTRDdigitizer &) d).fInputFile = 0; ((AliTRDdigitizer &) d).fSDigitsManagerList = 0; ((AliTRDdigitizer &) d).fSDigitsManager = 0; ((AliTRDdigitizer &) d).fDigitsManager = 0; @@ -441,16 +295,25 @@ void AliTRDdigitizer::Exec(Option_t* option) } // The AliRoot file is already connected by the manager - if (gAlice) { + AliRunLoader* inrl; + + if (gAlice) + { if (fDebug > 0) { printf(" "); printf("AliRun object found on file.\n"); } - } + } else { - printf(" "); - printf("Could not find AliRun object.\n"); - return; + inrl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); + inrl->LoadgAlice(); + gAlice = inrl->GetAliRun(); + if (!gAlice) + { + printf(" "); + printf("Could not find AliRun object.\n"); + return; + } } Int_t nInput = fManager->GetNinputs(); @@ -470,7 +333,21 @@ void AliTRDdigitizer::Exec(Option_t* option) } // check if the input tree exists - if (!fManager->GetInputTreeTRDS(iInput)) { + inrl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput)); + AliLoader* gime = inrl->GetLoader("TRDLoader"); + + TTree * treees = gime->TreeS(); + if (treees == 0x0) + { + if (gime->LoadSDigits()) + { + Error("Exec","Error Occured while loading S. Digits for input %d.",iInput); + return; + } + treees = gime->TreeS(); + } + + if (treees == 0x0) { printf(" "); printf("Input stream %d does not exist\n",iInput); return; @@ -480,7 +357,11 @@ void AliTRDdigitizer::Exec(Option_t* option) sdigitsManager = new AliTRDdigitsManager(); sdigitsManager->SetDebug(fDebug); sdigitsManager->SetSDigits(kTRUE); - sdigitsManager->ReadDigits(fManager->GetInputTreeTRDS(iInput)); + + AliRunLoader* rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput)); + AliLoader* gimme = rl->GetLoader("TRDLoader"); + if (!gimme->TreeS()) gimme->LoadSDigits(); + sdigitsManager->ReadDigits(gimme->TreeS()); // Add the s-digits to the input list AddSDigitsManager(sdigitsManager); @@ -499,8 +380,14 @@ void AliTRDdigitizer::Exec(Option_t* option) printf(" "); printf("Write the digits\n"); } - fDigitsManager->MakeBranch(fManager->GetTreeDTRD()); + + AliRunLoader* orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + AliLoader* ogime = orl->GetLoader("TRDLoader"); + + fDigitsManager->MakeBranch(ogime->TreeD()); + fDigitsManager->WriteDigits(); + if (fDebug > 0) { printf(" "); printf("Done\n"); @@ -518,22 +405,18 @@ Bool_t AliTRDdigitizer::Open(const Char_t *file, Int_t nEvent) // // Connect the AliRoot file containing Geometry, Kine, and Hits - fInputFile = (TFile *) gROOT->GetListOfFiles()->FindObject(file); - if (!fInputFile) { - if (fDebug > 0) { - printf(" "); - printf("Open the AliROOT-file %s.\n",file); - } - fInputFile = new TFile(file,"UPDATE"); - } - else { - if (fDebug > 0) { - printf(" "); - printf("%s is already open.\n",file); - } - } - - gAlice = (AliRun *) fInputFile->Get("gAlice"); + + fRunLoader = AliRunLoader::Open(file,AliConfig::fgkDefaultEventFolderName,"UPDATE"); + + if (!fRunLoader) + { + Error("Open","Can not open session for file %s.",file); + return kFALSE; + } + + fRunLoader->LoadgAlice(); + gAlice = fRunLoader->GetAliRun(); + if (gAlice) { if (fDebug > 0) { printf(" "); @@ -549,15 +432,37 @@ Bool_t AliTRDdigitizer::Open(const Char_t *file, Int_t nEvent) fEvent = nEvent; // Import the Trees for the event nEvent in the file - Int_t nparticles = gAlice->GetEvent(fEvent); - if (nparticles <= 0) { - printf(" "); - printf("No entries in the trees for event %d.\n",fEvent); - return kFALSE; - } - + fRunLoader->GetEvent(fEvent); + + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + if (!loader) + { + Error("Open","Can not get TRD loader from Run Loader"); + return kFALSE; + } + if (InitDetector()) { - return MakeBranch(); + TTree* tree = 0; + if (fSDigits) + { + //if we produce SDigits + tree = loader->TreeS(); + if (!tree) + { + loader->MakeTree("S"); + tree = loader->TreeS(); + } + } + else + {//if we produce Digits + tree = loader->TreeD(); + if (!tree) + { + loader->MakeTree("D"); + tree = loader->TreeD(); + } + } + return MakeBranch(tree); } else { return kFALSE; @@ -607,13 +512,13 @@ Bool_t AliTRDdigitizer::InitDetector() } //_____________________________________________________________________________ -Bool_t AliTRDdigitizer::MakeBranch(const Char_t *file) const +Bool_t AliTRDdigitizer::MakeBranch(TTree* tree) const { // // Create the branches for the digits array // - return fDigitsManager->MakeBranch(file); + return fDigitsManager->MakeBranch(tree); } @@ -664,9 +569,6 @@ Bool_t AliTRDdigitizer::MakeDigits() AliTRDdataArrayI *digits = 0; AliTRDdataArrayI *dictionary[kNDict]; - // Reset the digits arrays - fDigitsManager->ResetArrays(); - // Create a default parameter class if none is defined if (!fPar) { fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter"); @@ -703,9 +605,16 @@ Bool_t AliTRDdigitizer::MakeDigits() printf("Start creating digits.\n"); } - // Get the pointer to the hit tree - TTree *hitTree = gAlice->TreeH(); - + AliLoader* gimme = fRunLoader->GetLoader("TRDLoader"); + if (!gimme->TreeH()) gimme->LoadHits(); + TTree* hitTree = gimme->TreeH(); + if (hitTree == 0x0) + { + Error("MakeDigits","Can not get TreeH"); + return kFALSE; + } + fTRD->SetTreeAddress(); + // Get the number of entries in the hit tree // (Number of primary particles creating a hit somewhere) Int_t nTrack = 1; @@ -1164,7 +1073,6 @@ Bool_t AliTRDdigitizer::MakeDigits() // Compress the arrays if (!fSimpleSim) { - digits->Compress(1,0); for (iDict = 0; iDict < kNDict; iDict++) { dictionary[iDict]->Compress(1,0); @@ -1628,13 +1536,48 @@ void AliTRDdigitizer::DeConvExp(Double_t *source, Double_t *target } //_____________________________________________________________________________ -void AliTRDdigitizer::InitOutput(TFile *file, Int_t iEvent) +void AliTRDdigitizer::InitOutput(Int_t iEvent) { // // Initializes the output branches // fEvent = iEvent; - fDigitsManager->MakeTreeAndBranches(file,iEvent); + + if (!fRunLoader) + { + Error("InitOutput","Run Loader is NULL"); + return; + } + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + if (!loader) + { + Error("Open","Can not get TRD loader from Run Loader"); + return; + } + + TTree* tree = 0; + + if (fSDigits) + { + //if we produce SDigits + tree = loader->TreeS(); + if (!tree) + { + loader->MakeTree("S"); + tree = loader->TreeS(); + } + } + else + {//if we produce Digits + tree = loader->TreeD(); + if (!tree) + { + loader->MakeTree("D"); + tree = loader->TreeD(); + } + } + fDigitsManager->SetEvent(iEvent); + fDigitsManager->MakeBranch(tree); } diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index 103c6b2d03f..8d5674d91c9 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -11,6 +11,7 @@ class TFile; class TF1; class AliRunDigitizer; +class AliRunLoader; class AliTRD; class AliTRDdigitsManager; @@ -37,7 +38,7 @@ class AliTRDdigitizer : public AliDigitizer { virtual Bool_t InitDetector(); virtual void Exec(Option_t* option = 0); virtual Bool_t Open(const Char_t *file, Int_t nEvent = 0); - virtual Bool_t MakeBranch(const Char_t *file = 0) const; + virtual Bool_t MakeBranch(TTree* tree) const; virtual Bool_t MakeDigits(); virtual void AddSDigitsManager(AliTRDdigitsManager *manager); virtual void DeleteSDigitsManager(); @@ -46,7 +47,7 @@ class AliTRDdigitizer : public AliDigitizer { virtual Bool_t SDigits2Digits(); virtual Bool_t WriteDigits() const; - void InitOutput(TFile *file, Int_t iEvent); + void InitOutput(Int_t iEvent); virtual void SetCompress(Int_t c = 1) { fCompress = c; }; virtual void SetDebug(Int_t v = 1) { fDebug = v; }; @@ -71,7 +72,8 @@ class AliTRDdigitizer : public AliDigitizer { protected: - TFile *fInputFile; //! ALIROOT-file + //TFile *fInputFile; //! ALIROOT-file + AliRunLoader *fRunLoader; AliTRDdigitsManager *fDigitsManager; //! Manager for the output digits AliTRDdigitsManager *fSDigitsManager; //! Manager for the summed input s-digits TList *fSDigitsManagerList; //! List of managers of input s-digits diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx index ab7a04e5879..2279d744a31 100644 --- a/TRD/AliTRDdigitsManager.cxx +++ b/TRD/AliTRDdigitsManager.cxx @@ -13,93 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2003/02/04 17:26:00 cblume -Include a reset of the digits arrays in order to process several events - -Revision 1.20 2002/10/22 15:53:08 alibrary -Introducing Riostream.h - -Revision 1.19 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.16.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.16.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.18 2002/04/12 12:13:23 cblume -Add Jiris changes - -Revision 1.17 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.18 2002/04/12 12:13:23 cblume -Add Jiris changes - -Revision 1.17 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.16 2002/02/12 11:42:08 cblume -Remove fTree from destructor - -Revision 1.15 2002/02/11 14:27:54 cblume -Geometry and hit structure update - -Revision 1.14 2001/11/14 10:50:46 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.13 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.12 2001/05/16 14:57:28 alibrary -New files for folders and Stack - -Revision 1.11 2001/03/13 09:30:35 cblume -Update of digitization. Moved digit branch definition to AliTRD - -Revision 1.10 2001/01/26 19:56:57 hristov -Major upgrade of AliRoot code - -Revision 1.9 2000/11/02 09:25:53 cblume -Change also the dictionary to AliTRDdataArray - -Revision 1.8 2000/11/01 15:20:13 cblume -Change AliTRDdataArrayI to AliTRDdataArray in MakeBranch() - -Revision 1.7 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.2.5 2000/10/17 02:27:34 cblume -Get rid of global constants - -Revision 1.1.2.4 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 14:44:01 cblume -Add new class AliTRDdigitsManager - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -142,8 +56,6 @@ AliTRDdigitsManager::AliTRDdigitsManager():TObject() fDebug = 0; fSDigits = 0; - fFile = NULL; - fFileCreated = kFALSE; fTree = NULL; fDigits = NULL; for (Int_t iDict = 0; iDict < kNDict; iDict++) { @@ -170,12 +82,6 @@ AliTRDdigitsManager::~AliTRDdigitsManager() // AliTRDdigitsManager destructor // - if (fFile && fFileCreated) { - fFile->Close(); - delete fFile; - fFile = NULL; - } - if (fDigits) { fDigits->Delete(); delete fDigits; @@ -269,78 +175,7 @@ Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time } //_____________________________________________________________________________ -Bool_t AliTRDdigitsManager::Open(const Char_t *file) -{ - // - // Opens the file for the TRD digits - // - - fFile = (TFile*) gROOT->GetListOfFiles()->FindObject(file); - if (!fFile) { - if (fDebug > 0) { - printf(" "); - printf("Open the AliROOT-file %s.\n",file); - } - fFile = new TFile(file,"UPDATE"); - fFileCreated = kTRUE; - if (!fFile) return kFALSE; - } - else { - if (fDebug > 0) { - printf(" "); - printf("%s is already open.\n",file); - } - } - - return kTRUE; - -} - -//_____________________________________________________________________________ -void AliTRDdigitsManager::MakeTreeAndBranches(TFile *file, Int_t iEvent) -{ - // - // Creates tree for (s)digits in the specified file - // - - fEvent = iEvent; - TDirectory *wd = gDirectory; - file->cd(); - MakeBranch(); - wd->cd(); - -} - -//_____________________________________________________________________________ -Bool_t AliTRDdigitsManager::MakeBranch(const Char_t *file) -{ - // - // Creates the tree and branches for the digits and the dictionary - // - - // Create the TRD digits tree - TTree *tree; - Char_t treeName[12]; - if (fSDigits) { - sprintf(treeName,"TreeS%d_TRD",fEvent); - tree = new TTree(treeName,"TRD SDigits"); - } - else { - sprintf(treeName,"TreeD%d_TRD",fEvent); - tree = new TTree(treeName,"TRD Digits"); - } - - if (fDebug > 0) { - printf(" "); - printf("Creating tree %s\n",treeName); - } - - return MakeBranch(tree,file); - -} - -//_____________________________________________________________________________ -Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree, const Char_t *file) +Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree) { // // Creates the tree and branches for the digits and the dictionary @@ -361,7 +196,7 @@ Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree, const Char_t *file) const AliTRDdataArray *kDigits = (AliTRDdataArray *) fDigits->At(0); if (kDigits) { trd->MakeBranchInTree(fTree,"TRDdigits",kDigits->IsA()->GetName() - ,&kDigits,buffersize,99,file); + ,&kDigits,buffersize,99); if (fDebug > 0) { printf(" "); printf("Making branch TRDdigits\n"); @@ -384,7 +219,7 @@ Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree, const Char_t *file) (AliTRDdataArray *) fDictionary[iDict]->At(0); if (kDictionary) { trd->MakeBranchInTree(fTree,branchname,kDictionary->IsA()->GetName() - ,&kDictionary,buffersize,99,file); + ,&kDictionary,buffersize,99); if (fDebug > 0) { printf(" "); printf("Making branch %s\n",branchname); @@ -416,32 +251,6 @@ Bool_t AliTRDdigitsManager::ReadDigits(TTree *tree) fTree = tree; - } - else { - - // Get the digits tree - Char_t treeName[12]; - if (fSDigits) { - sprintf(treeName,"TreeS%d_TRD",fEvent); - } - else { - sprintf(treeName,"TreeD%d_TRD",fEvent); - } - if (fFile) { - fTree = (TTree *) fFile->Get(treeName); - } - else { - fTree = (TTree *) gDirectory->Get(treeName); - } - - if (!fTree) { - if (fDebug > 0) { - printf(" "); - printf("Could not find tree %s.\n",treeName); - } - return kFALSE; - } - } if (!fDigits) { diff --git a/TRD/AliTRDdigitsManager.h b/TRD/AliTRDdigitsManager.h index 6d7b6217711..21418ac08f7 100644 --- a/TRD/AliTRDdigitsManager.h +++ b/TRD/AliTRDdigitsManager.h @@ -33,11 +33,10 @@ class AliTRDdigitsManager : public TObject { virtual void CreateArrays(); virtual void ResetArrays(); virtual void Copy(TObject &m); - virtual Bool_t Open(const Char_t *file); - virtual Bool_t MakeBranch(const Char_t *file = 0); - virtual Bool_t MakeBranch(TTree *tree, const Char_t *file = 0); - void MakeTreeAndBranches(TFile *treeFile, Int_t iEvent); - virtual Bool_t ReadDigits(TTree *tree = 0); + + virtual Bool_t MakeBranch(TTree *tree); + + virtual Bool_t ReadDigits(TTree *tree); virtual Bool_t WriteDigits(); virtual void SetRaw(); @@ -66,8 +65,6 @@ class AliTRDdigitsManager : public TObject { Int_t fEvent; // Event number - TFile *fFile; //! File containing the TRD digits tree - Bool_t fFileCreated; //! Flag set if file was created by the digits manager TTree *fTree; //! Tree for the digits arrays AliTRDsegmentArray *fDigits; //! Digits data array diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 8641e2b4c49..22cfe450cee 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -13,117 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2002/11/21 16:09:44 cblume -Change fgkRpadW to 1.0 cm for new pad plane - -Revision 1.20 2002/10/31 17:45:35 cblume -New chamber geometry - -Revision 1.19 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.15.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.15.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.17 2002/04/05 13:20:12 cblume -Remove const for CreateGeometry - -Revision 1.16 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.18 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.17 2002/04/05 13:20:12 cblume -Remove const for CreateGeometry - -Revision 1.16 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.15 2002/02/11 14:21:16 cblume -Update of the geometry. Get rid of MANY - -Revision 1.14 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.13 2001/08/02 08:30:45 cblume -Fix positions of cooling material - -Revision 1.12 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.11 2001/05/11 07:56:12 hristov -Consistent declarations needed on Alpha - -Revision 1.10 2001/05/07 08:08:05 cblume -Update of TRD code - -Revision 1.9 2001/03/27 12:48:33 cblume -Correct for volume overlaps - -Revision 1.8 2001/03/13 09:30:35 cblume -Update of digitization. Moved digit branch definition to AliTRD - -Revision 1.7 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.4.7 2000/10/16 01:16:53 cblume -Changed timebin 0 to be the one closest to the readout - -Revision 1.1.4.6 2000/10/15 23:35:57 cblume -Include geometry constants as static member - -Revision 1.1.4.5 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.4 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.3 2000/09/22 14:43:40 cblume -Allow the pad/timebin-dimensions to be changed after initialization - -Revision 1.1.4.2 2000/09/18 13:37:01 cblume -Minor coding corrections - -Revision 1.5 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:45:55 cblume -Bug fix in RotateBack(). Geometry update - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:45:55 cblume -Bug fix in RotateBack(). Geometry update - -Revision 1.1 2000/02/28 19:00:44 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDgeometryDetail.cxx b/TRD/AliTRDgeometryDetail.cxx index 80657e2d9f8..230b549c596 100644 --- a/TRD/AliTRDgeometryDetail.cxx +++ b/TRD/AliTRDgeometryDetail.cxx @@ -13,30 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.6 2002/10/14 14:57:43 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.3.6.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.5 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.4 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.3 2002/02/11 14:21:16 cblume -Update of the geometry. Get rid of MANY - -Revision 1.2 2001/11/08 13:13:08 cblume -Change to MANY for UCFI/M/O and UAFI/M/O - -Revision 1.1 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -44,7 +21,7 @@ Add detailed geometry and simple simulator // // /////////////////////////////////////////////////////////////////////////////// -#include "TVirtualMC.h" +#include #include "AliTRDgeometryDetail.h" #include "AliTRDparameter.h" diff --git a/TRD/AliTRDgeometryFull.cxx b/TRD/AliTRDgeometryFull.cxx index 4e3c4496bb9..7798f5f8c8c 100644 --- a/TRD/AliTRDgeometryFull.cxx +++ b/TRD/AliTRDgeometryFull.cxx @@ -13,54 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2002/10/31 17:45:35 cblume -New chamber geometry - -Revision 1.8 2002/02/11 14:21:16 cblume -Update of the geometry. Get rid of MANY - -Revision 1.7 2001/05/11 07:56:12 hristov -Consistent declarations needed on Alpha - -Revision 1.6 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.5 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.6 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.4.5 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.4 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.3 2000/09/22 14:43:41 cblume -Allow the pad/timebin-dimensions to be changed after initialization - -Revision 1.4 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.2 2000/05/08 14:46:44 cblume -Include options SetPHOShole() and SetRICHhole() - -Revision 1.1.4.1 2000/04/27 12:46:04 cblume -Corrected bug in full geometry - -Revision 1.1 2000/02/28 19:01:15 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -68,8 +21,7 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// -#include "TVirtualMC.h" - +#include #include "AliTRDgeometryFull.h" ClassImp(AliTRDgeometryFull) diff --git a/TRD/AliTRDgeometryHole.cxx b/TRD/AliTRDgeometryHole.cxx index 28abcf295ad..38937d300cf 100644 --- a/TRD/AliTRDgeometryHole.cxx +++ b/TRD/AliTRDgeometryHole.cxx @@ -13,45 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2002/10/31 17:45:35 cblume -New chamber geometry - -Revision 1.7 2002/02/11 14:21:16 cblume -Update of the geometry. Get rid of MANY - -Revision 1.6 2001/05/11 07:56:12 hristov -Consistent declarations needed on Alpha - -Revision 1.5 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.4 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.4 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.1.4.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.1 2000/09/22 14:43:41 cblume -Allow the pad/timebin-dimensions to be changed after initialization - -Revision 1.3 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.1 2000/02/28 19:01:42 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -59,8 +21,7 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// -#include "TVirtualMC.h" - +#include #include "AliTRDgeometryHole.h" ClassImp(AliTRDgeometryHole) diff --git a/TRD/AliTRDhit.cxx b/TRD/AliTRDhit.cxx index 092ab47aa09..5089bd34970 100644 --- a/TRD/AliTRDhit.cxx +++ b/TRD/AliTRDhit.cxx @@ -13,27 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.2.2 2000/09/18 13:41:29 cblume -Changed fDetector to UShort and fQ to Short_t. Use customized streamer - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 14:48:31 cblume -AliTRDhit class now in separate files - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDhits2sdigits.C b/TRD/AliTRDhits2sdigits.C index d1f9f58639f..b3ebe43cee8 100644 --- a/TRD/AliTRDhits2sdigits.C +++ b/TRD/AliTRDhits2sdigits.C @@ -18,8 +18,7 @@ void AliTRDhits2sdigits() Char_t *alifile = "galice.root"; // Create the TRD digitzer - AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" - ,"TRD digitizer class"); + AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer","TRD digitizer class"); // Set the parameter digitizer->SetDebug(1); @@ -44,6 +43,8 @@ void AliTRDhits2sdigits() digitizer->WriteDigits(); // Save the parameter object in the AliROOT file + AliRunLoader* rl = AliRunLoader::GetRunLoader(AliConfig::fgkDefaultEventFolderName); + rl->CdGAFile(); parameter->Write(); } diff --git a/TRD/AliTRDmatrix.cxx b/TRD/AliTRDmatrix.cxx index bb2a3da011c..d419c1a3e81 100644 --- a/TRD/AliTRDmatrix.cxx +++ b/TRD/AliTRDmatrix.cxx @@ -13,63 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.10.12.2 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.10.12.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.11 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.11 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.10 2000/11/20 08:56:51 cblume -Fix the binning of the histograms - -Revision 1.9 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.4.2.5 2000/10/17 02:27:34 cblume -Get rid of global constants - -Revision 1.4.2.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.4.2.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.8 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.7 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.6 2000/05/08 15:48:30 cblume -Resolved merge conflict - -Revision 1.4.2.2 2000/05/08 14:50:58 cblume -Add functions ProjRow(), ProjCol(), and ProjTime() - -Revision 1.4.2.1 2000/04/27 12:47:02 cblume -Replace Fill3() by Fill() - -Revision 1.4 2000/02/28 19:10:26 cblume -Include the new TRD classes - -Revision 1.3.4.1 2000/02/28 17:57:47 cblume -GetTrack returns now -1 if no track is found - -Revision 1.3 1999/10/04 14:48:07 fca -Avoid warnings on non-ansi compiler HP-UX CC - -Revision 1.2 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDmcTrack.cxx b/TRD/AliTRDmcTrack.cxx index bfec860f342..08a1f3f04c1 100644 --- a/TRD/AliTRDmcTrack.cxx +++ b/TRD/AliTRDmcTrack.cxx @@ -13,6 +13,14 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD MC track // +// Used for efficiency estimates and matching of reconstructed tracks // +// to MC particles // +// // +/////////////////////////////////////////////////////////////////////////////// + #include "AliTRDmcTrack.h" #include "AliTRDgeometry.h" @@ -136,7 +144,3 @@ void AliTRDmcTrack::GetPlanePxPyPz(Double_t& px, Double_t& py, Double_t& pz, } return; } - - - - diff --git a/TRD/AliTRDmcTrack.h b/TRD/AliTRDmcTrack.h index bc824e1d2f0..b633df5622c 100644 --- a/TRD/AliTRDmcTrack.h +++ b/TRD/AliTRDmcTrack.h @@ -4,6 +4,14 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD MC track // +// Used for efficiency estimates and matching of reconstructed tracks // +// to MC particles // +// // +/////////////////////////////////////////////////////////////////////////////// + #include class AliTRDgeometry; diff --git a/TRD/AliTRDparameter.cxx b/TRD/AliTRDparameter.cxx index 3f5ae3e7e36..5ba8bc597b5 100644 --- a/TRD/AliTRDparameter.cxx +++ b/TRD/AliTRDparameter.cxx @@ -13,45 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2002/11/21 14:34:53 cblume -Bug fix in SetNRowPad() reposted by Bogdan - -Revision 1.10 2002/10/31 17:46:22 cblume -New padplane (same number of columns in outer plane - -Revision 1.9 2002/10/28 13:02:51 cblume -Bug fix in GetTiltingAngle() - -Revision 1.8 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.5.6.3 2002/10/11 07:26:37 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.7 2002/09/26 09:26:31 cblume -Bug fix in LUT - -Revision 1.6 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.5 2002/04/30 08:30:40 cblume -gAlice now only read by AliRunDigitizer. Therefore it is just deleted in AliTRDmerge.C - -Revision 1.4 2002/04/12 12:13:23 cblume -Add Jiris changes - -Revision 1.3 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.2 2002/03/28 10:00:36 hristov -Some additional initialisation - -Revision 1.1 2002/03/25 20:01:18 cblume -Introduce parameter class - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDpid.cxx b/TRD/AliTRDpid.cxx index 63c357ead63..cc34adbd7ab 100644 --- a/TRD/AliTRDpid.cxx +++ b/TRD/AliTRDpid.cxx @@ -13,27 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4.6.1 2002/07/24 10:09:30 alibrary -Updating VirtualMC - -Revision 1.5 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.4 2001/11/19 08:44:08 cblume -Fix bugs reported by Rene - -Revision 1.3 2001/11/14 10:50:46 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.2 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.1 2001/05/07 08:08:05 cblume -Update of TRD code - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDpid.h b/TRD/AliTRDpid.h index 2571718f281..00d00a1e929 100644 --- a/TRD/AliTRDpid.h +++ b/TRD/AliTRDpid.h @@ -4,7 +4,6 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - /////////////////////////////////////////////////////////////////////////////// // // // The TRD particle identification base class // diff --git a/TRD/AliTRDpixel.cxx b/TRD/AliTRDpixel.cxx index c0c0fbc06c9..c2a470a1190 100644 --- a/TRD/AliTRDpixel.cxx +++ b/TRD/AliTRDpixel.cxx @@ -13,30 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3.2.2 2000/10/17 02:27:34 cblume -Get rid of global constants - -Revision 1.3.2.1 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/02/28 19:10:26 cblume -Include the new TRD classes - -Revision 1.2.4.1 2000/02/28 17:59:27 cblume -Initialize fTrack with -1 - -Revision 1.2 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDpoints.cxx b/TRD/AliTRDpoints.cxx index c3f7347f6e8..20e4f3c7c3a 100644 --- a/TRD/AliTRDpoints.cxx +++ b/TRD/AliTRDpoints.cxx @@ -13,30 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3.12.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.3.12.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.4 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.4 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.3 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.2 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.1 2000/09/18 13:44:21 cblume -New class AliTRDpoints to display the TR photon hits - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDrawData.cxx b/TRD/AliTRDrawData.cxx index 8f3ae748c3a..1a3e9df7f25 100644 --- a/TRD/AliTRDrawData.cxx +++ b/TRD/AliTRDrawData.cxx @@ -13,18 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.2 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.1.2.1 2002/10/11 07:26:37 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.1 2002/09/13 14:33:52 cblume -Add conversion class to produce fake raw data - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDrecPoint.cxx b/TRD/AliTRDrecPoint.cxx index 09d1184ae52..f8cae6073f4 100644 --- a/TRD/AliTRDrecPoint.cxx +++ b/TRD/AliTRDrecPoint.cxx @@ -13,51 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7.6.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.7.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.8 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.9 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.8 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.7 2001/12/05 15:04:34 hristov -Changes related to the corrections of AliRecPoint - -Revision 1.6 2001/02/14 18:22:26 cblume -Change in the geometry of the padplane - -Revision 1.5 2000/11/14 14:40:27 cblume -Correction for the Sun compiler (kTRUE and kFALSE) - -Revision 1.4 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.4.1 2000/09/22 14:50:39 cblume -Adapted to tracking code - -Revision 1.3 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.2 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.1 2000/02/28 19:02:07 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsdigits2digits.C b/TRD/AliTRDsdigits2digits.C index 4f82ac90840..b733b8a80ae 100644 --- a/TRD/AliTRDsdigits2digits.C +++ b/TRD/AliTRDsdigits2digits.C @@ -26,19 +26,21 @@ void AliTRDsdigits2digits() // Initialize the geometry digitizer->Open(fileName); + AliRunLoader* rl = AliRunLoader::GetRunLoader(AliConfig::fgkDefaultEventFolderName); + AliLoader* loader = rl->GetLoader("TRDLoader"); // Define the parameter object // If no external parameter object is defined, // default parameter will be used - AliTRDparameter *parameter = new AliTRDparameter("TRDparameter" - ,"TRD parameter class"); + AliTRDparameter *parameter = new AliTRDparameter("TRDparameter","TRD parameter class"); digitizer->SetParameter(parameter); // Create the digits manager for the input s-digits AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager(); sdigitsManager->SetDebug(1); sdigitsManager->SetSDigits(kTRUE); - sdigitsManager->ReadDigits(); - + if (loader->TreeS() == 0x0) loader->LoadSDigits(); + + sdigitsManager->ReadDigits(loader->TreeS()); // Add the s-digits to the input list digitizer->AddSDigitsManager(sdigitsManager); @@ -49,6 +51,8 @@ void AliTRDsdigits2digits() digitizer->WriteDigits(); // Save the parameter object in the AliROOT file + + rl->CdGAFile(); parameter->Write(); } diff --git a/TRD/AliTRDsegmentArray.cxx b/TRD/AliTRDsegmentArray.cxx index 5be1a3acfa7..1181e02c0e9 100644 --- a/TRD/AliTRDsegmentArray.cxx +++ b/TRD/AliTRDsegmentArray.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.8 2001/11/14 10:50:46 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.7 2001/03/13 09:30:35 cblume -Update of digitization. Moved digit branch definition to AliTRD - -Revision 1.6 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/10/02 21:28:19 fca -Removal of useless dependecies via forward declarations - -Revision 1.4 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:55:03 cblume -Bug fixes - -Revision 1.1 2000/02/28 19:02:32 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsegmentArrayBase.cxx b/TRD/AliTRDsegmentArrayBase.cxx index 8ceb9e7a7b2..553bd247e30 100644 --- a/TRD/AliTRDsegmentArrayBase.cxx +++ b/TRD/AliTRDsegmentArrayBase.cxx @@ -13,60 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.12.6.1 2002/06/10 15:28:58 hristov -Merged with v3-08-02 - -Revision 1.13 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.12 2002/02/12 16:06:45 cblume -Remove delete fTree - -Revision 1.11 2001/11/19 08:44:08 cblume -Fix bugs reported by Rene - -Revision 1.10 2001/08/30 09:31:22 hristov -The operator[] is replaced by At() or AddAt() in case of TObjArray. - -Revision 1.9 2001/07/27 13:03:15 hristov -Default Branch split level set to 99 - -Revision 1.8 2001/01/26 19:56:57 hristov -Major upgrade of AliRoot code - -Revision 1.7 2000/11/20 08:56:07 cblume -Cleanup of data arrays - -Revision 1.6 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.4.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.4 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.3 2000/06/07 16:27:01 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.4.1 2000/05/08 14:55:03 cblume -Bug fixes - -Revision 1.1 2000/02/28 19:02:56 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsegmentArrayBase.h b/TRD/AliTRDsegmentArrayBase.h index f8e997bb4e6..7a77b65caa9 100644 --- a/TRD/AliTRDsegmentArrayBase.h +++ b/TRD/AliTRDsegmentArrayBase.h @@ -3,7 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -/* $Id: AliTRDsegmentArrayBase.h,v */ +/* $Id$ */ //////////////////////////////////////////////// // Manager class for a general Alice segment // diff --git a/TRD/AliTRDsegmentID.cxx b/TRD/AliTRDsegmentID.cxx index e3576e4a18c..7ea941f37b4 100644 --- a/TRD/AliTRDsegmentID.cxx +++ b/TRD/AliTRDsegmentID.cxx @@ -13,27 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3.12.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.4 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.3 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.1.4.1 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.2 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.1 2000/02/28 19:03:35 cblume -Add new TRD classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsim.cxx b/TRD/AliTRDsim.cxx index 2bb143c1c2c..4a1c2afca6c 100644 --- a/TRD/AliTRDsim.cxx +++ b/TRD/AliTRDsim.cxx @@ -13,39 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2001/11/14 10:50:46 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.10 2001/05/31 16:53:26 alibrary -Correction to the destructor - -Revision 1.9 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.8 2001/01/26 19:56:57 hristov -Major upgrade of AliRoot code - -Revision 1.7 2000/12/20 13:00:45 cblume -Modifications for the HP-compiler - -Revision 1.6 2000/12/12 10:20:10 cblume -Initialize fSepctrum = 0 in ctors - -Revision 1.5 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.3.2.1 2000/09/18 13:45:30 cblume -New class AliTRDsim that simulates TR photons - -Revision 1.2 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsimple.cxx b/TRD/AliTRDsimple.cxx index 62abfb09c35..052ed7f8243 100644 --- a/TRD/AliTRDsimple.cxx +++ b/TRD/AliTRDsimple.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsimpleGen.cxx b/TRD/AliTRDsimpleGen.cxx index 892d0476ced..bd940fa3c8f 100644 --- a/TRD/AliTRDsimpleGen.cxx +++ b/TRD/AliTRDsimpleGen.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDsimpleGen.h b/TRD/AliTRDsimpleGen.h index 8248fe37477..0d63bdb52e9 100644 --- a/TRD/AliTRDsimpleGen.h +++ b/TRD/AliTRDsimpleGen.h @@ -4,7 +4,7 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - + /////////////////////////////////////////////////////////////////////////////// // // // Particle generator for the simplescopic TRD simulator // diff --git a/TRD/AliTRDsimpleMC.cxx b/TRD/AliTRDsimpleMC.cxx index 537dbb4463c..8ec90ad6f4d 100644 --- a/TRD/AliTRDsimpleMC.cxx +++ b/TRD/AliTRDsimpleMC.cxx @@ -13,28 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2003/01/07 09:03:52 alibrary -New TrackMomentum and Position without LorentzVectors +/* $Id$ */ -Revision 1.4 2002/11/21 22:38:47 alibrary -Removing AliMC and AliMCProcess - -Revision 1.3 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.1.8.1 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.2 2002/06/12 09:54:35 cblume -Update of tracking code provided by Sergei - -Revision 1.1 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -*/ - /////////////////////////////////////////////////////////////////////////////// // // // Simple TRD Monte Carlo class // @@ -46,9 +26,9 @@ Add detailed geometry and simple simulator #include #include "AliRun.h" - -#include "AliTRDsimpleMC.h" #include "AliTRDgeometry.h" +#include "AliTRDparameter.h" +#include "AliTRDsimpleMC.h" #include "AliTRDv1.h" #include "AliTRDparameter.h" @@ -296,16 +276,17 @@ void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const } //_____________________________________________________________________________ -void AliTRDsimpleMC::TrackMomentum(Double_t &px, Double_t &py, Double_t &pz, Double_t &etot) const +void AliTRDsimpleMC::TrackMomentum(Double_t &px, Double_t &py, + Double_t &pz, Double_t &et) const { // // Track Momentum // - px = fTrackPx; - py = fTrackPy; - pz = fTrackPz; - etot = fTrackEtot; + px = fTrackPx; + py = fTrackPy; + pz = fTrackPz; + et = fTrackEtot; } diff --git a/TRD/AliTRDsimpleMC.h b/TRD/AliTRDsimpleMC.h index b45bdf48140..3e9ec6788bc 100644 --- a/TRD/AliTRDsimpleMC.h +++ b/TRD/AliTRDsimpleMC.h @@ -10,10 +10,9 @@ // Simple TRD Monte Carlo class // // // /////////////////////////////////////////////////////////////////////////////// - -#include "TMCProcess.h" -#include "TVirtualMC.h" +#include +#include #include "AliDecayer.h" class AliTRDv1; diff --git a/TRD/AliTRDtimeBin.cxx b/TRD/AliTRDtimeBin.cxx index f6c09ab848e..e18e493faaf 100644 --- a/TRD/AliTRDtimeBin.cxx +++ b/TRD/AliTRDtimeBin.cxx @@ -13,33 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5.6.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.6 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.5 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -Revision 1.4 2001/10/21 18:30:02 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.3 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.2 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.2.1 2000/09/22 14:47:52 cblume -Add the tracking code - -*/ +/* $Id$ */ ////////////////////////////////////////////////////////////////////// // // diff --git a/TRD/AliTRDtrack.cxx b/TRD/AliTRDtrack.cxx index 9af132f4cfb..11c52b17665 100644 --- a/TRD/AliTRDtrack.cxx +++ b/TRD/AliTRDtrack.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.8.8.4 2003/07/10 17:09:52 hristov +Merging to v3-10-00 + +Revision 1.20 2003/05/27 17:46:13 hristov +TRD PID included in the ESD schema (T.Kuhr) + Revision 1.19 2003/05/22 10:46:46 hristov Using access methods instead of data members diff --git a/TRD/AliTRDtracker.cxx b/TRD/AliTRDtracker.cxx index e0321025b23..12b8d483211 100644 --- a/TRD/AliTRDtracker.cxx +++ b/TRD/AliTRDtracker.cxx @@ -13,132 +13,76 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.26 2003/04/10 10:36:54 hristov -Code for unified TPC/TRD tracking (S.Radomski) - -Revision 1.25 2003/03/19 17:14:11 hristov -Load/UnloadClusters added to the base class and the derived classes changed correspondingly. Possibility to give 2 input files for ITS and TPC tracks in PropagateBack. TRD tracker uses fEventN from the base class (T.Kuhr) - -Revision 1.24 2003/02/19 09:02:28 hristov -Track time measurement (S.Radomski) - -Revision 1.23 2003/02/10 14:06:10 cblume -Add tracking without tilted pads as option - -Revision 1.22 2003/01/30 15:19:58 cblume -New set of parameters - -Revision 1.21 2003/01/27 16:34:49 cblume -Update of tracking by Sergei and Chuncheng - -Revision 1.20 2002/11/07 15:52:09 cblume -Update of tracking code for tilted pads - -Revision 1.19 2002/10/22 15:53:08 alibrary -Introducing Riostream.h - -Revision 1.18 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.14.6.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.17 2002/06/13 12:09:58 hristov -Minor corrections - -Revision 1.16 2002/06/12 09:54:36 cblume -Update of tracking code provided by Sergei - -Revision 1.14 2001/11/14 10:50:46 cblume -Changes in digits IO. Add merging of summable digits - -Revision 1.13 2001/05/30 12:17:47 hristov -Loop variables declared once - -Revision 1.12 2001/05/28 17:07:58 hristov -Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) - -Revision 1.8 2000/12/20 13:00:44 cblume -Modifications for the HP-compiler - -Revision 1.7 2000/12/08 16:07:02 cblume -Update of the tracking by Sergei - -Revision 1.6 2000/11/30 17:38:08 cblume -Changes to get in line with new STEER and EVGEN - -Revision 1.5 2000/11/14 14:40:27 cblume -Correction for the Sun compiler (kTRUE and kFALSE) - -Revision 1.4 2000/11/10 14:57:52 cblume -Changes in the geometry constants for the DEC compiler - -Revision 1.3 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.2 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.2.1 2000/09/22 14:47:52 cblume -Add the tracking code - -*/ +/* $Id$ */ #include #include #include #include -#include +#include +#include #include "AliTRDgeometry.h" #include "AliTRDparameter.h" #include "AliTRDgeometryDetail.h" #include "AliTRDcluster.h" #include "AliTRDtrack.h" -#include "AliTRDPartID.h" #include "../TPC/AliTPCtrack.h" #include "AliTRDtracker.h" ClassImp(AliTRDtracker) - const Float_t AliTRDtracker::fSeedDepth = 0.5; - const Float_t AliTRDtracker::fSeedStep = 0.10; - const Float_t AliTRDtracker::fSeedGap = 0.25; + const Float_t AliTRDtracker::fgkSeedDepth = 0.5; + const Float_t AliTRDtracker::fgkSeedStep = 0.10; + const Float_t AliTRDtracker::fgkSeedGap = 0.25; - const Float_t AliTRDtracker::fMaxSeedDeltaZ12 = 40.; - const Float_t AliTRDtracker::fMaxSeedDeltaZ = 25.; - const Float_t AliTRDtracker::fMaxSeedC = 0.0052; - const Float_t AliTRDtracker::fMaxSeedTan = 1.2; - const Float_t AliTRDtracker::fMaxSeedVertexZ = 150.; + const Float_t AliTRDtracker::fgkMaxSeedDeltaZ12 = 40.; + const Float_t AliTRDtracker::fgkMaxSeedDeltaZ = 25.; + const Float_t AliTRDtracker::fgkMaxSeedC = 0.0052; + const Float_t AliTRDtracker::fgkMaxSeedTan = 1.2; + const Float_t AliTRDtracker::fgkMaxSeedVertexZ = 150.; - const Double_t AliTRDtracker::fSeedErrorSY = 0.2; - const Double_t AliTRDtracker::fSeedErrorSY3 = 2.5; - const Double_t AliTRDtracker::fSeedErrorSZ = 0.1; + const Double_t AliTRDtracker::fgkSeedErrorSY = 0.2; + const Double_t AliTRDtracker::fgkSeedErrorSY3 = 2.5; + const Double_t AliTRDtracker::fgkSeedErrorSZ = 0.1; - const Float_t AliTRDtracker::fMinClustersInSeed = 0.7; + const Float_t AliTRDtracker::fgkMinClustersInSeed = 0.7; - const Float_t AliTRDtracker::fMinClustersInTrack = 0.5; - const Float_t AliTRDtracker::fMinFractionOfFoundClusters = 0.8; + const Float_t AliTRDtracker::fgkMinClustersInTrack = 0.5; + const Float_t AliTRDtracker::fgkMinFractionOfFoundClusters = 0.8; + + const Float_t AliTRDtracker::fgkSkipDepth = 0.3; + const Float_t AliTRDtracker::fgkLabelFraction = 0.8; + const Float_t AliTRDtracker::fgkWideRoad = 20.; - const Float_t AliTRDtracker::fSkipDepth = 0.3; - const Float_t AliTRDtracker::fLabelFraction = 0.8; - const Float_t AliTRDtracker::fWideRoad = 20.; + const Double_t AliTRDtracker::fgkMaxChi2 = 12.; - const Double_t AliTRDtracker::fMaxChi2 = 12.; + const Int_t AliTRDtracker::kFirstPlane = 5; + const Int_t AliTRDtracker::kLastPlane = 17; +//____________________________________________________________________ +Int_t AliTRDtracker::PropagateBack() +{ +//Overrides pure virtual methods in AliTracker +//Left for responsible to make it compatible with NewIO -const Int_t AliTRDtracker::kFirstPlane = 5; -const Int_t AliTRDtracker::kLastPlane = 17; + Error("PropagateBack","Not yet NewIO-ed"); + return 0; +} +//____________________________________________________________________ +Int_t AliTRDtracker::Clusters2Tracks() +{ +//Overrides pure virtual methods in AliTracker +//Left for responsible to make it compatible with NewIO + Error("PropagateBack","Not yet NewIO-ed"); + return 0; +} //____________________________________________________________________ -AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker() + +AliTRDtracker::AliTRDtracker(const TFile *geomfile) { // // Main constructor @@ -158,10 +102,10 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker() } else { in->cd(); -// in->ls(); + in->ls(); fGeom = (AliTRDgeometry*) in->Get("TRDgeometry"); fPar = (AliTRDparameter*) in->Get("TRDparameter"); -// fGeom->Dump(); + fGeom->Dump(); } if(fGeom) { @@ -180,6 +124,9 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker() // fGeom->SetT0(fTzero); + // fEvent = 0; + AliTracker::SetEventNumber(0); + fNclusters = 0; fClusters = new TObjArray(2000); fNseeds = 0; @@ -219,7 +166,7 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker() tbAmp = TMath::Min(tbAmp,maxAmp); fTimeBinsPerPlane = tbAmp + tbDrift; - fMaxGap = (Int_t) (fTimeBinsPerPlane * fGeom->Nplan() * fSkipDepth); + fMaxGap = (Int_t) (fTimeBinsPerPlane * fGeom->Nplan() * fgkSkipDepth); fVocal = kFALSE; @@ -365,6 +312,7 @@ inline Double_t f1trd(Double_t x1,Double_t y1, Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); return -xr*yr/sqrt(xr*xr+yr*yr); + } //_____________________________________________________________________ @@ -386,6 +334,7 @@ inline Double_t f2trd(Double_t x1,Double_t y1, Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); return -a/(d*y1-b)*xr/sqrt(xr*xr+yr*yr); + } //_____________________________________________________________________ @@ -398,6 +347,7 @@ inline Double_t f3trd(Double_t x1,Double_t y1, // return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); + } //___________________________________________________________________ @@ -433,7 +383,7 @@ Int_t AliTRDtracker::Clusters2Tracks(const TFile *inp, TFile *out) trd_tree.Branch("tracks","AliTRDtrack",&iotrack_trd,32000,0); Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins(); - Float_t foundMin = fMinClustersInTrack * timeBins; + Float_t foundMin = fgkMinClustersInTrack * timeBins; if (inp) { TFile *in=(TFile*)inp; @@ -480,7 +430,7 @@ Int_t AliTRDtracker::Clusters2Tracks(const TFile *inp, TFile *out) FollowProlongation(t, innerTB); if (t.GetNumberOfClusters() >= foundMin) { UseClusters(&t); - CookLabel(pt, 1-fLabelFraction); + CookLabel(pt, 1-fgkLabelFraction); // t.CookdEdx(); } iotrack_trd = pt; @@ -508,15 +458,15 @@ Int_t AliTRDtracker::Clusters2Tracks(const TFile *inp, TFile *out) // Find tracks for the seeds in the TRD Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins(); - Int_t nSteps = (Int_t) (fSeedDepth / fSeedStep); - Int_t gap = (Int_t) (timeBins * fSeedGap); - Int_t step = (Int_t) (timeBins * fSeedStep); + Int_t nSteps = (Int_t) (fgkSeedDepth / fgkSeedStep); + Int_t gap = (Int_t) (timeBins * fgkSeedGap); + Int_t step = (Int_t) (timeBins * fgkSeedStep); // make a first turn with tight cut on initial curvature for(Int_t turn = 1; turn <= 2; turn++) { if(turn == 2) { - nSteps = (Int_t) (fSeedDepth / (3*fSeedStep)); - step = (Int_t) (timeBins * (3*fSeedStep)); + nSteps = (Int_t) (fgkSeedDepth / (3*fgkSeedStep)); + step = (Int_t) (timeBins * (3*fgkSeedStep)); } for(Int_t i=0; i= foundMin) { UseClusters(&t); - CookLabel(pt, 1-fLabelFraction); + CookLabel(pt, 1-fgkLabelFraction); t.CookdEdx(); found++; // cout<GetEntriesFast(); - // Float_t foundMin = fMinClustersInTrack * fTimeBinsPerPlane * fGeom->Nplan(); + // Float_t foundMin = fgkMinClustersInTrack * fTimeBinsPerPlane * fGeom->Nplan(); Float_t foundMin = 40; Int_t outermost_tb = fTrSec[0]->GetOuterTimeBin(); @@ -679,7 +628,7 @@ Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) { if (foundClr >= foundMin) { if(foundClr >= 2) { s.CookdEdx(); - CookLabel(ps, 1-fLabelFraction); + CookLabel(ps, 1-fgkLabelFraction); UseClusters(ps); } @@ -694,7 +643,7 @@ Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) { if(((expectedClr < 10) && (last_tb == outermost_tb)) || ((expectedClr >= 10) && (((Float_t) foundClr) / ((Float_t) expectedClr) >= - fMinFractionOfFoundClusters) && (last_tb == outermost_tb))) { + fgkMinFractionOfFoundClusters) && (last_tb == outermost_tb))) { Double_t x_tof = 375.5; @@ -758,58 +707,6 @@ Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) { } -//_____________________________________________________________________________ -Int_t AliTRDtracker::PropagateBack(AliESD* event) { - // - // Gets seeds from ESD event. The seeds are AliTPCtrack's found and - // backpropagated by the TPC tracker. Each seed is first propagated - // to the TRD, and then its prolongation is searched in the TRD. - // If sufficiently long continuation of the track is found in the TRD - // the track is updated, otherwise it's stored as originaly defined - // by the TPC tracker. - // - - Int_t found=0; - Float_t foundMin = 40; - - Int_t n = event->GetNumberOfTracks(); - for (Int_t i=0; iGetTrack(i); - ULong_t status=seed->GetStatus(); - if ( (status & AliESDtrack::kTPCout ) == 0 ) continue; - if ( (status & AliESDtrack::kTRDout) != 0 ) continue; - - Int_t lbl = seed->GetLabel(); - AliTRDtrack *track = new AliTRDtrack(*seed); - track->SetSeedLabel(lbl); - fNseeds++; - - Int_t expectedClr = FollowBackProlongation(*track); - - Int_t foundClr = track->GetNumberOfClusters(); - if (foundClr >= foundMin) { - if(foundClr >= 2) { - track->CookdEdx(); -// CookLabel(track, 1-fLabelFraction); - UseClusters(track); - } - - // Propagate to outer reference plane [SR, GSI, 18.02.2003] -// track->PropagateTo(364.8); why? - - seed->UpdateTrackParams(track, AliESDtrack::kTRDout); - found++; - } - - } - - cerr<<"Number of seeds: "<fWideRoad) { + if (road>fgkWideRoad) { if (t.GetNumberOfClusters()>4) cerr<GetLayer(nr)->IsSensitive() != fTrSec[s]->GetLayer(nr+1)->IsSensitive() ) { -// if (IsStoringBarrel()) StoreBarrelTrack(&t, nRefPlane++, kTrackBack); + if (IsStoringBarrel()) StoreBarrelTrack(&t, nRefPlane++, kTrackBack); } if (fTrSec[s]->GetLayer(nr-1)->IsSensitive() && @@ -1156,7 +1053,7 @@ Int_t AliTRDtracker::FollowBackProlongation(AliTRDtrack& t) wSigmaZ2 = (Float_t) t.GetSigmaZ2(); wChi2 = -1; - if (road>fWideRoad) { + if (road>fgkWideRoad) { if (t.GetNumberOfClusters()>4) cerr< 0) max_chi2 = 3 * max_chi2; @@ -1566,11 +1463,11 @@ void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn) y2=xx2*sn2+y2*cs2; } - if(TMath::Abs(z1-z2) > fMaxSeedDeltaZ12) continue; + if(TMath::Abs(z1-z2) > fgkMaxSeedDeltaZ12) continue; Double_t zz=z1 - z1/x1*(x1-x2); - if (TMath::Abs(zz-z2)>fMaxSeedDeltaZ) continue; + if (TMath::Abs(zz-z2)>fgkMaxSeedDeltaZ) continue; Double_t d=(x2-x1)*(0.-y2)-(0.-x2)*(y2-y1); if (d==0.) {cerr<<"TRD MakeSeeds: Straight seed !\n"; continue;} @@ -1579,7 +1476,7 @@ void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn) x[1]=z1; x[4]=f1trd(x1,y1,x2,y2,x3,y3); - if (TMath::Abs(x[4]) > fMaxSeedC) continue; + if (TMath::Abs(x[4]) > fgkMaxSeedC) continue; x[2]=f2trd(x1,y1,x2,y2,x3,y3); @@ -1587,16 +1484,16 @@ void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn) x[3]=f3trd(x1,y1,x2,y2,z1,z2); - if (TMath::Abs(x[3]) > fMaxSeedTan) continue; + if (TMath::Abs(x[3]) > fgkMaxSeedTan) continue; Double_t a=asin(x[2]); Double_t zv=z1 - x[3]/x[4]*(a+asin(x[4]*x1-x[2])); - if (TMath::Abs(zv)>fMaxSeedVertexZ) continue; + if (TMath::Abs(zv)>fgkMaxSeedVertexZ) continue; Double_t sy1=r1[is]->GetSigmaY2(), sz1=r1[is]->GetSigmaZ2(); Double_t sy2=cl->GetSigmaY2(), sz2=cl->GetSigmaZ2(); - Double_t sy3=fSeedErrorSY3, sy=fSeedErrorSY, sz=fSeedErrorSZ; + Double_t sy3=fgkSeedErrorSY3, sy=fgkSeedErrorSY, sz=fgkSeedErrorSZ; // Tilt changes Double_t h01 = GetTiltFactor(r1[is]); @@ -1640,7 +1537,7 @@ void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn) if ((rc < 1) || (track->GetNumberOfClusters() < - (outer-inner)*fMinClustersInSeed)) delete track; + (outer-inner)*fgkMinClustersInSeed)) delete track; else { fSeeds->AddLast(track); fNseeds++; // cerr<<"\r found seed "<GetNumberOfClusters(); @@ -1898,7 +1794,6 @@ Double_t AliTRDtracker::GetX(Int_t sector, Int_t plane, Int_t local_tb) const } - //_______________________________________________________ AliTRDtracker::AliTRDpropagationLayer::AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho, Double_t rad_length, Int_t tb_index) @@ -2545,8 +2440,3 @@ Double_t AliTRDtracker::GetTiltFactor(const AliTRDcluster* c) { return h01; } - - - - - diff --git a/TRD/AliTRDtracker.h b/TRD/AliTRDtracker.h index fbf9c26225b..b9fecd1ca07 100644 --- a/TRD/AliTRDtracker.h +++ b/TRD/AliTRDtracker.h @@ -4,13 +4,16 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +/* $Id$ */ + #include "AliTracker.h" #include "TObjArray.h" #include "AliBarrelTrack.h" -#include "AliESD.h" + +#include +#include class TFile; -class TTree; class TParticle; class TParticlePDG; @@ -26,7 +29,7 @@ const unsigned kMAX_CLUSTER_PER_TIME_BIN = 7000; const unsigned kZONES = 5; const Int_t kTRACKING_SECTORS = 18; -class AliTRDtracker : public AliTracker { +class AliTRDtracker : public AliTracker { public: @@ -36,12 +39,12 @@ class AliTRDtracker : public AliTracker { Int_t Clusters2Tracks(const TFile *in, TFile *out); Int_t PropagateBack(const TFile *in, TFile *out); - Int_t PropagateBack(AliESD* event); - //Int_t Refit(const TFile *in, TFile *out); + Int_t PropagateBack();//Almost empty see .cxx for more comments + Int_t Clusters2Tracks();//Almost empty see .cxx for more comments Int_t LoadClusters() {LoadEvent(); return 0;}; void UnloadClusters() {UnloadEvent();}; - AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL; return (AliCluster*) fClusters->UncheckedAt(index); }; + AliCluster *GetCluster(Int_t index) const { return (AliCluster*) fClusters->UncheckedAt(index); }; virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const; virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const; @@ -54,25 +57,25 @@ class AliTRDtracker : public AliTracker { Int_t CookSectorIndex(Int_t gs) { return kTRACKING_SECTORS - 1 - gs; } - Float_t GetSeedGap() const {return fSeedGap;} + Float_t GetSeedGap() const {return fgkSeedGap;} Int_t GetMaxGap() const {return fMaxGap;} Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;} - Float_t GetSeedStep() const {return fSeedStep;} - Float_t GetSeedDepth() const {return fSeedDepth;} - Float_t GetSkipDepth() const {return fSkipDepth;} - Double_t GetMaxChi2() const {return fMaxChi2;} - Float_t GetMaxSeedC() const {return fMaxSeedC;} - Float_t GetMaxSeedTan() const {return fMaxSeedTan;} - Double_t GetSeedErrorSY() const {return fSeedErrorSY;} - Double_t GetSeedErrorSY3() const {return fSeedErrorSY3;} - Double_t GetSeedErrorSZ() const {return fSeedErrorSZ;} - Float_t GetLabelFraction() const {return fLabelFraction;} - Float_t GetWideRoad() const {return fWideRoad;} - - Float_t GetMinClustersInTrack() const {return fMinClustersInTrack;} - Float_t GetMinClustersInSeed() const {return fMinClustersInSeed;} - Float_t GetMaxSeedDeltaZ() const {return fMaxSeedDeltaZ;} - Float_t GetMaxSeedVertexZ() const {return fMaxSeedVertexZ;} + Float_t GetSeedStep() const {return fgkSeedStep;} + Float_t GetSeedDepth() const {return fgkSeedDepth;} + Float_t GetSkipDepth() const {return fgkSkipDepth;} + Double_t GetMaxChi2() const {return fgkMaxChi2;} + Float_t GetMaxSeedC() const {return fgkMaxSeedC;} + Float_t GetMaxSeedTan() const {return fgkMaxSeedTan;} + Double_t GetSeedErrorSY() const {return fgkSeedErrorSY;} + Double_t GetSeedErrorSY3() const {return fgkSeedErrorSY3;} + Double_t GetSeedErrorSZ() const {return fgkSeedErrorSZ;} + Float_t GetLabelFraction() const {return fgkLabelFraction;} + Float_t GetWideRoad() const {return fgkWideRoad;} + + Float_t GetMinClustersInTrack() const {return fgkMinClustersInTrack;} + Float_t GetMinClustersInSeed() const {return fgkMinClustersInSeed;} + Float_t GetMaxSeedDeltaZ() const {return fgkMaxSeedDeltaZ;} + Float_t GetMaxSeedVertexZ() const {return fgkMaxSeedVertexZ;} // x <-> timebin conversions useful in analysis macros Double_t GetX(Int_t sec, Int_t plane, Int_t local_tb) const; @@ -219,41 +222,41 @@ class AliTRDtracker : public AliTracker { Float_t fSZ2corr; // Correction coefficient for // cluster SigmaZ2 - static const Float_t fSeedGap; // Distance between inner and outer + static const Float_t fgkSeedGap; // Distance between inner and outer // time bin in seeding // (fraction of all time bins) - static const Float_t fSeedStep; // Step in iterations - static const Float_t fSeedDepth; // Fraction of TRD allocated for seeding - static const Float_t fSkipDepth; // Fraction of TRD which can be skipped - // in track prolongation + static const Float_t fgkSeedStep; // Step in iterations + static const Float_t fgkSeedDepth; // Fraction of TRD allocated fgkor seeding + static const Float_t fgkSkipDepth; // Fraction of TRD which can be skipped + // in track prolongation Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane Int_t fMaxGap; // max gap (in time bins) in the track - // in track prolongation + // in track prolongation - static const Double_t fMaxChi2; // max increment in track chi2 - - static const Float_t fMinClustersInTrack; // min number of clusters in track + static const Double_t fgkMaxChi2; // max increment in track chi2 + + static const Float_t fgkMinClustersInTrack; // min number of clusters in track // out of total timebins - static const Float_t fMinFractionOfFoundClusters; // min found clusters + static const Float_t fgkMinFractionOfFoundClusters; // min fgkound clusters // out of expected - static const Float_t fMinClustersInSeed; // min fraction of clusters in seed - static const Float_t fMaxSeedDeltaZ; // max dZ in MakeSeeds - static const Float_t fMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds - static const Float_t fMaxSeedC; // max initial curvature in MakeSeeds - static const Float_t fMaxSeedTan; // max initial Tangens(lambda) in MakeSeeds - static const Float_t fMaxSeedVertexZ; // max vertex Z in MakeSeeds - static const Double_t fSeedErrorSY; // sy parameter in MakeSeeds - static const Double_t fSeedErrorSY3; // sy3 parameter in MakeSeeds - static const Double_t fSeedErrorSZ; // sz parameter in MakeSeeds - static const Float_t fLabelFraction; // min fraction of same label - static const Float_t fWideRoad; // max road width in FindProlongation + static const Float_t fgkMinClustersInSeed; // min fgkraction of clusters in seed + static const Float_t fgkMaxSeedDeltaZ; // max dZ in MakeSeeds + static const Float_t fgkMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds + static const Float_t fgkMaxSeedC; // max initial curvature in MakeSeeds + static const Float_t fgkMaxSeedTan; // max initial Tangens(lambda) in MakeSeeds + static const Float_t fgkMaxSeedVertexZ; // max vertex Z in MakeSeeds + static const Double_t fgkSeedErrorSY; // sy parameter in MakeSeeds + static const Double_t fgkSeedErrorSY3; // sy3 parameter in MakeSeeds + static const Double_t fgkSeedErrorSZ; // sz parameter in MakeSeeds + static const Float_t fgkLabelFraction; // min fgkraction of same label + static const Float_t fgkWideRoad; // max road width in FindProlongation Bool_t fVocal; Bool_t fAddTRDseeds; - + Bool_t fNoTilt; diff --git a/TRD/AliTRDtrackingSector.cxx b/TRD/AliTRDtrackingSector.cxx index 035b82609bb..5852d6ff5ca 100644 --- a/TRD/AliTRDtrackingSector.cxx +++ b/TRD/AliTRDtrackingSector.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7.6.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.9 2002/06/12 09:54:36 cblume -Update of tracking code provided by Sergei - -Revision 1.8 2002/03/28 14:59:07 cblume -Coding conventions - -Revision 1.7 2001/11/19 08:44:08 cblume -Fix bugs reported by Rene - -Revision 1.6 2001/05/28 17:07:58 hristov -Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) - -Revision 1.5 2000/12/08 16:07:02 cblume -Update of the tracking by Sergei - -Revision 1.4 2000/10/16 01:16:53 cblume -Changed timebin 0 to be the one closest to the readout - -Revision 1.3 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.2 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.1.2.1 2000/09/22 14:47:52 cblume -Add the tracking code - -*/ +/* $Id$ */ ///////////////////////////////////////////////////////////////////////// // // @@ -101,6 +66,8 @@ void AliTRDtrackingSector::SetUp() AliTRD *trd = (AliTRD*) gAlice->GetDetector("TRD"); fGeom = trd->GetGeometry(); + fTimeBinSize = fGeom->GetTimeBinSize(); + fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick() /fTimeBinSize) + 1); diff --git a/TRD/AliTRDv0.cxx b/TRD/AliTRDv0.cxx index 1e1eb67bd7f..a0e84f051f9 100644 --- a/TRD/AliTRDv0.cxx +++ b/TRD/AliTRDv0.cxx @@ -13,57 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.21 2002/02/20 14:01:40 hristov -Compare a TString with a string, otherwise the conversion cannot be done on Sun - -Revision 1.20 2002/02/13 16:58:37 cblume -Bug fix reported by Jiri. Make atoi input zero terminated in StepManager() - -Revision 1.19 2002/02/11 14:25:27 cblume -Geometry update, compressed hit structure - -Revision 1.18 2000/11/30 17:38:08 cblume -Changes to get in line with new STEER and EVGEN - -Revision 1.17 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.14.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.14.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.14.2.1 2000/09/18 13:48:18 cblume -Adapt to new AliTRDhit - -Revision 1.16 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.15 2000/06/07 16:25:37 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.14 2000/02/28 19:10:26 cblume -Include the new TRD classes - -Revision 1.13.4.1 2000/02/28 18:01:53 cblume -Change to new hit version and introduce geometry class - -Revision 1.13 1999/11/05 22:50:28 fca -Do not use Atan, removed from ROOT too - -Revision 1.12 1999/11/02 16:35:56 fca -New version of TRD introduced - -Revision 1.11 1999/11/01 20:41:51 fca -Added protections against using the wrong version of FRAME - -Revision 1.10 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -80,17 +30,17 @@ Introduction of the Copyright and cvs Log #include +#include #include #include #include -#include +#include -#include "AliRun.h" #include "AliConst.h" - -#include "AliTRDv0.h" -#include "AliTRDhit.h" +#include "AliRun.h" #include "AliTRDgeometry.h" +#include "AliTRDhit.h" +#include "AliTRDv0.h" ClassImp(AliTRDv0) diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx index b6b4cd13790..2207e0b5a49 100644 --- a/TRD/AliTRDv1.cxx +++ b/TRD/AliTRDv1.cxx @@ -13,126 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.41 2003/04/23 15:19:48 cblume -Fix bug in absorbtion length of photons - -Revision 1.40 2003/04/08 08:14:53 morsch -AddTrackReference moved to AliModule. - -Revision 1.39 2003/02/11 16:54:07 hristov -Updated AliTrackReference class (S.Radomski) - -Revision 1.38 2003/01/31 11:41:06 cblume -Fix bug in StepManager in treating geometry with holes - -Revision 1.37 2003/01/28 14:38:18 cblume -Add track length to track references - -Revision 1.36 2002/11/21 22:38:47 alibrary -Removing AliMC and AliMCProcess - -Revision 1.35 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.33.6.2 2002/07/24 10:09:31 alibrary -Updating VirtualMC - -Revision 1.34 2002/06/13 08:11:56 cblume -Add the track references - -Revision 1.33 2002/02/20 14:01:40 hristov -Compare a TString with a string, otherwise the conversion cannot be done on Sun - -Revision 1.32 2002/02/13 16:58:37 cblume -Bug fix reported by Jiri. Make atoi input zero terminated in StepManager() - -Revision 1.31 2002/02/11 14:25:27 cblume -Geometry update, compressed hit structure - -Revision 1.30 2001/05/21 16:45:47 hristov -Last minute changes (C.Blume) - -Revision 1.29 2001/05/16 14:57:28 alibrary -New files for folders and Stack - -Revision 1.28 2001/05/07 08:03:22 cblume -Generate also hits in the amplification region - -Revision 1.27 2001/03/30 14:40:15 cblume -Update of the digitization parameter - -Revision 1.26 2000/11/30 17:38:08 cblume -Changes to get in line with new STEER and EVGEN - -Revision 1.25 2000/11/15 14:30:16 cblume -Fixed bug in calculating detector no. of extra hit - -Revision 1.24 2000/11/10 14:58:36 cblume -Introduce additional hit with amplitude 0 at the chamber borders - -Revision 1.23 2000/11/01 14:53:21 cblume -Merge with TRD-develop - -Revision 1.17.2.5 2000/10/15 23:40:01 cblume -Remove AliTRDconst - -Revision 1.17.2.4 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.17.2.3 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.17.2.2 2000/09/18 13:50:17 cblume -Include TR photon generation and adapt to new AliTRDhit - -Revision 1.22 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.21 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.20 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.19 2000/06/07 16:27:32 cblume -Try to remove compiler warnings on Sun and HP - -Revision 1.18 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.17.2.1 2000/05/08 14:59:16 cblume -Made inline function non-virtual. Bug fix in setting sensitive chamber - -Revision 1.17 2000/02/28 19:10:26 cblume -Include the new TRD classes - -Revision 1.16.4.1 2000/02/28 18:04:35 cblume -Change to new hit version, introduce geometry class, and move digitization and clustering to AliTRDdigitizer/AliTRDclusterizerV1 - -Revision 1.16 1999/11/05 22:50:28 fca -Do not use Atan, removed from ROOT too - -Revision 1.15 1999/11/02 17:20:19 fca -initialise nbytes before using it - -Revision 1.14 1999/11/02 17:15:54 fca -Correct ansi scoping not accepted by HP compilers - -Revision 1.13 1999/11/02 17:14:51 fca -Correct ansi scoping not accepted by HP compilers - -Revision 1.12 1999/11/02 16:35:56 fca -New version of TRD introduced - -Revision 1.11 1999/11/01 20:41:51 fca -Added protections against using the wrong version of FRAME - -Revision 1.10 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -149,20 +30,20 @@ Introduction of the Copyright and cvs Log #include -#include -#include -#include #include #include +#include +#include +#include +#include -#include "AliRun.h" #include "AliConst.h" - -#include "AliTRDv1.h" +#include "AliRun.h" +#include "AliTRDgeometry.h" #include "AliTRDhit.h" #include "AliTRDmatrix.h" -#include "AliTRDgeometry.h" #include "AliTRDsim.h" +#include "AliTRDv1.h" ClassImp(AliTRDv1) diff --git a/TRD/AliTRDv2.cxx b/TRD/AliTRDv2.cxx index 9823ee87410..fdaf8254eef 100644 --- a/TRD/AliTRDv2.cxx +++ b/TRD/AliTRDv2.cxx @@ -13,12 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.17 2001/11/06 17:19:41 cblume -Add detailed geometry and simple simulator - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -30,12 +25,12 @@ Add detailed geometry and simple simulator #include #include +#include -#include "AliRun.h" #include "AliConst.h" - -#include "AliTRDv2.h" +#include "AliRun.h" #include "AliTRDgeometryDetail.h" +#include "AliTRDv2.h" ClassImp(AliTRDv2) diff --git a/TRD/libTRD.pkg b/TRD/libTRD.pkg index aaac52af401..05604ab2db7 100644 --- a/TRD/libTRD.pkg +++ b/TRD/libTRD.pkg @@ -47,4 +47,4 @@ EHDRS := $(ROOTSYS)/include/TF1.h \ $(ROOTSYS)/include/TLorentzVector.h -DHDR= TRDLinkDef.h \ No newline at end of file +DHDR= TRDLinkDef.h diff --git a/VZERO/AliVZERO.cxx b/VZERO/AliVZERO.cxx index 3d7b6a370ce..6db789b594b 100755 --- a/VZERO/AliVZERO.cxx +++ b/VZERO/AliVZERO.cxx @@ -13,7 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - +/* $Id$ */ /////////////////////////////////////////////////////////////////////////// // // @@ -25,13 +25,9 @@ // // /////////////////////////////////////////////////////////////////////////// -#include + #include -#include "TMath.h" -#include "TTUBE.h" -#include "TNode.h" -#include "TGeometry.h" #include "AliRun.h" #include "AliVZERO.h" #include "AliVZEROdigit.h" diff --git a/VZERO/AliVZEROhit.cxx b/VZERO/AliVZEROhit.cxx index f97d72a6a35..f5f264b12a2 100644 --- a/VZERO/AliVZEROhit.cxx +++ b/VZERO/AliVZEROhit.cxx @@ -13,6 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ + #include "AliVZEROhit.h" diff --git a/VZERO/AliVZEROhit.h b/VZERO/AliVZEROhit.h index fd06571f4e3..276d129e0aa 100644 --- a/VZERO/AliVZEROhit.h +++ b/VZERO/AliVZEROhit.h @@ -3,6 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +/* $Id$ */ //////////////////////////////////////////////// // Manager and hits classes for set : VZERO // diff --git a/VZERO/AliVZEROv0.cxx b/VZERO/AliVZEROv0.cxx index b7bc025b604..dab8db3410c 100755 --- a/VZERO/AliVZEROv0.cxx +++ b/VZERO/AliVZEROv0.cxx @@ -13,6 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ ////////////////////////////////////////////////////////////////////// // // @@ -23,39 +24,35 @@ // // ////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include + #include #include - -#include -#include +#include #include +#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "AliVZEROv0.h" -#include "AliRun.h" +#include "ABSOConst.h" +#include "ABSOSHILConst.h" #include "AliMagF.h" -#include "AliVZEROhit.h" +#include "AliRun.h" #include "AliVZEROdigit.h" -#include -#include - -#include -#include "TObjectTable.h" - -#include "AliConst.h" -#include "ABSOSHILConst.h" -#include "ABSOConst.h" -#include "TLorentzVector.h" +#include "AliVZEROhit.h" +#include "AliVZEROv0.h" ClassImp(AliVZEROv0) @@ -773,7 +770,8 @@ void AliVZEROv0::BuildGeometry() TPGON *V0CA = new TPGON("V0CA", "V0CA", "void",parbox[0], parbox[1], - Int_t(parbox[2]),Int_t(parbox[3]) ); + static_cast(parbox[2]), + static_cast(parbox[3])); V0CA->DefineSection( 0, parbox[4], parbox[5], parbox[6] ); V0CA->DefineSection( 1, parbox[7], parbox[8], parbox[9] ); @@ -795,7 +793,8 @@ void AliVZEROv0::BuildGeometry() parbox[9] = r0; TPGON *V0IR = new TPGON("V0IR","V0IR","void", parbox[0], parbox[1], - Int_t(parbox[2]),Int_t(parbox[3]) ); + static_cast(parbox[2]), + static_cast(parbox[3])); V0IR->DefineSection( 0, parbox[4], parbox[5], parbox[6] ); V0IR->DefineSection( 1, parbox[7], parbox[8], parbox[9] ); @@ -812,7 +811,9 @@ void AliVZEROv0::BuildGeometry() parbox[9] = r5 + 1.0; TPGON *V0ER = new TPGON("V0ER","V0ER","void", parbox[0], parbox[1], - Int_t(parbox[2]),Int_t(parbox[3]) ); + static_cast(parbox[2]), + static_cast(parbox[3])); + V0ER->DefineSection( 0, parbox[4], parbox[5], parbox[6] ); V0ER->DefineSection( 1, parbox[7], parbox[8], parbox[9] ); @@ -1530,8 +1531,8 @@ void AliVZEROv0::MakeBranch(Option_t *option) const char *H = strstr(option,"H"); - if (fHits && gAlice->TreeH() && H) { - gAlice->TreeH()->Branch(branchname,&fHits, fBufferSize); + if (fHits && TreeH() && H) { + TreeH()->Branch(branchname,&fHits, fBufferSize); printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname); } diff --git a/VZERO/AliVZEROv2.cxx b/VZERO/AliVZEROv2.cxx index 972115776ea..b34e6345593 100755 --- a/VZERO/AliVZEROv2.cxx +++ b/VZERO/AliVZEROv2.cxx @@ -13,6 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ ////////////////////////////////////////////////////////////////////// // // @@ -25,42 +26,38 @@ // // ////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include +#include +#include +#include + +#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include +#include #include -#include +#include #include -#include -#include - -#include -#include -#include -#include -#include -#include +#include +#include +#include -#include "AliVZEROv2.h" -#include "AliRun.h" +#include "AliLoader.h" #include "AliMagF.h" -#include "AliVZEROhit.h" +#include "AliRun.h" #include "AliVZEROdigit.h" -#include -#include - -#include -#include -#include "TObjectTable.h" - -#include "AliConst.h" -#include "TLorentzVector.h" +#include "AliVZEROhit.h" +#include "AliVZEROv2.h" ClassImp(AliVZEROv2) @@ -1113,15 +1110,15 @@ void AliVZEROv2::MakeBranch(Option_t *option) const char *H = strstr(option,"H"); - if (fHits && gAlice->TreeH() && H) { - gAlice->TreeH()->Branch(branchname,&fHits, fBufferSize); + if (fHits && TreeH() && H) { + TreeH()->Branch(branchname,&fHits, fBufferSize); printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname); } const char *D = strstr(option,"D"); // - if (fDigits && gAlice->TreeD() && D) { - gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize); + if (fDigits && fLoader->TreeD() && D) { + fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize); printf("* AliDetector::MakeBranch * Making Branch %s for digits\n",branchname); } diff --git a/ZDC/AliGenZDC.cxx b/ZDC/AliGenZDC.cxx index b797c95ac14..73e10b08003 100644 --- a/ZDC/AliGenZDC.cxx +++ b/ZDC/AliGenZDC.cxx @@ -13,47 +13,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.12 2002/11/21 20:05:22 alibrary -Removing AliMC and AliMCProcess +/* $Id$ */ -Revision 1.11 2001/11/11 17:27:50 hristov -Minor corrections - -Revision 1.10 2001/09/26 16:00:47 coppedis -Minor change - -Revision 1.8 2001/04/20 10:10:25 coppedis -Minor changes - -Revision 1.7 2001/03/15 16:13:28 coppedis -Code review - -Revision 1.6 2000/11/30 17:16:14 coppedis -Changes suggested by fca - -Revision 1.5 2000/11/22 11:30:12 coppedis -Major code revision - -Revision 1.4 2000/10/05 08:02:47 fca -Correction of the generator direction - -Revision 1.3 2000/10/02 21:28:20 fca -Removal of useless dependecies via forward declarations - -Revision 1.2 2000/07/11 11:12:34 fca -Some syntax corrections for non standard HP aCC - -Revision 1.1 2000/07/10 13:58:01 fca -New version of ZDC from E.Scomparin & C.Oppedisano - -Revision 1.7 2000/01/19 17:17:40 fca - -Revision 1.6 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ #include #include diff --git a/ZDC/AliZDC.cxx b/ZDC/AliZDC.cxx index 0266e746975..809ad7199ab 100644 --- a/ZDC/AliZDC.cxx +++ b/ZDC/AliZDC.cxx @@ -13,95 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.32 2002/10/22 15:35:30 alibrary -Introducing Riostream.h - -Revision 1.31 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.28.6.2 2002/07/24 10:10:13 alibrary -Updating VirtualMC - -Revision 1.28.6.1 2002/06/10 15:29:36 hristov -Merged with v3-08-02 - -Revision 1.30 2002/06/07 10:19:23 coppedis -TreeS, TreeD and TreeR for ZDC can be written in a separate file - -Revision 1.29 2002/06/04 08:17:04 coppedis -Reconstruction method improved - -Revision 1.28 2002/02/04 09:18:08 coppedis -Merging and reconstruction code review - -Revision 1.26.2.2 2001/11/12 18:41:44 hristov -All the changes from the head are merged to the release - -Revision 1.27 2001/10/21 18:27:45 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.26 2001/10/04 14:30:28 coppedis -Event merging for ZDC - -Revision 1.25 2001/10/04 14:24:15 coppedis -Event merging for ZDC - -Revision 1.24 2001/09/26 16:03:41 coppedis -Merging implemented - -Revision 1.23 2001/05/15 13:44:57 coppedis -Changes in AddHit method - -Revision 1.22 2001/05/14 09:53:32 coppedis -Adding functions ZMin and ZMax - -Revision 1.21 2001/04/20 10:05:02 coppedis -Minor changes - -Revision 1.20 2001/03/26 13:39:20 coppedis -Comment prints - -Revision 1.19 2001/03/26 09:10:23 coppedis -Corrected bug in constructor (fIshunt has to be =1) - -Revision 1.18 2001/03/20 08:21:55 coppedis -ZDC needs PIPE, ABSO, DIPO and SHIL - -Revision 1.17 2001/03/16 16:18:03 coppedis -Correction for superposition of ZDC volumes with MUON arm one - -Revision 1.16 2001/03/15 16:01:11 coppedis -Code review - -Revision 1.15 2001/01/26 19:56:27 hristov -Major upgrade of AliRoot code - -Revision 1.14 2000/12/12 13:17:01 coppedis -Minor corrections suggested by P. Hristov - -Revision 1.12 2000/12/01 08:19:01 coppedis -Adding a message error if ZDC is constructed without DIPO - -Revision 1.11 2000/11/30 17:21:03 coppedis -Introduce hit array fStHits reset only at the end of the event (for digitization) - -Revision 1.10 2000/11/22 11:32:58 coppedis -Major code revision - -Revision 1.9 2000/10/02 21:28:20 fca -Removal of useless dependecies via forward declarations - -Revision 1.8 2000/07/10 13:58:01 fca -New version of ZDC from E.Scomparin & C.Oppedisano - -Revision 1.7 2000/01/19 17:17:40 fca - -Revision 1.6 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -117,24 +29,28 @@ Introduction of the Copyright and cvs Log // --- ROOT system #include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include // --- AliRoot header files +#include "AliDetector.h" #include "AliZDC.h" +#include "AliZDCDigit.h" #include "AliZDCHit.h" #include "AliZDCMergedHit.h" #include "AliZDCMerger.h" -#include "AliZDCDigit.h" #include "AliZDCReco.h" -#include "AliDetector.h" + #include "AliConst.h" -#include "AliRun.h" + #include "AliHeader.h" +#include "AliLoader.h" +#include "AliRun.h" ClassImp(AliZDC) @@ -328,15 +244,20 @@ Float_t AliZDC::ZMax(void) const char branchname[10]; sprintf(branchname,"%s",GetName()); + + const char *cH = strstr(opt,"H"); + + if (cH && fLoader->TreeH()) + fHits = new TClonesArray("AliZDCHit",1000); AliDetector::MakeBranch(opt); const char *cS = strstr(opt,"S"); - if (gAlice->TreeS() && cS) { + if (fLoader->TreeS() && cS) { if(fMergedHits!=0) fMergedHits->Clear(); else fMergedHits = new TClonesArray ("AliZDCMergedHit",1000); - MakeBranchInTree(gAlice->TreeS(), + MakeBranchInTree(fLoader->TreeS(), branchname, &fMergedHits, fBufferSize, file) ; printf("* AliZDC::MakeBranch * Making Branch %s for SDigits\n\n",branchname); } @@ -344,10 +265,10 @@ Float_t AliZDC::ZMax(void) const const char *cD = strstr(opt,"D"); - if (gAlice->TreeD() && cD) { + if (fLoader->TreeD() && cD) { if(fDigits!=0) fDigits->Clear(); else fDigits = new TClonesArray ("AliZDCDigit",1000); - MakeBranchInTree(gAlice->TreeD(), + MakeBranchInTree(fLoader->TreeD(), branchname, &fDigits, fBufferSize, file) ; printf("* AliZDC::MakeBranch * Making Branch %s for Digits\n\n",branchname); } @@ -370,6 +291,7 @@ Float_t AliZDC::ZMax(void) const const Int_t kBufferSize = 4000; char branchname[20]; sprintf(branchname,"%s",GetName()); + if (fMergedHits==0x0) fMergedHits = new TClonesArray("AliZDCMergedHit",1000); MakeBranchInTree(treeS, branchname, &fMergedHits, kBufferSize, file) ; printf("* AliZDC::MakeBranch * Making Branch %s for SDigits\n\n",branchname); @@ -381,6 +303,7 @@ Float_t AliZDC::ZMax(void) const const Int_t kBufferSize = 4000; char branchname[20]; sprintf(branchname,"%s",GetName()); + if (fDigits == 0x0) fDigits = new TClonesArray("AliZDCDigit",1000); MakeBranchInTree(treeD, branchname, &fDigits, kBufferSize, file) ; printf("* AliZDC::MakeBranch * Making Branch %s for Digits\n\n",branchname); @@ -410,7 +333,7 @@ void AliZDC::Hits2SDigits() Float_t MHits[7]; fNMergedhits = 0; - TTree *treeH = gAlice->TreeH(); + TTree *treeH = TreeH(); Int_t ntracks = (Int_t) treeH->GetEntries(); gAlice->ResetHits(); @@ -448,16 +371,21 @@ void AliZDC::Hits2SDigits() fMerger -> InitMerging(); // SDigits tree - TTree *treeS = 0; - char treeSName[20]; - sprintf(treeSName,"TreeS%d",fMerger->EvNum()); - if(gAlice->GetTreeSFile()){ - gAlice->GetTreeSFile()->cd(); - treeS = (TTree*)gAlice->GetTreeSFile()->Get(treeSName); - } - else { - treeS = gAlice->TreeS(); - } + + + + TTree *treeS = fLoader->TreeS(); + if (treeS == 0x0) + { + Int_t retval = fLoader->LoadSDigits(); + if (retval) + { + Error("Hits2SDigits","Error while loading S. Digits"); + return; + } + treeS = fLoader->TreeS(); + } + if(!treeS){ printf("\n ERROR -> Can't find TreeS%d in background file\n",fMerger->EvNum()); } @@ -507,15 +435,21 @@ void AliZDC::SDigits2Digits() fMerger->Digitize(fNMergedhits, fMergedHits); // Digits tree - TTree *treeD = 0; - char treeDName[20]; - sprintf(treeDName,"TreeD%d",fMerger->EvNum()); - if(gAlice->GetTreeDFile()){ - treeD = (TTree*)gAlice->GetTreeDFile()->Get(treeDName); - } - else { - treeD = gAlice->TreeD(); - } + + TTree *treeD = fLoader->TreeD(); + if (treeD == 0x0) + { + Int_t retval = fLoader->LoadDigits(); + if (retval) + { + Error("SDigits2Digits","Error while loading Digits"); + return; + } + treeD = fLoader->TreeD(); + } + + + if(!treeD){ printf("\n ERROR -> Can't find TreeD%d in background file\n",fMerger->EvNum()); } @@ -547,15 +481,19 @@ void AliZDC::Digits2Reco() AliDetector *ZDC = gAlice->GetDetector("ZDC"); TClonesArray *ZDCdigits = ZDC->Digits(); - TTree *TD = 0; - char treeDame[20]; - sprintf(treeDame,"TreeD%d",fMerger->EvNum()); - if(gAlice->GetTreeDFile()){ - TD = (TTree*)gAlice->GetTreeDFile()->Get(treeDame); - } - else { - TD = gAlice->TreeD(); - } + TTree *TD = fLoader->TreeD(); + if (TD == 0x0) + { + Int_t retval = fLoader->LoadDigits(); + if (retval) + { + Error("Digits2Reco","Error while loading Digits"); + return; + } + TD = fLoader->TreeD(); + } + + if(TD){ char brname[20]; sprintf(brname,"%s",ZDC->GetName()); diff --git a/ZDC/AliZDC.h b/ZDC/AliZDC.h index 1a7f2bd9b97..e3db9c8b2e8 100644 --- a/ZDC/AliZDC.h +++ b/ZDC/AliZDC.h @@ -51,12 +51,12 @@ protected: AliZDCMerger *fMerger; // ! pointer to merger Int_t fNMergedhits; // Number of Merged hits for background - TClonesArray *fMergedHits; // TCA for "merged" hits + TClonesArray *fMergedHits; //! TCA for "merged" hits Int_t fNRecPoints; // Number of RecPoints - TClonesArray *fRecPoints; // List of RecPoints + TClonesArray *fRecPoints; //! List of RecPoints - ClassDef(AliZDC,2) // Zero Degree Calorimeter base class + ClassDef(AliZDC,3) // Zero Degree Calorimeter base class }; #endif diff --git a/ZDC/AliZDCMerger.h b/ZDC/AliZDCMerger.h index ee72fdad623..d6102f6de4c 100644 --- a/ZDC/AliZDCMerger.h +++ b/ZDC/AliZDCMerger.h @@ -65,7 +65,7 @@ protected: Int_t fFreeSpn; // Signal event number x spectator n Int_t fFreeSpp; // Signal event number x spectator p - char *fFnSpecn; // Spectator n file name + char *fFnSpecn; // Spectator n file name TFile *fSpecnFile; // Pointer to signal file -> spectator n char *fFnSpecp; // Spectator p file name TFile *fSpecpFile; // Pointer to signal file -> spectator p diff --git a/ZDC/AliZDCv1.cxx b/ZDC/AliZDCv1.cxx index 383ee320bed..3cf2721d450 100644 --- a/ZDC/AliZDCv1.cxx +++ b/ZDC/AliZDCv1.cxx @@ -13,104 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.28 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.27.8.1 2002/06/10 15:29:36 hristov -Merged with v3-08-02 - -Revision 1.27 2001/09/26 16:06:59 coppedis -Some function moved to AliZDC - -Revision 1.26 2001/06/13 11:10:55 coppedis -Minor changes - -Revision 1.25 2001/06/12 13:45:05 coppedis -TDI in correct position and minor correction - -Revision 1.24 2001/05/16 14:57:28 alibrary -New files for folders and Stack - -Revision 1.23 2001/05/14 09:51:50 coppedis -Change in AddHit suggested by J. Chudoba - -Revision 1.22 2001/05/05 13:33:19 coppedis -Changes in StepManager to speed simulation - -Revision 1.21 2001/05/02 11:54:34 enrico -Minor change - -Revision 1.20 2001/05/02 10:33:11 coppedis -Modify tmaxfd in media definition - -Revision 1.19 2001/04/27 08:35:01 coppedis -Remove some lines for proton acceptance studies - -Revision 1.18 2001/04/20 10:08:45 coppedis -Preliminary version of optics 6.2 - Insertion of TDI - -Revision 1.17 2001/03/16 16:18:10 coppedis -Correction for superposition of ZDC volumes with MUON arm one - -Revision 1.16 2001/03/15 16:12:04 coppedis -Code review - -Revision 1.15 2001/03/12 17:47:56 hristov -Changes needed on Sun with CC 5.0 - -Revision 1.14 2001/02/23 16:48:28 coppedis -Correct bug in ZEM hit definition - -Revision 1.13 2001/02/07 18:07:41 coppedis -Modif for splitting - -Revision 1.12 2001/01/26 19:56:27 hristov -Major upgrade of AliRoot code - -Revision 1.11 2001/01/16 07:43:33 hristov -Initialisation of ZDC hits - -Revision 1.10 2000/12/14 15:20:02 coppedis -Hits2Digits method for digitization - -Revision 1.9 2000/12/13 10:33:49 coppedis -Prints only if fDebug==1 - -Revision 1.8 2000/12/12 14:10:02 coppedis -Correction suggested by M. Masera - -Revision 1.7 2000/11/30 17:23:47 coppedis -Remove first corrector dipole and introduce digitization - -Revision 1.6 2000/11/22 11:33:10 coppedis -Major code revision - -Revision 1.5 2000/10/02 21:28:20 fca -Removal of useless dependecies via forward declarations - -Revision 1.3.2.1 2000/08/24 09:25:47 hristov -Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin - -Revision 1.4 2000/08/24 09:23:59 hristov -Bug in ZDC geometry corrected by E.Scomparin - -Revision 1.3 2000/07/12 06:59:16 fca -Fixing dimension of hits array - -Revision 1.2 2000/07/11 11:12:34 fca -Some syntax corrections for non standard HP aCC - -Revision 1.1 2000/07/10 13:58:01 fca -New version of ZDC from E.Scomparin & C.Oppedisano - -Revision 1.7 2000/01/19 17:17:40 fca - -Revision 1.6 1999/09/29 09:24:35 fca -Introduction of the Copyright and cvs Log - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -125,22 +28,22 @@ Introduction of the Copyright and cvs Log // --- ROOT system #include -#include +#include #include +#include #include #include #include - +#include // --- AliRoot classes -#include "AliZDCv1.h" -#include "AliZDCHit.h" -#include "AliRun.h" +#include "AliConst.h" #include "AliDetector.h" #include "AliMagF.h" -#include "AliConst.h" #include "AliPDG.h" -#include "TLorentzVector.h" +#include "AliRun.h" +#include "AliZDCHit.h" +#include "AliZDCv1.h" ClassImp(AliZDCv1) diff --git a/ZDC/AliZDCv2.cxx b/ZDC/AliZDCv2.cxx index 9ba88a9cb28..d4493617bd7 100644 --- a/ZDC/AliZDCv2.cxx +++ b/ZDC/AliZDCv2.cxx @@ -13,46 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.11 2003/04/04 11:33:34 coppedis -Bug in geometry corrected - -Revision 1.10 2003/03/25 14:18:30 coppedis -Changes in ZDC geometry to avoid overlaps with other detectors - -Revision 1.9 2002/11/21 20:05:22 alibrary -Removing AliMC and AliMCProcess - -Revision 1.8 2002/10/14 14:57:44 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.7.8.1 2002/06/10 15:29:36 hristov -Merged with v3-08-02 - -Revision 1.7 2001/10/04 14:33:43 coppedis -Second EM ZDC added at 7.35 m from IP - -Revision 1.6 2001/09/26 16:07:40 coppedis -Changes in StepManager suggested by J.Chudoba - -Revision 1.5 2001/06/15 14:51:39 coppedis -Geometry bug corrected - -Revision 1.4 2001/06/13 11:17:49 coppedis -Bug corrected - -Revision 1.3 2001/06/13 11:11:02 coppedis -Minor changes - -Revision 1.2 2001/06/12 13:45:11 coppedis -TDI in correct position and minor correction - -Revision 1.1 2001/05/14 09:57:39 coppedis -A different geometry for the ZDCs - - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////// // // @@ -68,22 +29,22 @@ A different geometry for the ZDCs // --- ROOT system #include -#include +#include #include +#include #include #include #include - +#include // --- AliRoot classes -#include "AliZDCv2.h" -#include "AliZDCHit.h" -#include "AliRun.h" +#include "AliConst.h" #include "AliDetector.h" #include "AliMagF.h" -#include "AliConst.h" #include "AliPDG.h" -#include "TLorentzVector.h" +#include "AliRun.h" +#include "AliZDCHit.h" +#include "AliZDCv2.h" ClassImp(AliZDCv2) diff --git a/build/Makefile.Darwin b/build/Makefile.Darwin index 7636b356537..43aa6df9405 100644 --- a/build/Makefile.Darwin +++ b/build/Makefile.Darwin @@ -32,7 +32,7 @@ LDFLAGS = $(OPT) SHLD := $(LD) SOFLAGS := -bundle -flat_namespace -undefined suppress -SHLIB := -lg2c +#SHLIB := -lg2c SHLIB := SOEXT := so @@ -57,7 +57,7 @@ GLIBS = -L/usr/X11R6/lib -lX11 #System libraries SYSLIBS = -ldl -EXEFLAGS+= -Xlinker -bind_at_load -Xlinker -m -lg2c +EXEFLAGS+= -Xlinker -bind_at_load -Xlinker -m #-lg2c diff --git a/build/Makefile.icc b/build/Makefile.icc index 6881b427172..dc262783a22 100644 --- a/build/Makefile.icc +++ b/build/Makefile.icc @@ -31,7 +31,7 @@ LD = icc LDFLAGS = $(OPT) SHLD = $(LD) -SOFLAGS = -Wl,-soname,$(notdir $@) -shared -O +SOFLAGS = -Wl,-soname,$$TMPLIB -shared -O SHLIB = SOEXT = so diff --git a/build/header.tpl b/build/header.tpl index cf644fa1871..2f39e91ae3e 100644 --- a/build/header.tpl +++ b/build/header.tpl @@ -25,8 +25,10 @@ ELIBSDIR:= PACKFFLAGS:= PACKCXXFLAGS:= PACKCFLAGS:= +PACKDYFLAGS:= +PACKSOFLAGS:= EXPORT:= EHDRS:= CINTHDRS:= ARLIBS:= -SHLIBS:= \ No newline at end of file +SHLIBS:= diff --git a/build/makeg2cso.sh b/build/makeg2cso.sh new file mode 100755 index 00000000000..2bfd73026a2 --- /dev/null +++ b/build/makeg2cso.sh @@ -0,0 +1,10 @@ +#!/bin/sh +out=$ALICE_ROOT/lib/tgt_$ALICE_TARGET/libg2c_sh +cd /tmp +rm -rf g2c ; mkdir g2c ; cd g2c +ar -x /usr/lib/gcc/darwin/default/libg2c.a +export MACOSX_DEPLOYMENT_TARGET=10.2 +rm -f ${out}.so ${out}.dylib +g++ -bundle -flat_namespace -undefined suppress -o ${out}.so `ls *.o | grep -v buggy` +g++ -dynamiclib -flat_namespace -undefined suppress -single_module -o ${out}.dylib `ls *.o | grep -v buggy` + diff --git a/build/module.dep b/build/module.dep index 613b9f425e6..e11f02f7058 100644 --- a/build/module.dep +++ b/build/module.dep @@ -38,6 +38,5 @@ Flugg/module.mk: Flugg/libFlugg.pkg VZERO/module.mk: VZERO/libVZERO.pkg EPEMGEN/module.mk: EPEMGEN/libEPEMGEN.pkg EPEMGEN/libdummyepemgen.pkg TEPEMGEN/module.mk: TEPEMGEN/libTEPEMGEN.pkg -TPHIC/module.mk: TPHIC/libTPHIC.pkg diff --git a/build/module.tpl b/build/module.tpl index e549cc55996..85be958e7c7 100644 --- a/build/module.tpl +++ b/build/module.tpl @@ -18,6 +18,20 @@ else @PACKAGE@CXXFLAGS:=$(PACKCXXFLAGS) endif +ifndef PACKSOFLAGS +@PACKAGE@SOFLAGS:=$(SOFLAGS) +else +@PACKAGE@SOFLAGS:=$(PACKSOFLAGS) +endif + +ifdef DYEXT +ifndef PACKDYFLAGS +@PACKAGE@DYFLAGS:=$(DYFLAGS) +else +@PACKAGE@DYFLAGS:=$(PACKDYFLAGS) +endif +endif + ifndef PACKDCXXFLAGS ifeq ($(PLATFORM),linuxicc) @PACKAGE@DCXXFLAGS:=$(filter-out -O%,$(CXXFLAGS)) -O0 @@ -162,6 +176,8 @@ endif @cp $^ $@ endif +#------------------------------------------------------------------------ + $(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk ifndef ALIQUIET @echo "***** Linking library $@ *****" @@ -169,10 +185,11 @@ endif $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \ export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \ find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\ - rm -f $(CURDIR)/$@ ;\ - $(SHLD) $(SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB);\ - cd $(CURDIR) ; rm -rf $$TMPDIR - $(MUTE)chmod a-w $@ + rm -f $(CURDIR)/$@ ;\ + TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\ + $(SHLD) $(@PACKAGE@SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB); + $(MUTE)chmod a-w $(CURDIR)/$@ ;\ + rm -rf $$TMPDIR ifneq ($(DYEXT),) $(@PACKAGE@DLIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk @@ -188,6 +205,8 @@ endif rm -rf $$TMPDIR endif +#------------------------------------------------------------------------ + $(@PACKAGE@ALIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk ifndef ALIQUIET @echo "***** Linking static library $@ *****" @@ -196,7 +215,7 @@ endif export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \ find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\ rm -f $(CURDIR)/$@ ;\ - $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(ALLIB);\ + $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O)) $(notdir @PACKAGE@DO) $(ALLIB);\ cd $(CURDIR) ; rm -rf $$TMPDIR $(MUTE)chmod a-w $@ @@ -216,7 +235,6 @@ ifndef ALIQUIET @echo "***** Creating $@ *****"; endif @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) - @rm -f $(patsubst %.cxx,%.d, $@) $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) $(@PACKAGE@DO): $(@PACKAGE@DS) diff --git a/macros/Config.C b/macros/Config.C index 3b1eddd444f..63cd7334221 100644 --- a/macros/Config.C +++ b/macros/Config.C @@ -24,9 +24,17 @@ void Config() if (!gSystem->Getenv("CONFIG_FILE")) { - TFile *rootfile = new TFile("galice.root", "recreate"); - - rootfile->SetCompressionLevel(2); + cout<<"Config.C: Creating Run Loader ..."<Fatal("Config.C","Can not instatiate the Run Loader"); + return; + } + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(3); + gAlice->SetRunLoader(rl); } TGeant3 *geant3 = (TGeant3 *) gMC; @@ -81,19 +89,28 @@ void Config() int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES")); } else { - int nParticles = 50; + int nParticles = 30; } - AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles); - - gener->SetMomentumRange(0, 999); - gener->SetPhiRange(0, 360); + AliGenCocktail *gener = new AliGenCocktail(); + gener->SetPhiRange(220, 320); // Set pseudorapidity range from -8 to 8. - Float_t thmin = EtaToTheta(8); // theta min. <---> eta max - Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min + Float_t thmin = EtaToTheta(0.12); // theta min. <---> eta max + Float_t thmax = EtaToTheta(-0.12); // theta max. <---> eta min gener->SetThetaRange(thmin,thmax); gener->SetOrigin(0, 0, 0); //vertex position gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position + + AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles); + hijingparam->SetMomentumRange(0.2, 999); + gener->AddGenerator(hijingparam,"HIJING PARAM",1); + +// AliGenBox *genbox = new AliGenBox(nParticles); +// genbox->SetPart(22); +// genbox->SetPtRange(0.3, 10.00); +// gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1); gener->Init(); + + // // Activate this line if you want the vertex smearing to happen // track by track @@ -101,32 +118,31 @@ void Config() //gener->SetVertexSmear(perTrack); // Field (L3 0.4 T) AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1); - rootfile->cd(); gAlice->SetField(field); - Int_t iABSO = 1; + Int_t iABSO = 0; Int_t iDIPO = 1; - Int_t iFMD = 1; + Int_t iFMD = 0; Int_t iFRAME = 1; Int_t iHALL = 1; Int_t iITS = 1; Int_t iMAG = 1; - Int_t iMUON = 1; + Int_t iMUON = 0; Int_t iPHOS = 1; Int_t iPIPE = 1; - Int_t iPMD = 1; - Int_t iRICH = 1; + Int_t iPMD = 0; + Int_t iRICH = 0; Int_t iSHIL = 1; - Int_t iSTART = 1; - Int_t iTOF = 1; + Int_t iSTART = 0; + Int_t iTOF = 0; Int_t iTPC = 1; - Int_t iTRD = 1; - Int_t iZDC = 1; - Int_t iEMCAL = 1; + Int_t iTRD = 0; + Int_t iZDC = 0; + Int_t iEMCAL = 0; Int_t iCRT = 0; - Int_t iVZERO = 1; - + Int_t iVZERO = 0; + rl->CdGAFile(); //=================== Alice BODY parameters ============================= AliBODY *BODY = new AliBODY("BODY", "Alice envelop"); @@ -252,7 +268,7 @@ void Config() // ITSgeometry.tme) in a format understandable to the CAD system EUCLID. // The default (=0) means that you dont want to use this facility. // - ITS->SetEUCLID(0); + ITS->SetEUCLID(0); } if (iTPC) @@ -278,9 +294,8 @@ void Config() AliTPC *TPC = new AliTPCv2("TPC", "Default"); // All sectors included - TPC->SetSecAL(-1); TPC->SetSecAU(-1); - + TPC->SetSecAL(-1); } @@ -366,7 +381,7 @@ void Config() if (iEMCAL) { //=================== EMCAL parameters ============================ - AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "G56_2_55_19_104_14"); + AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a"); } if (iCRT) diff --git a/macros/ConfigCharmPPR.C b/macros/ConfigCharmPPR.C index 980fa154d25..619ecb2e23b 100644 --- a/macros/ConfigCharmPPR.C +++ b/macros/ConfigCharmPPR.C @@ -11,9 +11,6 @@ void Config() gRandom->SetSeed(seed); cerr<<"Seed for random number generation= "<Load("libgeant321"); - new TGeant3("C++ Interface to Geant3"); //======================================================================= @@ -70,7 +67,7 @@ void Config() AliGenPythia *gener = new AliGenPythia(-1); gener->SetMomentumRange(0,999); - gener->SetPhiRange(0.,360.); + gener->SetPhiRange(-180.,180.); gener->SetThetaRange(0,180); gener->SetYRange(-999,999); //gener->SetPtRange(0,100); diff --git a/macros/ConfigHBT.C b/macros/ConfigHBT.C index 13a4faa820d..806a975d276 100644 --- a/macros/ConfigHBT.C +++ b/macros/ConfigHBT.C @@ -3,16 +3,21 @@ void Config() // Set Random Number seed // gRandom->SetSeed(12345); - // libraries required by geant321 - gSystem->Load("libgeant321"); - new TGeant3("C++ Interface to Geant3"); if (!gSystem->Getenv("CONFIG_FILE")) { - TFile *rootfile = new TFile("galice.root", "recreate"); - - rootfile->SetCompressionLevel(2); + cout<<"Config.C: Creating Run Loader ..."<Fatal("Config.C","Can not instatiate the Run Loader"); + return; + } + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(6); + gAlice->SetRunLoader(rl); } TGeant3 *geant3 = (TGeant3 *) gMC; @@ -114,8 +119,8 @@ void Config() g3->SetSigma(0.0, 0.0, 0.0); //g3->SetEtaCutRange(-4,4); - AliMevSimParticle *piPlus = new AliMevSimParticle(kPiPlus, 3000, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0); - AliMevSimParticle *piMinus = new AliMevSimParticle(kPiMinus, 3000, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0); + AliMevSimParticle *piPlus = new AliMevSimParticle(kPiPlus, 100, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0); + AliMevSimParticle *piMinus = new AliMevSimParticle(kPiMinus, 100, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0); //AliMevSimParticle *KPlus = new AliMevSimParticle(kKPlus, 10, 0, 0.25, 0.0, 2, 0.15, 0.0, 0.0 ); //AliMevSimParticle *KMinus = new AliMevSimParticle(kKMinus, 10, 0, 0.25, 0.0, 2, 0.15, 0.0, 0.0 ); //AliMevSimParticle *protonPlus = new AliMevSimParticle(kProton, 3, 0, 0.4, 0.0, 2, 0.15, 0.0, 0.0); @@ -135,9 +140,9 @@ void Config() hbtp->SetRefControl(2); hbtp->SetSwitch1D(1); hbtp->SetSwitch3D(1); - hbtp->SetSwitchCoulomb(0); + hbtp->SetSwitchCoulomb(1); hbtp->SetSwitchCoherence(0); - hbtp->SetSwitchFermiBose(1); + hbtp->SetSwitchFermiBose(-1); hbtp->SetDeltap(0.1); hbtp->SetDelChi(0.1); hbtp->SetLambda(0.5); @@ -151,7 +156,7 @@ void Config() hbtp->SetPtRange(0.1,0.98); hbtp->SetPIDs(211,-211); //pi+ pi- hbtp->SetSwitchType(3); // fit both the like and unlike pair correl - + hbtp->SetMaxIterations(300); /***********************************************************************************/ // gener->AddGenerator(g2,"HIJING PARAMETRIZATION",1); @@ -427,7 +432,7 @@ void Config() if (iEMCAL && !iRICH) { //=================== EMCAL parameters ============================ - AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "G56_2_55_19_104_14"); + AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a"); } if (iSTART) diff --git a/macros/Config_gener.C b/macros/Config_gener.C index 4fab0cee360..e01dad6202a 100644 --- a/macros/Config_gener.C +++ b/macros/Config_gener.C @@ -4,14 +4,11 @@ enum gentype_t {hijing, hijingParam, gun, box, pythia, gentype_t gentype=param4; -Int_t ntracks=1; +ntracks=1; void Config() { - // libraries required by geant321 - gSystem->Load("libgeant321"); - new TGeant3("C++ Interface to Geant3"); //======================================================================= @@ -137,7 +134,7 @@ geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); // momentum range gener->SetMomentumRange(0,999); // phi range - gener->SetPhiRange(0,360); + gener->SetPhiRange(-180,180); // theta range gener->SetThetaRange(0,180.); // select flavor (0: no, 4: charm+beauty, 5:beauty) @@ -157,7 +154,7 @@ geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); AliGenPythia *gener = new AliGenPythia(-1); // final state kinematic cuts gener->SetMomentumRange(0,999); - gener->SetPhiRange(0, 360); + gener->SetPhiRange(-180,180); gener->SetThetaRange(0., 180.); gener->SetYRange(-10,10); gener->SetPtRange(0,100); @@ -174,7 +171,7 @@ geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); // MRS_G // CTEQ_2pM // CTEQ_4M - gener->SetStrucFunc(kGRVHO); + gener->SetStrucFunc(kGRV_HO); // Select corection for nuclear structure functions // gener->SetNuclei(208,208); // @@ -201,7 +198,7 @@ geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); new AliGenParam(ntracks, AliGenMUONlib::kUpsilon); gener->SetMomentumRange(0,999); gener->SetPtRange(0,999); - gener->SetPhiRange(0, 360); + gener->SetPhiRange(-180, 180); gener->SetYRange(2.5,4); gener->SetCutOnChild(1); gener->SetChildThetaRange(2,9); @@ -235,7 +232,7 @@ geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); AliGenGSIlib::kUpsilon, "MUON"); gener->SetMomentumRange(0,999); gener->SetPtRange(0,999); - gener->SetPhiRange(0, 360); + gener->SetPhiRange(-180, 180); gener->SetYRange(2.5,4); gener->SetCutOnChild(1); gener->SetChildThetaRange(2,9); diff --git a/macros/Config_pp.C b/macros/Config_pp.C index 711335d1fb3..fa52b1b795a 100644 --- a/macros/Config_pp.C +++ b/macros/Config_pp.C @@ -55,9 +55,6 @@ void Config() // END OF TEMPORARY */ - // libraries required by geant321 - gSystem->Load("libgeant321"); - new TGeant3("C++ Interface to Geant3"); if (!gSystem->Getenv("CONFIG_FILE")) @@ -420,7 +417,7 @@ void Config() if (iEMCAL!=0 && iRICH==0) { //=================== START parameters ============================ - AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "G56_2_55_19_104_14"); + AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a"); } if (iSTART) @@ -448,7 +445,7 @@ AliGenerator* GeneratorFactory(PprRun_t run) { comment = comment.Append(":HIJINGparam test 50 particles"); AliGenHIJINGpara *gener = new AliGenHIJINGpara(50); gener->SetMomentumRange(0, 999999.); - gener->SetPhiRange(0., 360.); + gener->SetPhiRange(-180., 180.); // Set pseudorapidity range from -8 to 8. Float_t thmin = EtaToTheta(8); // theta min. <---> eta max Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min @@ -458,11 +455,11 @@ AliGenerator* GeneratorFactory(PprRun_t run) { comment = comment.Append(":Pythia p-p @ 14 TeV"); AliGenPythia *gener = new AliGenPythia(-1); gener->SetMomentumRange(0,999999); - gener->SetPhiRange(0, 360); + gener->SetPhiRange(-180,180); gener->SetThetaRange(0., 180.); gener->SetYRange(-12,12); gener->SetPtRange(0,1000); - gener->SetStrucFunc(kCTEQ4L); + gener->SetStrucFunc(kCTEQ_4L); gener->SetProcess(kPyMb); gener->SetEnergyCMS(14000.); break; @@ -470,7 +467,7 @@ AliGenerator* GeneratorFactory(PprRun_t run) { comment = comment.Append(":HIJINGparam N=8000"); AliGenHIJINGpara *gener = new AliGenHIJINGpara(86030); gener->SetMomentumRange(0, 999999.); - gener->SetPhiRange(0., 360.); + gener->SetPhiRange(-180., 180.); // Set pseudorapidity range from -8 to 8. Float_t thmin = EtaToTheta(8); // theta min. <---> eta max Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min @@ -480,7 +477,7 @@ AliGenerator* GeneratorFactory(PprRun_t run) { comment = comment.Append("HIJINGparam N=4000"); AliGenHIJINGpara *gener = new AliGenHIJINGpara(43015); gener->SetMomentumRange(0, 999999.); - gener->SetPhiRange(0., 360.); + gener->SetPhiRange(-180., 180.); // Set pseudorapidity range from -8 to 8. Float_t thmin = EtaToTheta(8); // theta min. <---> eta max Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min @@ -490,7 +487,7 @@ AliGenerator* GeneratorFactory(PprRun_t run) { comment = comment.Append("HIJINGparam N=2000"); AliGenHIJINGpara *gener = new AliGenHIJINGpara(21507); gener->SetMomentumRange(0, 999999.); - gener->SetPhiRange(0., 360.); + gener->SetPhiRange(-180., 180.); // Set pseudorapidity range from -8 to 8. Float_t thmin = EtaToTheta(8); // theta min. <---> eta max Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min diff --git a/macros/ConvertToNewIO.C b/macros/ConvertToNewIO.C new file mode 100644 index 00000000000..8716d359069 --- /dev/null +++ b/macros/ConvertToNewIO.C @@ -0,0 +1,767 @@ +#ifndef __MAKECINT__ + #ifndef __CINT__ + #include "alles.h" + #include "TInterpreter.h" + #include "TBranchClones.h" + #include "TBranchElement.h" + #include "AliTPCTrackHits.h" + #include "AliTRDtrackHits.h" + #endif +#endif + +void ConvertToNewIO(const char* name) +{ +// AliLoader::SetDebug(); + AliConfig* conf = AliConfig::Instance(); + TClass* detclass = AliDetector::Class(); + void* buff; + Bool_t skipit = kFALSE; + void * pbuf[100]; + TBranch* branches[100]; + Int_t nbranches = 0; + + AliRunLoader* rl = AliRunLoader::Open("galiceNewIO.root","Event","recreate"); + rl->SetCompressionLevel(2); + + AliRun* outAliRun; + + if (gAlice == 0x0) + { + outAliRun = new AliRun("OutgAlice","Output gAlice"); + } + else + { + outAliRun = gAlice; + } + gAlice = 0x0; + + outAliRun->SetRunLoader(rl); + + TFile* infile = TFile::Open(name); + + if (infile == 0x0) + { + ::Error("ConvertToNewIO.C","Can not open input file %s",name); + return; + } + + AliRun* inAliRun = (AliRun*)infile->Get("gAlice"); + + if(inAliRun == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find gAlice in input file"); + return; + } + gAlice = inAliRun; +// inAliRun->GetEvent(0); + + TObjArray* modules = inAliRun->Modules(); + if (modules == 0x0) + { + ::Error("ConvertToNewIO.C","Can not get array with modules from AliRun"); + return; + } + TIter next(modules); + AliModule* module; + while ((module = (AliModule*)next())) + { + outAliRun->AddModule(module); + + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + if (det) + { + ::Info("ConvertToNewIO.C"," Adding %s to RL.",det->GetName()); + conf->Add(det,"Event"); + rl->AddLoader(det); + } + } + + TParticle* particleBuffer = new TParticle(); + /***************************************************/ + /**** Event to Event **************/ + /***************************************************/ + + TTree* treeE = (TTree*)infile->Get("TE"); + if (treeE == 0x0) + { + ::Error("ConvertToNewIO.C","Can not get TreeE from AliRun"); + return; + } + rl->MakeTree("E"); + + AliHeader* inheader = new AliHeader(); + treeE->SetBranchAddress("Header",&inheader); + + Int_t nevents = (Int_t)treeE->GetEntries(); + for (Int_t i = 0; iSetEventNumber(i); + treeE->GetEvent(i); + /*****************************************/ + /* H E A D E R */ + /*****************************************/ + + ::Info("ConvertToNewIO.C","Copying Header"); + AliHeader* outheader = rl->GetHeader(); + + + outheader->SetEvent(inheader->GetEvent()); + outheader->SetNvertex(inheader->GetNvertex()); + outheader->SetNprimary(inheader->GetNprimary()); + outheader->SetNtrack(inheader->GetNtrack()); + outheader->SetRun(inheader->GetRun()); + outheader->SetEventNrInRun(inheader->GetEventNrInRun()); + outheader->SetStack(inheader->Stack()); + outheader->SetGenEventHeader(inheader->GenEventHeader()); + rl->TreeE()->Fill(); + + /*****************************************/ + /* K I N E M A T I C S */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying Kinematics."); + TString treeKname("TreeK"); + treeKname+=i; + TTree* treeK = (TTree*)infile->Get(treeKname); + if (treeK) + { + if (treeK->GetEntries() > 0) + { + //I do this gimnastics to set directory correctly, without changing NewIO code + //only for this purpose + rl->LoadKinematics("update"); + rl->MakeTree("K"); + rl->GetEventFolder()->Remove(rl->TreeK()); + delete rl->TreeK(); + + treeK->SetBranchAddress("Particles",&particleBuffer); + ::Info("ConvertToNewIO.C","Cloning TreeK ..."); + TTree* tk = treeK->CloneTree(); + ::Info("ConvertToNewIO.C","Cloning TreeK ... Done"); + tk->SetName(AliRunLoader::fgkKineContainerName); + rl->GetEventFolder()->Add(tk); + rl->WriteKinematics("OVERWRITE"); + rl->UnloadKinematics(); + } + else + { + Info("ConvertToNewIO.C","Kinematics Tree is Empty"); + } + } + else + { + Error("ConvertToNewIO.C","Could not find Kinematics tree named %s",treeKname.Data()); + } + delete treeK; + /*****************************************/ + /* T R A C K R E F E R E N C E S */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying Track Refs."); + TString treeTRname("TreeTR"); + treeTRname+=i; + TTree* treeTR = (TTree*)infile->Get(treeTRname); + if (treeTR) + { + if (treeTR->GetEntries() > 0) + { + next.Reset(); + while ((module = (AliModule*)next())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + if (det) + { + TClonesArray* trbuffer = new TClonesArray("AliTrackReference", 100); + treeTR->SetBranchAddress(det->GetName(),&trbuffer); + } + } + + //I do this gimnastics to set directory correctly, without changing NewIO code + //only for this purpose + rl->LoadTrackRefs("update"); + rl->MakeTrackRefsContainer(); + rl->GetEventFolder()->Remove(rl->TreeTR()); + delete rl->TreeTR(); + + ::Info("ConvertToNewIO.C","Cloning TreeTR ..."); + TTree* tr = treeTR->CloneTree(); + ::Info("ConvertToNewIO.C","Cloning TreeTR ... Done"); + + tr->SetName(AliRunLoader::fgkTrackRefsContainerName); + rl->GetEventFolder()->Add(tr); + rl->WriteTrackRefs("OVERWRITE"); + rl->UnloadTrackRefs(); + } + else + { + Info("ConvertToNewIO.C","Track References Tree is Empty"); + } + } + else + { + Error("ConvertToNewIO.C","Could not find Track Refs tree named %s",treeTRname.Data()); + } + delete treeTR; + + /*****************************************/ + /* H I T S */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying Hits."); + TString treeHname("TreeH"); + treeHname+=i; + TTree* treeH = (TTree*)infile->Get(treeHname); + + if (treeH) + { + if (treeH->GetEntries() > 0) + { + TObjArray* lob = treeH->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadHits("update"); + loader->MakeTree("H"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + ::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeH()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ::Info("ConvertToNewIO.C","Dumping buffer:"); + ((TObject*)pbuf[nbranches])->Dump(); + ::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeH()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + Int_t nentr = (Int_t)treeH->GetEntries(); + ::Info("ConvertToNewIO.C","Copying Hits . Number of entries %d ... ",nentr); + +// ::Info("ConvertToNewIO.C","Getting event:"); +// nentr = 100; + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + printf("%d\r",e); + treeH->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// printf("Filling %s\n",loader->GetName()); + loader->TreeH()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + printf("\n"); + + ::Info("ConvertToNewIO.C","Copying Hits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteHits("OVERWRITE"); + loader->UnloadHits(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + } + else //tree has any entries + { + Info("ConvertToNewIO.C","Hits Tree is Empty"); + } + } + else //treeH + { + ::Warning("ConvertToNewIO.C","Could not get TreeH from in AliRun."); + } + delete treeH; + + /*****************************************/ + /* S D i g i t s */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying S Digits."); + TString treeSname("TreeS"); + treeSname+=i; + TTree* treeS = (TTree*)infile->Get(treeSname); + if (treeS) + { + if (treeS->GetEntries() > 0) + { + TObjArray* lob = treeS->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadSDigits("update"); + loader->MakeTree("S"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + + ::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeS()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ::Info("ConvertToNewIO.C","Dumping buffer:"); + ((TObject*)pbuf[nbranches])->Dump(); + ::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeS()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + Int_t nentr = (Int_t)treeS->GetEntries(); + ::Info("ConvertToNewIO.C","Copying SDigits. Number of entries %d ... ",nentr); + +// ::Info("ConvertToNewIO.C","Getting event:"); +// nentr = 100; + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + printf("%d\r",e); + treeS->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// printf("Filling %s\n",loader->GetName()); + loader->TreeS()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + printf("\n"); + + ::Info("ConvertToNewIO.C","Copying SDigits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteSDigits("OVERWRITE"); + loader->UnloadSDigits(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + } + else //tree has any entries + { + Info("ConvertToNewIO.C","S Digits Tree is Empty"); + } + } + else //treeS + { + ::Warning("ConvertToNewIO.C","Could not get TreeS from in AliRun."); + } + delete treeS; + + /*****************************************/ + /* D i g i t s */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying Digits."); + TString treeDname("TreeD"); + treeDname+=i; + TTree* treeD = (TTree*)infile->Get(treeDname); + if (treeD) + { + if (treeD->GetEntries() > 0) + { + + TObjArray* lob = treeD->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadDigits("update"); + loader->MakeTree("D"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + + ::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeD()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ::Info("ConvertToNewIO.C","Dumping buffer:"); + ((TObject*)pbuf[nbranches])->Dump(); + ::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeD()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + Int_t nentr = (Int_t)treeD->GetEntries(); + ::Info("ConvertToNewIO.C","Copying Digits. Number of entries %d ... ",nentr); + +// ::Info("ConvertToNewIO.C","Getting event:"); +// nentr = 100; + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + printf("%d\r",e); + treeD->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// printf("Filling %s\n",loader->GetName()); + loader->TreeD()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + printf("\n"); + + ::Info("ConvertToNewIO.C","Copying Digits ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteDigits("OVERWRITE"); + loader->UnloadDigits(); + } + delete loaders; + } + else //tree has any entries + { + Info("ConvertToNewIO.C","S Digits Tree is Empty"); + } + } + else //treeD + { + ::Warning("ConvertToNewIO.C","Could not get TreeD from in AliRun."); + } + delete treeD; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l]; + } + nbranches = 0; + + /*****************************************/ + /* R e c P o i n t s */ + /*****************************************/ + ::Info("ConvertToNewIO.C","Copying RecPoints."); + TString treeRname("TreeR"); + treeRname+=i; + TTree* treeR = (TTree*)infile->Get(treeRname); + if (treeR) + { + if (treeR->GetEntries() > 0) + { + TObjArray* lob = treeR->GetListOfBranches(); + TObjArray* loaders = new TObjArray(); + TIter nextnewmodule(outAliRun->Modules()); + + while ((module = (AliModule*)nextnewmodule())) + { + TClass* modclass = module->IsA(); + AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module)); + TClonesArray* ca = 0; + if (det) + { + AliLoader* loader = det->GetLoader(); + if (loader == 0x0) + { + ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName()); + continue; + } + + TString mask(det->GetName()); + + loader->LoadRecPoints("update"); + loader->MakeTree("R"); + loaders->Add(loader); + for(Int_t b=0; bGetEntries();b++) + { + TBranch* branch = (TBranch*)lob->At(b); + TString bname(branch->GetName());// + if ( bname.BeginsWith(det->GetName()) ) + { + + ::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName()); + ::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName()); + TString contname(branch->GetClassName()); + + Int_t splitlvl = branch->GetSplitLevel(); + // if (splitlvl) splitlvl = 99; + + if ( contname.CompareTo("TClonesArray") == 0) + { + TBranchElement* belem = (TBranchElement*)branch; + ::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName()); + + ca = new TClonesArray(belem->GetClonesName()); + pbuf[nbranches] = ca; + + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]); + + ::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl); + branches[nbranches] = loader->TreeR()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + else + { + TClass* bcl = gROOT->GetClass(branch->GetClassName()); + pbuf[nbranches] = bcl->New(); + ::Info("ConvertToNewIO.C","Dumping buffer:"); + ((TObject*)pbuf[nbranches])->Dump(); + ::Info("ConvertToNewIO.C","Setting Adress:"); + branch->SetAddress(&(pbuf[nbranches])); + ::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl); + branches[nbranches] =loader->TreeR()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl); + nbranches++; + } + } + }//loop over branches + }//if module is detector + }//while loop over modules + Int_t nentr = (Int_t)treeR->GetEntries(); + ::Info("ConvertToNewIO.C","Copying RecPoints. Number of entries %d ... ",nentr); + +// ::Info("ConvertToNewIO.C","Getting event:"); +// nentr = 100; + Int_t nl = loaders->GetEntries(); + for (Int_t e = 0; e < nentr; e++) + { + printf("%d\r",e); + treeR->GetEntry(e); + + for (Int_t l = 0; l < nbranches; l++) + { +// printf("%s %#x \n", branches[l]->GetName(),pbuf[l]); + branches[l]->SetAddress(&(pbuf[l])); + } + + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); +// printf("Filling %s\n",loader->GetName()); + loader->TreeR()->Fill(); + } + #ifndef __MAKECINT__ + #ifndef __CINT__ + fflush(0); + #endif + #endif + } + printf("\n"); + + ::Info("ConvertToNewIO.C","Copying RecPoints ... Done"); + for (Int_t l = 0; l < nl; l++) + { + AliLoader* loader = (AliLoader*)loaders->At(l); + loader->WriteRecPoints("OVERWRITE"); + loader->UnloadRecPoints(); + } + delete loaders; + for (Int_t l = 0; l < nbranches; l++) + { + delete (TObject*)pbuf[l];//delete branches buffers + } + nbranches = 0; + } + else //tree has any entries + { + Info("ConvertToNewIO.C","Rec Points Tree is Empty"); + } + } + else //treeR + { + ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun."); + } + delete treeR; + + }//end of loop over events + + /***************************************************/ + /**** Run to Run *************/ + /***************************************************/ + + rl->WriteHeader("OVERWRITE"); + + infile->cd(); + TGeometry* geo = inAliRun->GetGeometry(); + rl->CdGAFile(); + geo->Write(); + + rl->WriteAliRun(); + rl->WriteRunLoader(); + + ::Info("ConvertToNewIO.C","Done"); + +} + diff --git a/macros/DrawALICE.C b/macros/DrawALICE.C index 5dcef2b984f..6334bbb254e 100644 --- a/macros/DrawALICE.C +++ b/macros/DrawALICE.C @@ -3,6 +3,7 @@ void DrawALICE() gMC->Gsatt("*", "seen", -1); gMC->Gsatt("alic", "seen", 0); gROOT->LoadMacro("ViewABSO.C");gInterpreter->ProcessLine("ViewABSO()"); + gROOT->LoadMacro("ViewCASTOR.C");gInterpreter->ProcessLine("ViewCASTOR()"); gROOT->LoadMacro("ViewDIPO.C");gInterpreter->ProcessLine("ViewDIPO()"); gROOT->LoadMacro("ViewFMD.C");gInterpreter->ProcessLine("ViewFMD()"); gROOT->LoadMacro("ViewHALL.C");gInterpreter->ProcessLine("ViewHALL()"); diff --git a/macros/DrawSTART.C b/macros/DrawSTART.C index 877a0780485..40caaa39651 100755 --- a/macros/DrawSTART.C +++ b/macros/DrawSTART.C @@ -9,10 +9,11 @@ void DrawSTART() gMC->Gdopt("hide", "on"); gMC->Gdopt("shad", "on"); gMC->Gsatt("*", "fill", 7); - gMC->SetClipBox("."); - gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); + // gMC->SetClipBox("."); + // gMC->SetClipBox("*", 0, 300, -300, 300, -300, 300); + // gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); gMC->DefaultRange(); - gMC->Gdraw("ALIC", 40, 30, 0, 6, 9, 0.05, 0.05); + gMC->Gdraw("ALIC", 40, 30, 0, -10, 2, 0.5, 0.5); gMC->Gdhead(1111, "START Detector"); - gMC->Gdman(13, 9, "MAN"); + // gMC->Gdman(13, 9, "MAN"); } diff --git a/macros/TestNewIO.C b/macros/TestNewIO.C new file mode 100644 index 00000000000..fb2d41809e5 --- /dev/null +++ b/macros/TestNewIO.C @@ -0,0 +1,81 @@ +Int_t TestNewIO(Int_t n = 5,Char_t SlowOrFast='s') +{ + Int_t rc=0; + + AliLoader::SetDebug(kTRUE);//set it to kTRUE for debug print-out + gAlice->SetDebug(100); + /**********************************************/ + /************ G E N E R A T I O N *************/ + /**********************************************/ + + gROOT->LoadMacro("$(ALICE_ROOT)/macros/grun.C"); + grun(n); + + + /**********************************************/ + /******************* T P C ********************/ + /**********************************************/ + //The following part is just core of AliTPCtest.C + + gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCHits2SDigits.C"); + if (rc=AliTPCHits2SDigits(n)) return rc; + + gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCSDigits2Digits.C"); + if (rc=AliTPCSDigits2Digits(n)) return rc; + + gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindClusters.C"); + if (rc=AliTPCFindClusters(n)) return rc; + + gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindTracks.C"); + if (rc=AliTPCFindTracks(n)) return rc; + + /**********************************************/ + /******************* I T S ********************/ + /**********************************************/ + //The following part is just core of AliITStestV2.C + if (SlowOrFast=='f') { + cerr<<"Fast AliITSRecPoint(s) !\n"; + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2FastRecPoints.C"); + AliITSHits2FastRecPoints(); + } else { + cerr<<"Slow AliITSRecPoint(s) !\n"; + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2SDigits.C"); + AliITSHits2SDigits(); + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSSDigits2Digits.C"); + AliITSSDigits2Digits(); + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSDigits2RecPoints.C"); + AliITSDigits2RecPoints(); + } + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C"); + if (rc=AliITSFindClustersV2(SlowOrFast)) return rc; + + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindTracksV2.C"); + if (rc=AliITSFindTracksV2()) return rc; + + + /**********************************************/ + /****************** P H O S *******************/ + /**********************************************/ + + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + AliRunLoader* rl =AliRunLoader::Open("galice.root","EVENTFOLDER"); + AliPHOSReconstructioner r("EVENTFOLDER"); + r.ExecuteTask("deb"); + delete rl; + + gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCComparison.C"); + if (rc=AliTPCComparison()) return rc; + + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSComparisonV2.C"); + if (rc=AliITSComparisonV2()) return rc; + + + + ::Info("NewIO test","Everything seems to be OK"); + ::Info("NewIO test","You can try now display.C and TPC/AliTPCDisplayDigits3Dnew.C"); +} diff --git a/macros/ViewABSO.C b/macros/ViewABSO.C index 9a367b3228e..556f8cb02fa 100644 --- a/macros/ViewABSO.C +++ b/macros/ViewABSO.C @@ -6,12 +6,9 @@ void ViewABSO() gMC->Gsatt("APOL","seen",1); gMC->Gsatt("ANOS","seen",0); gMC->Gsatt("AWIN","seen",1); - gMC->Gsatt("ACNO","seen",0); - // gMC->Gsatt("AWNO","seen",0); gMC->Gsatt("AITR","seen",1); gMC->Gsatt("ARPB","seen",0); gMC->Gsatt("ACON","seen",1); - gMC->Gsatt("ACFE","seen",0); gMC->Gsatt("ACAR","seen",0); gMC->Gsatt("ACAO","seen",1); gMC->Gsatt("ARW0","seen",1); @@ -19,8 +16,8 @@ void ViewABSO() gMC->Gsatt("ARPE","seen",1); gMC->Gsatt("AV11","seen",1); gMC->Gsatt("AI11","seen",0); + gMC->Gsatt("AP11","seen",0); gMC->Gsatt("AV21","seen",1); gMC->Gsatt("AI21","seen",0); - gMC->Gsatt("ASSS","seen",0); - gMC->Gsatt("ASST","seen",0); + gMC->Gsatt("AP21","seen",1); } diff --git a/macros/ViewFMD.C b/macros/ViewFMD.C index 5db0b269646..306545c6e97 100644 --- a/macros/ViewFMD.C +++ b/macros/ViewFMD.C @@ -1,8 +1,7 @@ void ViewFMD() { + gMC->Gsatt("FMD0","seen",1); gMC->Gsatt("FMD1","seen",1); gMC->Gsatt("FMD2","seen",1); gMC->Gsatt("FMD3","seen",1); - gMC->Gsatt("FMD4","seen",1); - gMC->Gsatt("FMD5","seen",1); } diff --git a/macros/ViewFRAME.C b/macros/ViewFRAME.C index 2d7c1836734..de284006185 100644 --- a/macros/ViewFRAME.C +++ b/macros/ViewFRAME.C @@ -11,12 +11,12 @@ void ViewFRAME() gMC->Gsatt("B047","seen",0); gMC->Gsatt("B051","seen",0); gMC->Gsatt("B049","seen",0); - // gMC->Gsatt("B039","seen",1); + gMC->Gsatt("B039","seen",1); gMC->Gsatt("B033","seen",0); gMC->Gsatt("B063","seen",1); gMC->Gsatt("B065","seen",1); gMC->Gsatt("B067","seen",1); - // gMC->Gsatt("B069","seen",1); + gMC->Gsatt("B069","seen",1); gMC->Gsatt("B056","seen",1); gMC->Gsatt("B059","seen",1); gMC->Gsatt("B072","seen",1); @@ -35,7 +35,7 @@ void ViewFRAME() gMC->Gsatt("B064","seen",1); gMC->Gsatt("B066","seen",1); gMC->Gsatt("B068","seen",1); - // gMC->Gsatt("B070","seen",1); + gMC->Gsatt("B070","seen",1); gMC->Gsatt("B062","seen",1); gMC->Gsatt("B073","seen",1); } diff --git a/macros/ViewHALL.C b/macros/ViewHALL.C index 7b3e07184bc..902faff2b94 100644 --- a/macros/ViewHALL.C +++ b/macros/ViewHALL.C @@ -13,4 +13,6 @@ void ViewHALL() gMC->Gsatt("HHF2","seen",1); gMC->Gsatt("HPIL","seen",1); gMC->Gsatt("HMBS","seen",1); + gMC->Gsatt("HBBS","seen",1); + gMC->Gsatt("HPBS","seen",1); } diff --git a/macros/ViewITS.C b/macros/ViewITS.C index 0489046a9bc..b0d28883441 100644 --- a/macros/ViewITS.C +++ b/macros/ViewITS.C @@ -199,16 +199,16 @@ void ViewITS() //gMC->Gsatt("I095","seen",0); //gMC->Gsatt("I096","seen",0); //gMC->Gsatt("I094","seen",0); -// gMC->Gsatt("ISS1","seen",0); -// gMC->Gsatt("ISS2","seen",0); -// gMC->Gsatt("ISS3","seen",1); -// gMC->Gsatt("ISS4","seen",1); -// gMC->Gsatt("ISS5","seen",1); -// gMC->Gsatt("ISS6","seen",0); -// gMC->Gsatt("ISS7","seen",1); -// gMC->Gsatt("ISS8","seen",1); -// gMC->Gsatt("ISS9","seen",1); -// gMC->Gsatt("IS10","seen",1); -// gMC->Gsatt("IS11","seen",1); -// gMC->Gsatt("IS12","seen",1); + gMC->Gsatt("ISS1","seen",0); + gMC->Gsatt("ISS2","seen",0); + gMC->Gsatt("ISS3","seen",1); + gMC->Gsatt("ISS4","seen",1); + gMC->Gsatt("ISS5","seen",1); + gMC->Gsatt("ISS6","seen",0); + gMC->Gsatt("ISS7","seen",1); + gMC->Gsatt("ISS8","seen",1); + gMC->Gsatt("ISS9","seen",1); + gMC->Gsatt("IS10","seen",1); + gMC->Gsatt("IS11","seen",1); + gMC->Gsatt("IS12","seen",1); } diff --git a/macros/ViewMUON.C b/macros/ViewMUON.C index 2b3e3e15477..ed098e9c63c 100644 --- a/macros/ViewMUON.C +++ b/macros/ViewMUON.C @@ -1,102 +1,71 @@ void ViewMUON() { - gMC->Gsatt("S01M","seen",1); - gMC->Gsatt("S02M","seen",1); - gMC->Gsatt("S01B","seen",1); - gMC->Gsatt("S02B","seen",1); - gMC->Gsatt("S01A","seen",1); - gMC->Gsatt("S02A","seen",1); - gMC->Gsatt("S01G","seen",1); - gMC->Gsatt("S02G","seen",1); - gMC->Gsatt("S03M","seen",1); - gMC->Gsatt("S04M","seen",1); - gMC->Gsatt("S03B","seen",1); - gMC->Gsatt("S04B","seen",1); - gMC->Gsatt("S03A","seen",1); - gMC->Gsatt("S04A","seen",1); - gMC->Gsatt("S03G","seen",1); - gMC->Gsatt("S04G","seen",1); - gMC->Gsatt("S05C","seen",1); - gMC->Gsatt("SB5C","seen",1); - gMC->Gsatt("S06C","seen",1); - gMC->Gsatt("S05R","seen",1); - gMC->Gsatt("SB5R","seen",1); - gMC->Gsatt("S06R","seen",1); - gMC->Gsatt("S05I","seen",1); - gMC->Gsatt("SB5I","seen",1); - gMC->Gsatt("S06I","seen",1); - gMC->Gsatt("S05P","seen",1); - gMC->Gsatt("SB5P","seen",1); - gMC->Gsatt("S06P","seen",1); - gMC->Gsatt("S05G","seen",1); - gMC->Gsatt("S06G","seen",1); - gMC->Gsatt("S05V","seen",1); - gMC->Gsatt("S06V","seen",1); - gMC->Gsatt("S05H","seen",1); - gMC->Gsatt("SB5H","seen",1); - gMC->Gsatt("S06H","seen",1); - gMC->Gsatt("S05B","seen",1); - gMC->Gsatt("SB5B","seen",1); - gMC->Gsatt("S06B","seen",1); - gMC->Gsatt("S05N","seen",1); - gMC->Gsatt("S06N","seen",1); - gMC->Gsatt("S07M","seen",1); - gMC->Gsatt("S08M","seen",1); - gMC->Gsatt("S07C","seen",1); - gMC->Gsatt("S08C","seen",1); - gMC->Gsatt("S07R","seen",1); - gMC->Gsatt("S08R","seen",1); - gMC->Gsatt("S07I","seen",1); - gMC->Gsatt("S08I","seen",1); - gMC->Gsatt("S07P","seen",1); - gMC->Gsatt("S08P","seen",1); - gMC->Gsatt("S07G","seen",1); - gMC->Gsatt("S08G","seen",1); - gMC->Gsatt("S07V","seen",1); - gMC->Gsatt("S08V","seen",1); - gMC->Gsatt("S07H","seen",1); - gMC->Gsatt("S08H","seen",1); - gMC->Gsatt("S07B","seen",1); - gMC->Gsatt("S08B","seen",1); - gMC->Gsatt("S07N","seen",1); - gMC->Gsatt("S08N","seen",1); - gMC->Gsatt("S09M","seen",1); - gMC->Gsatt("S09C","seen",1); - gMC->Gsatt("S10C","seen",1); - gMC->Gsatt("S09R","seen",1); - gMC->Gsatt("S10R","seen",1); - gMC->Gsatt("S09I","seen",1); - gMC->Gsatt("S10I","seen",1); - gMC->Gsatt("S09P","seen",1); - gMC->Gsatt("S10P","seen",1); - gMC->Gsatt("S09G","seen",1); - gMC->Gsatt("S10G","seen",1); - gMC->Gsatt("S09V","seen",1); - gMC->Gsatt("S10V","seen",1); - gMC->Gsatt("S09H","seen",1); - gMC->Gsatt("S10H","seen",1); - gMC->Gsatt("S09B","seen",1); - gMC->Gsatt("S10B","seen",1); - gMC->Gsatt("S09N","seen",1); - gMC->Gsatt("S10N","seen",1); - gMC->Gsatt("SM11","seen",1); - gMC->Gsatt("SM12","seen",1); - gMC->Gsatt("SF1A","seen",1); - gMC->Gsatt("SF3A","seen",1); - gMC->Gsatt("SC1A","seen",1); - gMC->Gsatt("SB1A","seen",1); - gMC->Gsatt("SG1A","seen",1); - gMC->Gsatt("SC2A","seen",1); - gMC->Gsatt("SB2A","seen",1); - gMC->Gsatt("SG2A","seen",1); - gMC->Gsatt("SM21","seen",1); - gMC->Gsatt("SM22","seen",1); - gMC->Gsatt("SF2A","seen",1); - gMC->Gsatt("SF4A","seen",1); - gMC->Gsatt("SC3A","seen",1); - gMC->Gsatt("SB3A","seen",1); - gMC->Gsatt("SG3A","seen",1); - gMC->Gsatt("SC4A","seen",1); - gMC->Gsatt("SB4A","seen",1); - gMC->Gsatt("SG4A","seen",1); +gMC->Gsatt("C01M","seen",0); +gMC->Gsatt("C02M","seen",0); +gMC->Gsatt("C01O","seen",1); +gMC->Gsatt("C02O","seen",1); +gMC->Gsatt("C01I","seen",1); +gMC->Gsatt("C02I","seen",1); +gMC->Gsatt("C01A","seen",0); +gMC->Gsatt("C02A","seen",0); +gMC->Gsatt("C01G","seen",1); +gMC->Gsatt("C02G","seen",1); +gMC->Gsatt("C03M","seen",0); +gMC->Gsatt("C04M","seen",0); +gMC->Gsatt("C03O","seen",1); +gMC->Gsatt("C04O","seen",1); +gMC->Gsatt("C03I","seen",1); +gMC->Gsatt("C04I","seen",1); +gMC->Gsatt("C03A","seen",0); +gMC->Gsatt("C04A","seen",0); +gMC->Gsatt("C03G","seen",1); +gMC->Gsatt("C04G","seen",1); +gMC->Gsatt("C05M","seen",0); +gMC->Gsatt("C06M","seen",0); +gMC->Gsatt("C05O","seen",1); +gMC->Gsatt("C06O","seen",1); +gMC->Gsatt("C05I","seen",1); +gMC->Gsatt("C06I","seen",1); +gMC->Gsatt("C05A","seen",0); +gMC->Gsatt("C06A","seen",0); +gMC->Gsatt("C05G","seen",1); +gMC->Gsatt("C06G","seen",1); +gMC->Gsatt("C07M","seen",0); +gMC->Gsatt("C08M","seen",0); +gMC->Gsatt("C07O","seen",1); +gMC->Gsatt("C08O","seen",1); +gMC->Gsatt("C07I","seen",1); +gMC->Gsatt("C08I","seen",1); +gMC->Gsatt("C07A","seen",0); +gMC->Gsatt("C08A","seen",0); +gMC->Gsatt("C07G","seen",1); +gMC->Gsatt("C08G","seen",1); +gMC->Gsatt("C09M","seen",0); +gMC->Gsatt("C10M","seen",0); +gMC->Gsatt("C09O","seen",1); +gMC->Gsatt("C10O","seen",1); +gMC->Gsatt("C09I","seen",1); +gMC->Gsatt("C10I","seen",1); +gMC->Gsatt("C09A","seen",0); +gMC->Gsatt("C10A","seen",0); +gMC->Gsatt("C09G","seen",1); +gMC->Gsatt("C10G","seen",1); +gMC->Gsatt("CM11","seen",0); +gMC->Gsatt("CM12","seen",0); +gMC->Gsatt("CF1A","seen",1); +gMC->Gsatt("CC1A","seen",1); +gMC->Gsatt("CB1A","seen",1); +gMC->Gsatt("CG1A","seen",1); +gMC->Gsatt("CC2A","seen",1); +gMC->Gsatt("CB2A","seen",1); +gMC->Gsatt("CG2A","seen",1); +gMC->Gsatt("CM21","seen",0); +gMC->Gsatt("CM22","seen",0); +gMC->Gsatt("CF2A","seen",1); +gMC->Gsatt("CC3A","seen",1); +gMC->Gsatt("CB3A","seen",1); +gMC->Gsatt("CG3A","seen",1); +gMC->Gsatt("CC4A","seen",1); +gMC->Gsatt("CB4A","seen",1); +gMC->Gsatt("CG4A","seen",1); } diff --git a/macros/ViewPHOS.C b/macros/ViewPHOS.C index 389328d4cd5..85d604ea431 100644 --- a/macros/ViewPHOS.C +++ b/macros/ViewPHOS.C @@ -3,49 +3,35 @@ void ViewPHOS() // Set drawing attributes for PHOS version #2 gMC->Gsatt("PHOS","seen",0); -// gMC->Gsatt("PSTR","seen",1); -// gMC->Gsatt("PCEL","seen",1); -// gMC->Gsatt("PWRA","seen",1); -// gMC->Gsatt("PXTL","seen",1); -// gMC->Gsatt("PPIN","seen",1); -// gMC->Gsatt("PREA","seen",1); -// gMC->Gsatt("PSUP","seen",1); -// gMC->Gsatt("PSHO","seen",1); -// gMC->Gsatt("PTII","seen",1); -// gMC->Gsatt("PAGA","seen",1); -// gMC->Gsatt("PCOR","seen",1); -// gMC->Gsatt("PTIO","seen",1); -// gMC->Gsatt("PCOL","seen",1); -// gMC->Gsatt("PFGC","seen",1); -// gMC->Gsatt("PWAR","seen",1); -// gMC->Gsatt("PWTI","seen",1); -// gMC->Gsatt("PCA1","seen",1); -// gMC->Gsatt("PBE1","seen",1); -// gMC->Gsatt("PCA2","seen",1); -// gMC->Gsatt("PBE2","seen",1); -// gMC->Gsatt("PFRX","seen",1); -// gMC->Gsatt("PFRZ","seen",1); -// gMC->Gsatt("PFG1","seen",1); -// gMC->Gsatt("PFG2","seen",1); -// gMC->Gsatt("PFG3","seen",1); -// gMC->Gsatt("PFG4","seen",1); -// gMC->Gsatt("PAFE","seen",1); - gMC->Gsatt("PEMC","seen",1); - gMC->Gsatt("PCPV","seen",1); -// gMC->Gsatt("PCPC","seen",1); -// gMC->Gsatt("PCPD","seen",1); -// gMC->Gsatt("PCPF","seen",1); -// gMC->Gsatt("PCPG","seen",1); -// gMC->Gsatt("PCPQ","seen",1); -// gMC->Gsatt("PCP1","seen",1); -// gMC->Gsatt("PCF1","seen",1); -// gMC->Gsatt("PCF2","seen",1); -// gMC->Gsatt("PRRD","seen",1); -// gMC->Gsatt("PRAI","seen",1); -// gMC->Gsatt("PRP1","seen",1); -// gMC->Gsatt("PRP2","seen",1); -// gMC->Gsatt("PRP3","seen",1); -// gMC->Gsatt("PCRA","seen",1); -// gMC->Gsatt("PCRE","seen",1); -// gMC->Gsatt("PWHE","seen",1); + gMC->Gsatt("EMCA","seen",0); + gMC->Gsatt("PTXW","seen",0); + gMC->Gsatt("PUFP","seen",1); + gMC->Gsatt("PAIR","seen",1); + gMC->Gsatt("PTCB","seen",1); + gMC->Gsatt("PCBL","seen",0); + gMC->Gsatt("PROW","seen",0); + gMC->Gsatt("PCEL","seen",0); + gMC->Gsatt("PSTC","seen",0); + gMC->Gsatt("PPAP","seen",0); + gMC->Gsatt("PXTL","seen",0); + gMC->Gsatt("PSUP","seen",0); + gMC->Gsatt("PPIN","seen",0); + gMC->Gsatt("PUCP","seen",1); + gMC->Gsatt("PASP","seen",1); + gMC->Gsatt("PTIP","seen",1); + gMC->Gsatt("PTXP","seen",1); + gMC->Gsatt("PPSD","seen",0); + gMC->Gsatt("MPPS","seen",1); + gMC->Gsatt("TLPS","seen",1); + gMC->Gsatt("UPPS","seen",1); + gMC->Gsatt("ANPS","seen",0); + gMC->Gsatt("GGPS","seen",0); + gMC->Gsatt("GROW","seen",0); + gMC->Gsatt("GCEL","seen",0); + gMC->Gsatt("CAPS","seen",1); + gMC->Gsatt("PCPS","seen",1); + gMC->Gsatt("LPPS","seen",1); + gMC->Gsatt("UAPP","seen",0); + gMC->Gsatt("LCPP","seen",0); + gMC->Gsatt("LAPP","seen",1); } diff --git a/macros/ViewPIPE.C b/macros/ViewPIPE.C index c71477d47d9..a494124b08f 100644 --- a/macros/ViewPIPE.C +++ b/macros/ViewPIPE.C @@ -1,27 +1,41 @@ void ViewPIPE() { - gMC->Gsatt("QBPM","seen",0); - gMC->Gsatt("QBVA","seen",1); - gMC->Gsatt("QBBE","seen",1); -// gMC->Gsatt("QBSR","seen",1); - gMC->Gsatt("QB29","seen",1); -// gMC->Gsatt("QF29","seen",1); -// gMC->Gsatt("QS29","seen",1); -// gMC->Gsatt("QP29","seen",1); -// gMC->Gsatt("QB28","seen",1); -// gMC->Gsatt("QBAB","seen",1); -// gMC->Gsatt("QBE0","seen",1); -// gMC->Gsatt("QBEM","seen",1); -// gMC->Gsatt("QBEU","seen",1); -// gMC->Gsatt("QBEW","seen",1); -// gMC->Gsatt("QBEP","seen",1); -// gMC->Gsatt("QB24","seen",1); -// gMC->Gsatt("QFA0","seen",1); - gMC->Gsatt("QI32","seen",1); - gMC->Gsatt("QI42","seen",1); - gMC->Gsatt("QI33","seen",1); - gMC->Gsatt("QI43","seen",1); - gMC->Gsatt("QI34","seen",1); - gMC->Gsatt("QI44","seen",1); - gMC->Gsatt("QI35","seen",1); +gMC->Gsatt("QBPM","seen",0); +gMC->Gsatt("QB11","seen",0); +gMC->Gsatt("QB00","seen",1); +gMC->Gsatt("QB02","seen",1); +gMC->Gsatt("QB01","seen",1); +gMC->Gsatt("QB04","seen",1); +gMC->Gsatt("QB03","seen",1); +gMC->Gsatt("QB05","seen",1); +gMC->Gsatt("QB06","seen",1); +gMC->Gsatt("QB08","seen",1); +gMC->Gsatt("QB10","seen",1); +gMC->Gsatt("QB07","seen",1); +gMC->Gsatt("QB30","seen",1); +gMC->Gsatt("QB29","seen",1); +gMC->Gsatt("QB28","seen",1); +gMC->Gsatt("QB27","seen",1); +gMC->Gsatt("QB26","seen",1); +gMC->Gsatt("QB25","seen",1); +gMC->Gsatt("QB20","seen",1); +gMC->Gsatt("QB23","seen",1); +gMC->Gsatt("QB24","seen",1); +gMC->Gsatt("QB22","seen",1); +gMC->Gsatt("QB19","seen",1); +gMC->Gsatt("QB18","seen",1); +gMC->Gsatt("QB21","seen",1); +gMC->Gsatt("QB15","seen",1); +gMC->Gsatt("QB16","seen",1); +gMC->Gsatt("QB17","seen",1); +gMC->Gsatt("QB14","seen",1); +gMC->Gsatt("QB13","seen",1); +gMC->Gsatt("QB12","seen",1); +gMC->Gsatt("QB31","seen",1); +gMC->Gsatt("QB32","seen",1); +gMC->Gsatt("QIPM","seen",0); +gMC->Gsatt("QI32","seen",1); +gMC->Gsatt("QI33","seen",1); +gMC->Gsatt("QI34","seen",1); +gMC->Gsatt("QI35","seen",1); } diff --git a/macros/ViewPMD.C b/macros/ViewPMD.C index 7dd8b9b4f19..bc3058fd350 100644 --- a/macros/ViewPMD.C +++ b/macros/ViewPMD.C @@ -1,28 +1,30 @@ void ViewPMD() { -// gMC->Gsatt("ECAR","seen",1); -// gMC->Gsatt("ECCU","seen",1); -// gMC->Gsatt("ESMA","seen",1); -// gMC->Gsatt("ESMB","seen",1); -// gMC->Gsatt("EAIR","seen",1); -// gMC->Gsatt("EHC1","seen",1); -// gMC->Gsatt("ESMX","seen",1); -// gMC->Gsatt("ESMY","seen",1); -// gMC->Gsatt("EHC2","seen",1); -// gMC->Gsatt("EAIX","seen",1); -// gMC->Gsatt("ESMP","seen",1); -// gMC->Gsatt("ESMQ","seen",1); -// gMC->Gsatt("EHC3","seen",1); -// gMC->Gsatt("EAIP","seen",1); - gMC->Gsatt("EPMD","seen",1); -// gMC->Gsatt("EMM1","seen",1); -// gMC->Gsatt("EPB1","seen",1); -// gMC->Gsatt("EFE1","seen",1); -// gMC->Gsatt("EMM2","seen",1); -// gMC->Gsatt("EPB2","seen",1); -// gMC->Gsatt("EFE2","seen",1); -// gMC->Gsatt("EMM3","seen",1); -// gMC->Gsatt("EPB3","seen",1); -// gMC->Gsatt("EFE3","seen",1); -// gMC->Gsatt("EALM","seen",1); +gMC->Gsatt("DP11","seen",0); +gMC->Gsatt("DS11","seen",0); +gMC->Gsatt("SUPR","seen",0); +gMC->Gsatt("SMSS","seen",1); +gMC->Gsatt("SMAR","seen",1); +gMC->Gsatt("DW11","seen",0); +gMC->Gsatt("SUPB","seen",0); +gMC->Gsatt("SUFE","seen",0); +gMC->Gsatt("DM11","seen",0); +gMC->Gsatt("DPMD","seen",0); +gMC->Gsatt("PM01","seen",0); +gMC->Gsatt("PM02","seen",0); +gMC->Gsatt("PM03","seen",0); +gMC->Gsatt("PM04","seen",0); +gMC->Gsatt("PM05","seen",0); +gMC->Gsatt("PM06","seen",0); +gMC->Gsatt("PM07","seen",0); +gMC->Gsatt("PM08","seen",0); +gMC->Gsatt("PM09","seen",0); +gMC->Gsatt("PM10","seen",0); +gMC->Gsatt("PM11","seen",0); +gMC->Gsatt("PM12","seen",0); +gMC->Gsatt("PM13","seen",0); +gMC->Gsatt("PM14","seen",0); +gMC->Gsatt("PMDL","seen",0); +gMC->Gsatt("PMDR","seen",0); + } diff --git a/macros/ViewRICH.C b/macros/ViewRICH.C index eaf40a91b8e..d54d914d9ac 100644 --- a/macros/ViewRICH.C +++ b/macros/ViewRICH.C @@ -7,6 +7,7 @@ void ViewRICH() gMC->Gsatt("QUAR","seen",1); gMC->Gsatt("SPAC","seen",1); gMC->Gsatt("OQUA","seen",1); + gMC->Gsatt("BARR","seen",1); gMC->Gsatt("META","seen",1); gMC->Gsatt("GAP ","seen",1); gMC->Gsatt("CSI ","seen",1); diff --git a/macros/ViewSHIL.C b/macros/ViewSHIL.C index a1cc807d052..614341af0cb 100644 --- a/macros/ViewSHIL.C +++ b/macros/ViewSHIL.C @@ -1,7 +1,75 @@ void ViewSHIL() { - gMC->Gsatt("YAEM","seen",1); - gMC->Gsatt("YFEM","seen",1); - gMC->Gsatt("YFIM","seen",1); - gMC->Gsatt("YFII","seen",1); +gMC->Gsatt("YMOT","seen",1); +gMC->Gsatt("YGO1","seen",1); +gMC->Gsatt("YMO1","seen",1); +gMC->Gsatt("YSE1","seen",1); +gMC->Gsatt("YB11","seen",1); +gMC->Gsatt("YB12","seen",1); +gMC->Gsatt("YB13","seen",1); +gMC->Gsatt("YBU1","seen",1); +gMC->Gsatt("YBM1","seen",1); +gMC->Gsatt("YFM1","seen",1); +gMC->Gsatt("YF11","seen",1); +gMC->Gsatt("YF12","seen",1); +gMC->Gsatt("YPF1","seen",1); +gMC->Gsatt("YV11","seen",1); +gMC->Gsatt("YI11","seen",1); +gMC->Gsatt("YP11","seen",1); +gMC->Gsatt("YV12","seen",1); +gMC->Gsatt("YI12","seen",1); +gMC->Gsatt("YP12","seen",1); +gMC->Gsatt("YGO2","seen",1); +gMC->Gsatt("YXO2","seen",1); +gMC->Gsatt("YYO2","seen",1); +gMC->Gsatt("YMO2","seen",1); +gMC->Gsatt("YS21","seen",1); +gMC->Gsatt("YS22","seen",1); +gMC->Gsatt("YS23","seen",1); +gMC->Gsatt("YS24","seen",1); +gMC->Gsatt("YS25","seen",1); +gMC->Gsatt("YS26","seen",1); +gMC->Gsatt("YV21","seen",1); +gMC->Gsatt("YI21","seen",1); +gMC->Gsatt("YP21","seen",1); +gMC->Gsatt("YGO3","seen",1); +gMC->Gsatt("YXO3","seen",1); +gMC->Gsatt("YMO3","seen",1); +gMC->Gsatt("YS31","seen",1); +gMC->Gsatt("YB21","seen",1); +gMC->Gsatt("YB22","seen",1); +gMC->Gsatt("YB23","seen",1); +gMC->Gsatt("YBU2","seen",1); +gMC->Gsatt("YBM2","seen",1); +gMC->Gsatt("YFM2","seen",1); +gMC->Gsatt("YF21","seen",1); +gMC->Gsatt("YF22","seen",1); +gMC->Gsatt("YPF2","seen",1); +gMC->Gsatt("YGO4","seen",1); +gMC->Gsatt("YXO4","seen",1); +gMC->Gsatt("YXO5","seen",1); +gMC->Gsatt("YMO4","seen",1); +gMC->Gsatt("YCC4","seen",1); +gMC->Gsatt("YS41","seen",1); +gMC->Gsatt("YS43","seen",1); +gMC->Gsatt("YPBI","seen",1); +gMC->Gsatt("YPBO","seen",1); +gMC->Gsatt("YFEI","seen",1); +gMC->Gsatt("YFEO","seen",1); +gMC->Gsatt("YAEM","seen",1); +gMC->Gsatt("YFEM","seen",1); +gMC->Gsatt("YV31","seen",1); +gMC->Gsatt("YI31","seen",1); +gMC->Gsatt("YP31","seen",1); +gMC->Gsatt("YV32","seen",1); +gMC->Gsatt("YI32","seen",1); +gMC->Gsatt("YP32","seen",1); +gMC->Gsatt("YFIM","seen",1); +gMC->Gsatt("YFII","seen",1); +gMC->Gsatt("YCS1","seen",1); +gMC->Gsatt("YCS2","seen",1); +gMC->Gsatt("YCS3","seen",1); +gMC->Gsatt("YCS4","seen",1); +gMC->Gsatt("YCS5","seen",1); +gMC->Gsatt("YCS6","seen",1); } diff --git a/macros/ViewSTART.C b/macros/ViewSTART.C index 7f1454c119e..ce07bfc23b7 100755 --- a/macros/ViewSTART.C +++ b/macros/ViewSTART.C @@ -1,24 +1,9 @@ void ViewSTART() { - gMC->Gsatt("0STR","seen",1); - gMC->Gsatt("0STL","seen",1); - // gMC->Gsatt("0INS","seen",1); - // gMC->Gsatt("0PMT","seen",1); -// gMC->Gsatt("0DIV","seen",1); -// gMC->Gsatt("0TOP","seen",1); -// gMC->Gsatt("0BOT","seen",1); -// gMC->Gsatt("0OUT","seen",1); -// gMC->Gsatt("0CER","seen",1); -// gMC->Gsatt("0STE","seen",1); -// gMC->Gsatt("0NB","seen",1); -// gMC->Gsatt("0KB","seen",1); -// gMC->Gsatt("0VAC","seen",1); -// gMC->Gsatt("0PIN","seen",1); -// gMC->Gsatt("0HOL","seen",1); -// gMC->Gsatt("0V1","seen",1); -// gMC->Gsatt("0V2","seen",1); -// gMC->Gsatt("0RS","seen",1); -// gMC->Gsatt("0RB","seen",1); + // gMC->Gsatt("STRT","seen",0); + gMC->Gsatt("0IN","seen",0); + gMC->Gsatt("0PM","seen",1); + gMC->Gsatt("0DI","seen",1); } diff --git a/macros/ViewTOF.C b/macros/ViewTOF.C index e4289662aac..3ba959e0e17 100644 --- a/macros/ViewTOF.C +++ b/macros/ViewTOF.C @@ -47,19 +47,19 @@ gMC->Gsatt("FTOA","seen",0); gMC->Gsatt("FLTA","seen",0); gMC->Gsatt("FLTB","seen",0); gMC->Gsatt("FLTC","seen",0); -// gMC->Gsatt("FMYA","seen",1); -// gMC->Gsatt("FMYB","seen",1); -// gMC->Gsatt("FMYC","seen",1); -// gMC->Gsatt("FPLA","seen",1); -// gMC->Gsatt("FPLB","seen",1); -// gMC->Gsatt("FPLC","seen",1); +gMC->Gsatt("FMYA","seen",1); +gMC->Gsatt("FMYB","seen",1); +gMC->Gsatt("FMYC","seen",1); +gMC->Gsatt("FPLA","seen",1); +gMC->Gsatt("FPLB","seen",1); +gMC->Gsatt("FPLC","seen",1); gMC->Gsatt("FSTR","seen",0); -// gMC->Gsatt("FNSF","seen",0); -// gMC->Gsatt("FMYX","seen",0); -// gMC->Gsatt("FGRL","seen",0); -// gMC->Gsatt("FCFC","seen",0); -// gMC->Gsatt("FLZ","seen",0); -// gMC->Gsatt("FLX","seen",0); +gMC->Gsatt("FNSF","seen",0); +gMC->Gsatt("FMYX","seen",0); +gMC->Gsatt("FGRL","seen",0); +gMC->Gsatt("FCFC","seen",0); +gMC->Gsatt("FLZ","seen",0); +gMC->Gsatt("FLX","seen",0); gMC->Gsatt("FPAD","seen",0); gMC->Gsatt("FPEA","seen",1); gMC->Gsatt("FPEB","seen",1); @@ -67,10 +67,10 @@ gMC->Gsatt("FPEC","seen",1); gMC->Gsatt("FECA","seen",1); gMC->Gsatt("FECB","seen",1); gMC->Gsatt("FECC","seen",1); -// gMC->Gsatt("FWAA","seen",1); -// gMC->Gsatt("FWAB","seen",1); -// gMC->Gsatt("FWAC","seen",1); -// gMC->Gsatt("FBPA","seen",1); -// gMC->Gsatt("FBPB","seen",1); -// gMC->Gsatt("FBPC","seen",1); +gMC->Gsatt("FWAA","seen",1); +gMC->Gsatt("FWAB","seen",1); +gMC->Gsatt("FWAC","seen",1); +gMC->Gsatt("FBPA","seen",1); +gMC->Gsatt("FBPB","seen",1); +gMC->Gsatt("FBPC","seen",1); } diff --git a/macros/ViewTPC.C b/macros/ViewTPC.C index 61ed4b5d4d4..aa4cb828016 100644 --- a/macros/ViewTPC.C +++ b/macros/ViewTPC.C @@ -2,7 +2,7 @@ void ViewTPC() { gMC->Gsatt("TPC","seen",0); gMC->Gsatt("TOIN","seen",0); -//gMC->Gsatt("TPCR","seen",1); +gMC->Gsatt("TPCR","seen",1); gMC->Gsatt("TOCV","seen",0); gMC->Gsatt("TSA1","seen",1); gMC->Gsatt("TSA2","seen",1); @@ -14,54 +14,54 @@ gMC->Gsatt("TSA6","seen",1); gMC->Gsatt("TSA7","seen",1); gMC->Gsatt("TSA8","seen",1); gMC->Gsatt("TIIN","seen",0); -//gMC->Gsatt("TICL","seen",1); -// gMC->Gsatt("TSA9","seen",0); -// gMC->Gsatt("TS10","seen",0); -// gMC->Gsatt("TS11","seen",0); -// gMC->Gsatt("TS12","seen",0); -//gMC->Gsatt("TICR","seen",1); -// gMC->Gsatt("TS13","seen",0); -// gMC->Gsatt("TS14","seen",0); -// gMC->Gsatt("TS15","seen",0); -// gMC->Gsatt("TS16","seen",0); +gMC->Gsatt("TICL","seen",1); +gMC->Gsatt("TSA9","seen",0); +gMC->Gsatt("TS10","seen",0); +gMC->Gsatt("TS11","seen",0); +gMC->Gsatt("TS12","seen",0); +gMC->Gsatt("TICR","seen",1); +gMC->Gsatt("TS13","seen",0); +gMC->Gsatt("TS14","seen",0); +gMC->Gsatt("TS15","seen",0); +gMC->Gsatt("TS16","seen",0); gMC->Gsatt("TIFC","seen",1); -// gMC->Gsatt("TS17","seen",0); -// gMC->Gsatt("TS18","seen",0); -// gMC->Gsatt("TS19","seen",0); -//gMC->Gsatt("TS20","seen",0); -//gMC->Gsatt("TS21","seen",0); -//gMC->Gsatt("TS22","seen",0); -//gMC->Gsatt("TS23","seen",0); -//gMC->Gsatt("TS24","seen",0); +gMC->Gsatt("TS17","seen",0); +gMC->Gsatt("TS18","seen",0); +gMC->Gsatt("TS19","seen",0); +gMC->Gsatt("TS20","seen",0); +gMC->Gsatt("TS21","seen",0); +gMC->Gsatt("TS22","seen",0); +gMC->Gsatt("TS23","seen",0); +gMC->Gsatt("TS24","seen",0); gMC->Gsatt("TDGN","seen",0); gMC->Gsatt("TIRC","seen",0); gMC->Gsatt("TIC1","seen",1); gMC->Gsatt("TIPP","seen",1); gMC->Gsatt("TIC3","seen",1); gMC->Gsatt("TRCE","seen",1); -//gMC->Gsatt("TPSC","seen",0); +gMC->Gsatt("TPSC","seen",0); gMC->Gsatt("TPCC","seen",1); gMC->Gsatt("TORC","seen",1); -// gMC->Gsatt("TOPP","seen",0); -// gMC->Gsatt("TOC3","seen",0); -// gMC->Gsatt("TOC1","seen",0); -// gMC->Gsatt("TSSW","seen",0); -// gMC->Gsatt("TSWC","seen",0); +gMC->Gsatt("TOPP","seen",0); +gMC->Gsatt("TOC3","seen",0); +gMC->Gsatt("TOC1","seen",0); +gMC->Gsatt("TSSW","seen",0); +gMC->Gsatt("TSWC","seen",0); gMC->Gsatt("TSCE","seen",1); -//gMC->Gsatt("TWES","seen",0); +gMC->Gsatt("TWES","seen",0); gMC->Gsatt("TSWB","seen",1); -//gMC->Gsatt("TPEL","seen",0); -//gMC->Gsatt("TPMW","seen",0); -//gMC->Gsatt("TPEW","seen",0); -// gMC->Gsatt("TESR","seen",0); -// gMC->Gsatt("TESB","seen",0); -// gMC->Gsatt("TPLS","seen",0); -// gMC->Gsatt("TPUS","seen",0); -// gMC->Gsatt("TPSS","seen",0); +gMC->Gsatt("TPEL","seen",0); +gMC->Gsatt("TPMW","seen",0); +gMC->Gsatt("TPEW","seen",0); +gMC->Gsatt("TESR","seen",0); +gMC->Gsatt("TESB","seen",0); +gMC->Gsatt("TPLS","seen",0); +gMC->Gsatt("TPUS","seen",0); +gMC->Gsatt("TPSS","seen",0); gMC->Gsatt("THVM","seen",1); gMC->Gsatt("TPSR","seen",1); -// gMC->Gsatt("THVL","seen",0); -// gMC->Gsatt("THVC","seen",0); -// gMC->Gsatt("THVE","seen",0); -// gMC->Gsatt("THVR","seen",0); +gMC->Gsatt("THVL","seen",0); +gMC->Gsatt("THVC","seen",0); +gMC->Gsatt("THVE","seen",0); +gMC->Gsatt("THVR","seen",0); } diff --git a/macros/ViewTRD.C b/macros/ViewTRD.C index 985782ccd16..b41b348d268 100644 --- a/macros/ViewTRD.C +++ b/macros/ViewTRD.C @@ -1,10 +1,10 @@ void ViewTRD() { -gMC->Gsatt("B077","seen",1); +gMC->Gsatt("B077","seen",0); //gMC->Gsatt("B076","seen",1); -gMC->Gsatt("B071","seen",1); -gMC->Gsatt("B074","seen",1); -//gMC->Gsatt("B075","seen",1); +gMC->Gsatt("B071","seen",0); +gMC->Gsatt("B074","seen",0); +gMC->Gsatt("B075","seen",0); /*gMC->Gsatt("B080","seen",0); gMC->Gsatt("B042","seen",0); gMC->Gsatt("B045","seen",0); @@ -21,12 +21,12 @@ gMC->Gsatt("B056","seen",0); gMC->Gsatt("B059","seen",0); gMC->Gsatt("B072","seen",0); */ -gMC->Gsatt("BTR1","seen",1); -gMC->Gsatt("BTO1","seen",1); -gMC->Gsatt("BTR2","seen",1); -gMC->Gsatt("BTO2","seen",1); -//gMC->Gsatt("BTR3","seen",1); -//gMC->Gsatt("BTO3","seen",1); +gMC->Gsatt("BTR1","seen",0); +gMC->Gsatt("BTO1","seen",0); +gMC->Gsatt("BTR2","seen",0); +gMC->Gsatt("BTO2","seen",0); +gMC->Gsatt("BTR3","seen",0); +gMC->Gsatt("BTO3","seen",0); /* gMC->Gsatt("B043","seen",0); gMC->Gsatt("B046","seen",0); @@ -42,19 +42,18 @@ gMC->Gsatt("B062","seen",0); gMC->Gsatt("B073","seen",0); */ -// gMC->Gsatt("UAFI","seen",1); -// gMC->Gsatt("UAFM","seen",1); -// gMC->Gsatt("UAFO","seen",1); -// gMC->Gsatt("UAII","seen",0); -// gMC->Gsatt("UAIM","seen",0); -// gMC->Gsatt("UAIO","seen",0); -// gMC->Gsatt("UCFI","seen",0); -// gMC->Gsatt("UCFM","seen",0); -// gMC->Gsatt("UCFO","seen",0); -// gMC->Gsatt("UCII","seen",0); -// gMC->Gsatt("UCIM","seen",0); -// gMC->Gsatt("UCIO","seen",0); -/* +gMC->Gsatt("UAFI","seen",1); +gMC->Gsatt("UAFM","seen",1); +gMC->Gsatt("UAFO","seen",1); +gMC->Gsatt("UAII","seen",0); +gMC->Gsatt("UAIM","seen",0); +gMC->Gsatt("UAIO","seen",0); +gMC->Gsatt("UCFI","seen",0); +gMC->Gsatt("UCFM","seen",0); +gMC->Gsatt("UCFO","seen",0); +gMC->Gsatt("UCII","seen",0); +gMC->Gsatt("UCIM","seen",0); +gMC->Gsatt("UCIO","seen",0); gMC->Gsatt("UL01","seen",1); gMC->Gsatt("UL02","seen",1); gMC->Gsatt("UL03","seen",1); @@ -66,8 +65,7 @@ gMC->Gsatt("UL08","seen",1); gMC->Gsatt("UL09","seen",1); gMC->Gsatt("UL10","seen",1); gMC->Gsatt("UL11","seen",1); -*/ -// gMC->Gsatt("TRD1","seen",0); -// gMC->Gsatt("TRD2","seen",0); -// gMC->Gsatt("TRD3","seen",0); +gMC->Gsatt("TRD1","seen",0); +gMC->Gsatt("TRD2","seen",0); +gMC->Gsatt("TRD3","seen",0); } diff --git a/macros/analHits.C b/macros/analHits.C index 11bc2fb72cc..f21269cbea4 100644 --- a/macros/analHits.C +++ b/macros/analHits.C @@ -56,6 +56,7 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L AliTPChit *tpcHit; AliTPCTrackHits *tpc2Hit; AliTRDhit *trdHit; + AliCASTORhit *castorHit; AliZDCHit *zdcHit; AliEMCALHit *emcalHit; @@ -71,6 +72,7 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L AliTPC *TPC = (AliTPC*) gAlice->GetDetector("TPC"); AliTPC *TPC = (AliTPC*) gAlice->GetDetector("TPC"); AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD"); + AliCASTOR *CASTOR = (AliCASTOR*) gAlice->GetDetector("CASTOR"); AliZDC *ZDC = (AliZDC*) gAlice->GetDetector("ZDC"); AliEMCAL *EMCAL = (AliEMCAL*) gAlice->GetDetector("EMCAL"); @@ -89,6 +91,7 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L if(TOF) TH1F *hTOF = new TH1F("hTOF" ,"Time of Flight",100,0.,1.e-5); if(TPC) TH1F *hTPC = new TH1F("hTPC" ,"Charge",100,0.,70.2); if(TRD) TH1F *hTRD = new TH1F("hTRD" ,"Charge",100,0.,10.); + if(CASTOR)TH1F *hCASTOR= new TH1F("hCASTOR","Hit Radius",100,0.,10.); if(ZDC) TH1F *hZDC = new TH1F("hZDC" ,"Energy",100,0.,5.); if(EMCAL) TH1F *hEMCAL = new TH1F("hEMCAL" ,"Energy",100,0.,2.); // TH1F *hTPAR = new TH1F("hTPAR" ,"?",6,1,7); @@ -133,7 +136,7 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L if(RICH){ for(richHit=(AliRICHHit*)RICH->FirstHit(-1);richHit; richHit=(AliRICHHit*)RICH->NextHit()){ - hRICH->Fill(richHit->Eloss()); + hRICH->Fill(richHit->fEloss); } // end for richHit } // end if RICH if(START){ @@ -155,6 +158,12 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L hTRD->Fill((Float_t)(trdHit->GetCharge())); } // end for } // end if TRD + if(CASTOR) { + for(castorHit=(AliCASTORhit*)CASTOR->FirstHit(-1);castorHit; + castorHit=(AliCASTORhit*)CASTOR->NextHit()) { + hCASTOR->Fill(TMath::Hypot(castorHit->X(),castorHit->Y())); + } // end for + } // end if CASTOR if(ZDC){ for(zdcHit=(AliZDCHit*)ZDC->FirstHit(-1);zdcHit; zdcHit=(AliZDCHit*)ZDC->NextHit()){ @@ -229,6 +238,11 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L hTRD->Draw(); c0->SaveAs("analHitsTRD.ps"); } // end if TRD + if(CASTOR){ + hCASTOR->SetFillColor(42); + hCASTOR->Draw(); + c0->SaveAs("analHitsCASTOR.ps"); + } // end if TRD if(ZDC){ hZDC->SetFillColor(42); hZDC->Draw(); @@ -239,4 +253,20 @@ void analHits (const char *filename="galice.root",Int_t evNumber=0, char *opt="L hEMCAL->Draw(); c0->SaveAs("analHitsEMCAL.ps"); } // end if ZDC + +// Clean Up + /* + if(FMD) delete hFMD; + if(ITS) delete hITS; + if(MUON) delete hMUON; + if(PHOS) delete hPHOS; + if(PMD) delete hPMD; + if(RICH) delete hRICH; + if(START) delete hSTART; + if(TOF) delete hTOF; + if(TPC) delete hTPC; + if(TRD) delete hTRD; + if(CASTOR) delete hCASTOR; + if(ZDC) delete hZDC; + */ } diff --git a/macros/display.C b/macros/display.C index 6355c2ca8bf..98d394d0921 100644 --- a/macros/display.C +++ b/macros/display.C @@ -10,33 +10,48 @@ void display (const char *filename="galice.root",Int_t nevent=0, Int_t * tracks= gROOT->LoadMacro("loadlibs.C"); loadlibs(); } else { + delete gAlice->GetRunLoader(); delete gAlice; gAlice = 0; } // Connect the Root Galice file containing Geometry, Kine and Hits - + AliRunLoader *rl = 0x0; TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); if(file){ cout<<"galice.root is already open \n"; } - else { - if(!file)file=TFile::Open(filename); - } + + rl = AliRunLoader::Open(filename,"DISPLAYED EVENT"); + + if (rl == 0x0) + { + cerr<<"Error : can not get Run Loader. Exiting"<LoadgAlice(); + + gAlice = rl->GetAliRun(); if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) printf("AliRun object found on file\n"); - if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); - } - + cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; + return; + } + // Create Event Display object AliDisplay *edisplay = new AliDisplay(750); if (ntracks>0) edisplay->SetTracksToDisplay(tracks, ntracks); // Display the requested event - gAlice->GetEvent(nevent); + rl->GetEvent(nevent); + rl->LoadKinematics(); + rl->LoadHeader(); + rl->LoadHits(); + + AliDisplay *edisplay = new AliDisplay(750); + edisplay->ShowNextEvent(0); // Define the buttons to switch on/off the existing modules diff --git a/macros/loadlibs.C b/macros/loadlibs.C index 4f17f8b54c3..8e3eba2faf1 100644 --- a/macros/loadlibs.C +++ b/macros/loadlibs.C @@ -20,7 +20,6 @@ void loadlibs () gSystem->Load("libdummyepemgen"); gSystem->Load("libTEPEMGEN"); - gSystem->Load("libPhysics"); gSystem->Load("libCONTAINERS"); @@ -37,7 +36,7 @@ void loadlibs () gSystem->Load("libITS"); gSystem->Load("libCRT"); gSystem->Load("libSTART"); - gSystem->Load("libEMCAL"); +// gSystem->Load("libEMCAL"); gSystem->Load("libVZERO"); gSystem->Load("libdummyherwig"); gSystem->Load("libTHerwig"); diff --git a/macros/plotField.C b/macros/plotField.C index d3a9c869d10..34d6a3cf7be 100644 --- a/macros/plotField.C +++ b/macros/plotField.C @@ -6,7 +6,7 @@ void plotField(Int_t iField = 0) // 2 5 kG solenoid // // load necessary libraries -// gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libminicern"); + gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libminicern"); gSystem->Load("$(ROOTSYS)/lib/libPhysics"); gSystem->Load("$(ROOTSYS)/lib/libEG"); gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libSTEER"); diff --git a/share/alibtool b/share/alibtool index 2fe1fd2259b..0b4276376c1 100755 --- a/share/alibtool +++ b/share/alibtool @@ -1,10 +1,16 @@ #!/bin/sh + +# $Id$ + ############################################################################# # alibtool - a shell script to help makeing modules for AliRoot Makefile ############################################################################# # # modification history # $Log$ +# Revision 1.5 2003/05/02 15:11:52 hristov +# Changes to avoid warnings (I.Hrivnacova) +# # Revision 1.4 2002/10/14 14:57:45 hristov # Merging the VirtualMC branch to the main development branch (HEAD) # -- 2.39.3