From f546a4b4dd8710346886b33b4be86c5ab118df6b Mon Sep 17 00:00:00 2001 From: kowal2 Date: Fri, 2 Jul 2010 12:44:02 +0000 Subject: [PATCH 1/1] LHC clock phase simulation added. Set to "0", waiting for the implementation in the reconstruction --- TPC/AliTPC.cxx | 62 +++++++++++++++++++++++++++++++++++++---- TPC/AliTPC.h | 5 +++- TPC/AliTPCDigitizer.cxx | 47 ++++++++++++++++++++----------- TPC/AliTPCParamSR.cxx | 4 +-- TPC/AliTPCParamSR.h | 2 +- 5 files changed, 93 insertions(+), 27 deletions(-) diff --git a/TPC/AliTPC.cxx b/TPC/AliTPC.cxx index 15d81f260ab..ca78d6a7b4f 100644 --- a/TPC/AliTPC.cxx +++ b/TPC/AliTPC.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include "AliDigits.h" #include "AliMagF.h" @@ -99,7 +100,8 @@ ClassImp(AliTPC) fCurrentNoise(0), fActiveSectors(0), fGainFactor(1.), - fDebugStreamer(0) + fDebugStreamer(0), + fLHCclockPhaseSw(0) { // @@ -132,8 +134,9 @@ AliTPC::AliTPC(const char *name, const char *title) fNoiseTable(0), fCurrentNoise(0), fActiveSectors(0), - fGainFactor(1.), - fDebugStreamer(0) + fGainFactor(1.), + fDebugStreamer(0), + fLHCclockPhaseSw(0) { // @@ -1309,7 +1312,25 @@ void AliTPC::Hits2Digits(Int_t eventnumber) SetDigitsArray(arr); fDigitsSwitch=0; // standard digits - + // here LHC clock phase + Float_t lhcph = 0.; + switch (fLHCclockPhaseSw){ + case 0: + // no phase + lhcph=0.; + break; + case 1: + // random phase + lhcph = (Int_t)(gRandom->Rndm()/0.25); + break; + case 2: + lhcph=0.; + // not implemented yet + break; + } + // adding phase to the TreeD user info + fLoader->TreeD()->GetUserInfo()->Add(new TParameter("lhcphase0",lhcph)); + // for(Int_t isec=0;isecGetNSector();isec++) if (IsSectorActive(isec)) { AliDebug(1,Form("Hits2Digits","Sector %d is active.",isec)); @@ -1376,6 +1397,25 @@ void AliTPC::Hits2SDigits2(Int_t eventnumber) fDigitsSwitch=1; // summable digits // set zero suppression to "0" + // here LHC clock phase + Float_t lhcph = 0.; + switch (fLHCclockPhaseSw){ + case 0: + // no phase + lhcph=0.; + break; + case 1: + // random phase + lhcph = (Int_t)(gRandom->Rndm()/0.25); + break; + case 2: + lhcph=0.; + // not implemented yet + break; + } + // adding phase to the TreeS user info + + fLoader->TreeS()->GetUserInfo()->Add(new TParameter("lhcphase0",lhcph)); fTPCParam->SetZeroSup(0); @@ -1420,7 +1460,7 @@ void AliTPC::Hits2SDigits() SetActiveSectors(); Hits2SDigits2(iEvent); } - + fLoader->UnloadHits(); fLoader->UnloadSDigits(); if (fDebugStreamer) { @@ -1681,6 +1721,15 @@ Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrixF &signal = *m1; TMatrixF &total = *m2; // + // Get LHC clock phase + // + TParameter *ph; + if(fDigitsSwitch){// s-digits + ph = (TParameter*)fLoader->TreeS()->GetUserInfo()->FindObject("lhcphase0"); + } + else{ // normal digits + ph = (TParameter*)fLoader->TreeD()->GetUserInfo()->FindObject("lhcphase0"); + } // Loop over all electrons // for(Int_t nel=0; nelGetTotalNormFac(); Float_t xyz[4]={v(idx+1),v(idx+2),v(idx+3),v(idx+5)}; - Int_t n = ((AliTPCParamSR*)fTPCParam)->CalcResponseFast(xyz,fCurrentIndex,fCurrentIndex[3]); + Int_t n = ((AliTPCParamSR*)fTPCParam)->CalcResponseFast(xyz,fCurrentIndex, + fCurrentIndex[3],ph->GetVal()); Int_t *index = fTPCParam->GetResBin(0); Float_t *weight = & (fTPCParam->GetResWeight(0)); diff --git a/TPC/AliTPC.h b/TPC/AliTPC.h index 49d44d628be..3e18a0b6759 100644 --- a/TPC/AliTPC.h +++ b/TPC/AliTPC.h @@ -94,6 +94,8 @@ public: void SetPrimaryIonisation(Bool_t flag = kTRUE) {fPrimaryIonisation = flag;} void SetGainFactor(Float_t gain){fGainFactor=gain;} //gas gain scaling factor Float_t GetGainFactor()const {return fGainFactor;}//gas gain scaling factor + // LHC clock phase switch 0 - no phase, 1 - random, 2 - from the OCDB + void SetLHCclockPhase(Int_t sw){fLHCclockPhaseSw = sw;} // static functions static AliTPCParam* LoadTPCParam(TFile *file); protected: @@ -136,7 +138,8 @@ protected: Bool_t* fActiveSectors; //! bool indicating which sectors are active Float_t fGainFactor; // scaling factor TTreeSRedirector *fDebugStreamer; //!debug streamer - ClassDef(AliTPC,13) // Time Projection Chamber class + Int_t fLHCclockPhaseSw; //! lhc clock phase switch + ClassDef(AliTPC,14) // Time Projection Chamber class }; diff --git a/TPC/AliTPCDigitizer.cxx b/TPC/AliTPCDigitizer.cxx index ebbf2d9afd8..b8c4677dcb3 100644 --- a/TPC/AliTPCDigitizer.cxx +++ b/TPC/AliTPCDigitizer.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include "AliTPCDigitizer.h" @@ -146,20 +147,33 @@ void AliTPCDigitizer::ExecFast(Option_t* option) } } - pTPC->GenerNoise(500000); //create teble with noise + pTPC->GenerNoise(500000); //create table with noise // Int_t nInputs = fManager->GetNinputs(); 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 + Int_t **ptr= new Int_t*[nInputs]; //pointers to the expanded tracks array Bool_t *active= new Bool_t[nInputs]; //flag for active input segments - + Char_t phname[100]; //create digits array for given sectors // make indexes - + // + //create branch's in TPC treeD + orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); + ogime = orl->GetLoader("TPCLoader"); + TTree * tree = ogime->TreeD(); + AliSimDigits * digrow = new AliSimDigits; + + if (tree == 0x0) + { + ogime->MakeTree("D"); + tree = ogime->TreeD(); + } + tree->Branch("Segment","AliSimDigits",&digrow); + // AliSimDigits ** digarr = new AliSimDigits*[nInputs]; for (Int_t i1=0;i1 *ph = (TParameter*)treear->GetUserInfo() + ->FindObject("lhcphase0"); + if(!ph){ + cerr<<"AliTPCDigitizer: LHC phase not found in" + <<" input "<< i1<GetUserInfo()->Add(new TParameter(phname,ph->GetVal())); + // if (treear->GetIndex()==0) treear->BuildIndex("fSegmentID","fSegmentID"); treear->GetBranch("Segment")->SetAddress(&digarr[i1]); } - //create branch's in TPC treeD - AliSimDigits * digrow = new AliSimDigits; - 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); + // param->SetZeroSup(2); diff --git a/TPC/AliTPCParamSR.cxx b/TPC/AliTPCParamSR.cxx index d4ba982941a..6cf2d1778ab 100644 --- a/TPC/AliTPCParamSR.cxx +++ b/TPC/AliTPCParamSR.cxx @@ -448,7 +448,7 @@ void AliTPCParamSR::Streamer(TBuffer &R__b) AliTPCParam::Streamer(R__b); } } -Int_t AliTPCParamSR::CalcResponseFast(Float_t* xyz, Int_t * index, Int_t row) +Int_t AliTPCParamSR::CalcResponseFast(Float_t* xyz, Int_t * index, Int_t row, Float_t phase) { // //calculate bin response as function of the input position -x @@ -525,7 +525,7 @@ Int_t AliTPCParamSR::CalcResponseFast(Float_t* xyz, Int_t * index, Int_t row) //calulate deviation Float_t dpadrow = xyz[0]; Float_t dpad = xyz[1]-cpad; - Float_t dtime = xyz[2]+zoffset2+xyz[3]-ctime; + Float_t dtime = xyz[2]+zoffset2+xyz[3]-ctime+phase*0.25; Int_t cindex =0; Int_t cindex3 =0; Int_t maxt =GetMaxTBin(); diff --git a/TPC/AliTPCParamSR.h b/TPC/AliTPCParamSR.h index a914eb32d69..114b00849a3 100644 --- a/TPC/AliTPCParamSR.h +++ b/TPC/AliTPCParamSR.h @@ -21,7 +21,7 @@ public: virtual ~AliTPCParamSR(); Int_t CalcResponse(Float_t* x, Int_t * index, Int_t row); - Int_t CalcResponseFast(Float_t* x, Int_t * index, Int_t row); + Int_t CalcResponseFast(Float_t* x, Int_t * index, Int_t row,Float_t phase); //calculate bin response as function of the input position -x //return number of valid response bin -- 2.39.3