/************************************************************************** * 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 #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 "AliLoader.h" #include "AliRunLoader.h" #include "AliSTARTLoader.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"<GetOutputFolderName()); outgime = outRL->GetLoader("STARTLoader"); #ifdef DEBUG cout<<"AliSTARTDigitizer::>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; 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); inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); inRL->LoadgAlice(); // fHits = new TClonesArray ("AliSTARThit", 1000); fPhotons = new TClonesArray ("AliSTARThitPhoton", 10000); //!!! AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); AliSTARThit *startHit; //use if Cherenkov photons // AliSTARThitPhoton *startHitPhoton; //!!! TBranch *brHits=0; TBranch *brHitPhoton=0; fdigits= new AliSTARTdigit(); Int_t nFiles=fManager->GetNinputs(); for (Int_t inputFile=0; inputFileGetInputFolderName(inputFile)); ingime = inRL->GetLoader("STARTLoader"); ingime->LoadHits("READ");//probably it is necessary to load them before outgime->LoadDigits("UPDATE");//probably it is necessary to load them before //use if Cherenkov photons // TClonesArray *STARThitsPhotons = START->Photons (); TClonesArray *fHits = START->Hits (); // cout<<" Load "<TreeH(); 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 = fHits->GetEntriesFast(); // cout<<" brHits hits "<UncheckedAt(hit); if (!startHit) { ::Error("Exec","The unchecked hit doesn't exist"); break; } pmt=startHit->Pmt(); volume = startHit->Volume(); if(volume==1){ timeright[pmt] = startHit->Time(); if(timeright[pmt]thresholdAmpl) { besttimeright=timeright[pmt]; } //timeright }//time for right shoulder if(volume==2){ timeleft[pmt] = startHit->Time(); 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<<" besttimeleftGaus "<Gaus(besttimeleft,0.05); bestRightADC=Int_t (besttimerightGaus*1000/channelWidth); timediff=besttimerightGaus-besttimeleftGaus; cout<<" timediff in ns "<SetSumADCRight(sumRight); } else {timeAv=999999; timeDiff=99999;} // trick to find out output dir: Char_t nameDigits[20]; sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr()); TDirectory *wd = gDirectory; outgime->GetDigitsDataLoader()->GetDirectory()->cd(); fdigits->Write(nameDigits); wd->cd(); // outgime->WriteDigits("OVERWRITE"); } } //------------------------------------------------------------------------ Bool_t AliSTARTDigitizer::RegisterPhotoE(/*AliSTARThitPhoton *hit*/) { Double_t P = 0.2; Double_t p; p = gRandom->Rndm(); if (p > P) return kFALSE; return kTRUE; } //----------------------------------------------------------------------------