/************************************************************************** * 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 #include #include "AliSTARTDigitizer.h" #include "AliSTART.h" #include "AliSTARThit.h" #include "AliSTARThitPhoton.h" #include "AliSTARTdigit.h" #include "AliRunDigitizer.h" #include "AliHeader.h" #include "AliGenEventHeader.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, 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; Float_t besttimeleftGaus, besttimerightGaus; Float_t timeright[13]={13*0}; Float_t timeleft[13]={13*0}; Float_t channelWidth=2.5; //ps Int_t channelWidthADC=1; //ps // Int_t thresholdAmpl=10; ftimeRightTDC = new TArrayI(12); ftimeLeftTDC = new TArrayI(12); fRightADC = new TArrayI(12); fLeftADC = new TArrayI(12); fHits = new TClonesArray ("AliSTARThit", 1000); fPhotons = new TClonesArray ("AliSTARThitPhoton", 10000); //!!! AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); AliSTARThit *startHit; AliSTARThitPhoton *startHitPhoton; //!!! TBranch *brHits=0; TBranch *brHitPhoton=0; fdigits= new AliSTARTdigit(); Int_t nFiles=fManager->GetNinputs(); for (Int_t inputFile=0; inputFileHits (); TClonesArray *STARThitsPhotons = START->Photons (); TTree *th = fManager->GetInputTreeH(inputFile); brHits = th->GetBranch("START"); brHitPhoton = th->GetBranch("STARThitPhoton"); if (brHits) { START->SetHitsAddressBranch(brHits,brHitPhoton); }else{ cerr<<"EXEC Branch START hit not found"<GetEntries(); cout<<" ntracks "< GetEntry(track);; nhits = STARThitsPhotons->GetEntriesFast(); for (hit=0;hitUncheckedAt(hit); pmt=startHitPhoton->fPmt; volume = startHitPhoton->fArray; if(RegisterPhotoE(startHitPhoton)) { if (volume == 1) CountEr[pmt]++; if (volume == 2) CountEl[pmt]++; } } //hit photons } //track photons } // was photons // 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[pmt] = startHit->fTime; if(timeright[pmt]thresholdAmpl) { besttimeright=timeright[pmt]; } //timeright }//time for right shoulder if(volume==2){ timeleft[pmt] = startHit->fTime; if(timeleft[pmt]thresholdAmpl) { besttimeleft=timeleft[pmt]; } //timeleftbest }//time for left shoulder } //hit loop } //track loop // z position cout<<" right time "<Gaus(besttimeright,0.05); // cout<<" besttimerightGaus "<Gaus(besttimeleft,0.05); bestLeftADC=Int_t (besttimeleftGaus*1000/channelWidth); timediff=besttimerightGaus-besttimeleftGaus; cout<<" timediff in ns "<SetSumADCRight(sumRight); } 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(); } } //------------------------------------------------------------------------ Bool_t AliSTARTDigitizer::RegisterPhotoE(AliSTARThitPhoton *hit) { Double_t P = 0.2; Double_t p; p = gRandom->Rndm(); if (p > P) return kFALSE; return kTRUE; }