From ede9aff73f56fc60581461df62c1323a43e8fc5a Mon Sep 17 00:00:00 2001 From: alla Date: Wed, 27 Mar 2002 18:13:59 +0000 Subject: [PATCH] Digitizer --- START/AliSTART.h | 1 + START/AliSTARTDigitizer.cxx | 194 ++++++++++++++++++++++++++++++++++++ START/AliSTARTDigitizer.h | 36 +++++++ START/libSTART.pkg | 2 +- 4 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 START/AliSTARTDigitizer.cxx create mode 100644 START/AliSTARTDigitizer.h diff --git a/START/AliSTART.h b/START/AliSTART.h index 398fa4915e4..31aaad4dae6 100755 --- a/START/AliSTART.h +++ b/START/AliSTART.h @@ -33,6 +33,7 @@ public: virtual void DrawDetector(){} virtual Int_t IsVersion()const {return 0;} virtual void Init(); + virtual void SetHitsAddressBranch(TBranch *b){b->SetAddress(&fHits);} void Hit2digit(Int_t iEventNum); void Hit2digit(){return;} virtual void MakeBranch(Option_t *opt=" ", const char *file=0); diff --git a/START/AliSTARTDigitizer.cxx b/START/AliSTARTDigitizer.cxx new file mode 100644 index 00000000000..d9b9a51dc2f --- /dev/null +++ b/START/AliSTARTDigitizer.cxx @@ -0,0 +1,194 @@ + +/************************************************************************** + * Copyright(c) 1998-2000, 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. * + **************************************************************************/ + + +#include +#include +#include +#include +#include +#include + + +#include "AliSTARTDigitizer.h" +#include "AliSTART.h" +#include "AliSTARThit.h" +#include "AliSTARTdigit.h" +#include "AliRunDigitizer.h" + +#include "AliRun.h" +#include "AliPDG.h" + +#include +#include +#include + +ClassImp(AliSTARTDigitizer) + +//___________________________________________ + AliSTARTDigitizer::AliSTARTDigitizer() :AliDigitizer() +{ +// Default ctor - don't use it + ; +} + +//___________________________________________ +AliSTARTDigitizer::AliSTARTDigitizer(AliRunDigitizer* manager) + :AliDigitizer(manager) +{ + cout<<"AliSTARTDigitizer::AliSTARTDigitizer"<2) + // cerr<<"AliSTARTDigitizer::AliSTARTDigitizer" + // <<"(AliRunDigitizer* manager) was processed"<SDigits2Digits start...\n"; +#endif + // + // From hits to digits + // + Int_t hit; + Int_t nhits; + Int_t volume,pmt; + char nameDigits[20]; + Float_t timediff,timeright,timeleft,timeav; + Float_t besttimeright,besttimeleft,meanTime; + Int_t channelWidth=10; + fHits = new TClonesArray ("AliSTARThit", 1000); + AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); + + AliSTARThit *startHit; + TBranch *brHits=0; + fdigits= new AliSTARTdigit(); + + Int_t nFiles=fManager->GetNinputs(); + for (Int_t inputFile=0; inputFileGetOutputEventNr()); + + besttimeright=9999.; + besttimeleft=9999.; + Int_t timeDiff=0; + Int_t timeAv=0; + TClonesArray *STARThits = START->Hits (); + + TTree *th = fManager->GetInputTreeH(inputFile); + brHits = th->GetBranch("START"); + if (brHits) { + START->SetHitsAddressBranch(brHits); + }else{ + cerr<<"EXEC Branch START hit not found"<GetEntries(); + if (ntracks<=0) return; + // Start loop on tracks in the hits containers + for (Int_t track=0; trackGetEntry(track); + nhits = STARThits->GetEntriesFast(); + for (hit=0;hitUncheckedAt(hit); + pmt=startHit->fPmt; + 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)Set(timeAv,timeDiff); + fdigits->Print(); + } + else + {timeAv=999999; timeDiff=99999;} + +// trick to find out output dir: + TTree *outTree = fManager->GetTreeD(); + if (!outTree) { + cerr<<"something wrong with output...."<GetDirectory()->cd(); + fdigits->Write(nameDigits); + wd->cd(); + } + +} + + diff --git a/START/AliSTARTDigitizer.h b/START/AliSTARTDigitizer.h new file mode 100644 index 00000000000..0b16e1b5b7f --- /dev/null +++ b/START/AliSTARTDigitizer.h @@ -0,0 +1,36 @@ +#ifndef ALISTARTDIGITIZER_H +#define ALISTARTDIGITIZER_H +/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliDigitizer.h" + +class AliRunDigitizer; +class AliSTART; +class AliSTARThit; +class AliSTARTdigit; + +class AliSTARTDigitizer : public AliDigitizer { + public: + + AliSTARTDigitizer(); + AliSTARTDigitizer(AliRunDigitizer * manager); + virtual ~AliSTARTDigitizer(); + virtual Bool_t Init(); + TClonesArray *Hits() const {return fHits;} + + // Do the main work + void Exec(Option_t* option=0) ; + + enum {kBgTag = -1}; + +private: + + AliSTART *START; + TClonesArray *fHits ; // List of summable digits + AliSTARTdigit *fdigits ; // digits + + ClassDef(AliSTARTDigitizer,0) +}; +#endif + diff --git a/START/libSTART.pkg b/START/libSTART.pkg index 2e3d7a5d8de..d93d5e01f49 100644 --- a/START/libSTART.pkg +++ b/START/libSTART.pkg @@ -1,4 +1,4 @@ -SRCS= AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx +SRCS= AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx AliSTARTDigitizer.cxx HDRS= $(SRCS:.cxx=.h) -- 2.39.3