From ef51244a85b4a68df6da3dbbdf3cacb21807397e Mon Sep 17 00:00:00 2001 From: fca Date: Thu, 13 Jul 2000 16:41:29 +0000 Subject: [PATCH] New START corrected for coding conventions --- START/AliSTART.cxx | 120 +++++++++++++++++++-------------------- START/AliSTART.h | 19 ++----- START/AliSTARTdigit.cxx | 9 ++- START/AliSTARTdigit.h | 20 ++++--- START/AliSTARThit.h | 4 +- START/AliSTARTv0.cxx | 25 ++++---- START/AliSTARTv1.cxx | 49 +++++++++------- START/AliSTARTvertex.cxx | 48 +++++++++------- START/AliSTARTvertex.h | 2 +- START/DigitMaker.C | 75 ++++++++++++++++++++++++ START/DrawSTART.C | 5 +- START/Makefile | 3 +- START/STARTLinkDef.h | 2 + START/ViewSTART.C | 5 +- START/readDigits.C | 67 ++++++++++++++++++++++ START/readVertex.C | 69 ++++++++++++++++++++++ START/vertex.C | 37 ++++++++++++ 17 files changed, 410 insertions(+), 149 deletions(-) create mode 100644 START/DigitMaker.C create mode 100644 START/readDigits.C create mode 100644 START/readVertex.C create mode 100644 START/vertex.C diff --git a/START/AliSTART.cxx b/START/AliSTART.cxx index b37874b9765..aafe78dd17c 100755 --- a/START/AliSTART.cxx +++ b/START/AliSTART.cxx @@ -15,6 +15,9 @@ /* $Log$ +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 @@ -67,7 +70,9 @@ Introduction of the Copyright and cvs Log #include "AliSTARTvertex.h" ClassImp(AliSTART) - AliSTARTdigit *digits; + +static AliSTARTdigit *digits; + //_____________________________________________________________________________ AliSTART::AliSTART() { @@ -127,25 +132,25 @@ void AliSTART::BuildGeometry() // // Build simple ROOT TNode geometry for event display // - TNode *Node, *Top; + TNode *node, *top; const int kColorSTART = 19; // - Top=gAlice->GetGeometry()->GetNode("alice"); + top=gAlice->GetGeometry()->GetNode("alice"); // START define the different volumes new TRotMatrix("rot999","rot999", 90,0,90,90,180,0); new TTUBE("S_STR1","START volume 1","void",5.,10.7,5.3); - Top->cd(); - Node = new TNode("STR1","STR1","S_STR1",0,0,75.,""); - Node->SetLineColor(kColorSTART); - fNodes->Add(Node); + top->cd(); + node = new TNode("STR1","STR1","S_STR1",0,0,75.,""); + node->SetLineColor(kColorSTART); + fNodes->Add(node); new TTUBE("S_STR2","START volume 2","void",5.,10.7,5.3); - Top->cd(); - Node = new TNode("STR2","STR2","S_STR2",0,0,-75,"rot999"); - Node->SetLineColor(kColorSTART); - fNodes->Add(Node); + top->cd(); + node = new TNode("STR2","STR2","S_STR2",0,0,-75,"rot999"); + node->SetLineColor(kColorSTART); + fNodes->Add(node); } //_____________________________________________________________________________ @@ -184,7 +189,9 @@ void AliSTART::Init() //--------------------------------------------------------------------------- void AliSTART::MakeBranch(Option_t* option) { - + // + // Specific START branches + // AliSTARTdigit *digits; // Create Tree branches for the START. Int_t buffersize = 400; @@ -193,9 +200,9 @@ void AliSTART::MakeBranch(Option_t* option) AliDetector::MakeBranch(option); - TTree *TD = gAlice->TreeD(); + TTree *td = gAlice->TreeD(); digits = new AliSTARTdigit(); - TD->Branch(branchname,"AliSTARTdigit",&digits, buffersize); + td->Branch(branchname,"AliSTARTdigit",&digits, buffersize); printf("Making Branch %s for digits\n",branchname); /* @@ -208,16 +215,18 @@ void AliSTART::MakeBranch(Option_t* option) void AliSTART::Hit2digit(Int_t evnum) { - - Float_t x,y,z,e; + // + // From hits to digits + // + Float_t x,y,e; Int_t nbytes = 0; - Int_t j,hit; + 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 channel_width=10; + Int_t channelWidth=10; TParticle *particle; AliSTARThit *startHit; @@ -228,45 +237,34 @@ void AliSTART::Hit2digit(Int_t evnum) digits= new AliSTARTdigit(); TBranch *bDig=0; - /* - // Create histograms - - TH1F *hTimediff = new TH1F("hTimediff","Time different",100,-2,2); - TH1F *hMeanTime = new TH1F("hMeanTime","Mean Time",100,2.2,2.8); - - TH1F *hTime1stright = new TH1F("hTime1stright","Time flight of 1st particle right", 100,1.5,3.2); - TH1F *hTime1stleft = new TH1F("hTime1sleft","Time flight of 1st particle left",100,1.5,3.2); - - */ - // AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); // Event ------------------------- LOOP sprintf(nameTD,"TreeD%d",evnum); - TTree *TD = new TTree(nameTD,"START"); - bDig = TD->Branch("START","AliSTARTdigit",&digits,buffersize,split); + TTree *td = new TTree(nameTD,"START"); + bDig = td->Branch("START","AliSTARTdigit",&digits,buffersize,split); besttimeright=9999.; besttimeleft=9999.; - Int_t Timediff=0; - Int_t Timeav=0; + Int_t timeDiff=0; + Int_t timeAv=0; Int_t nparticles = gAlice->GetEvent(evnum); if (nparticles <= 0) return; printf("\n nparticles %d\n",nparticles); - TClonesArray *Particles = gAlice->Particles(); + TClonesArray *particles = gAlice->Particles(); sprintf(nameTH,"TreeH%d",evnum); printf("%s\n",nameTH); - TTree *TH = gAlice->TreeH(); - Int_t ntracks = (Int_t) TH->GetEntries(); + 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=(TParticle*)Particles->UncheckedAt(track); + nbytes += th->GetEvent(track); + particle=(TParticle*)particles->UncheckedAt(track); nhits =fHits->GetEntriesFast(); for (hit=0;hitGaus(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.) + Float_t besttimerightGaus=gRandom->Gaus(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 - // hTimediff->Fill(timediff); - //hMeanTime->Fill(meanTime); - Float_t pp_bunch=25; + //we assume centre of bunch is 5ns after TTS signal + //TOF values are relative of the end of bunch + Float_t ppBunch=25; - pp_bunch=pp_bunch-10/2; + ppBunch=ppBunch-10/2; Float_t t1=1000.*besttimeleftGaus; Float_t t2=1000.*besttimerightGaus; - t1=t1/channel_width+pp_bunch; //time in ps to channel_width - t2=t2/channel_width+pp_bunch; //time in ps to channel_width + 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/channel_width; // time in ps - - - Timeav = (Int_t)(timeav); // time in ps - Timediff = (Int_t)(timediff); // time in ps - digits->Set(Timeav,Timediff); - TD->Fill(); + 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(); digits->MyDump(); - TD->Write(); - } //timediff + printf("digits-> %d \n",digits->GetTime()); + td->Write(); + // } //timediff } // end macro @@ -340,5 +339,6 @@ void AliSTART::Hit2digit(Int_t evnum) + diff --git a/START/AliSTART.h b/START/AliSTART.h index 08c0164dd62..ef58e0dd3cc 100755 --- a/START/AliSTART.h +++ b/START/AliSTART.h @@ -1,5 +1,5 @@ -#ifndef START_H -#define START_H +#ifndef ALISTART_H +#define ALISTART_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -18,16 +18,14 @@ R__EXTERN TDirectory * gDirectory; class AliSTART : public AliDetector { -public: - Int_t fZposit; public: AliSTART(); AliSTART(const char *name, const char *title); virtual ~AliSTART() {} - virtual void AddHit(Int_t, Int_t*, Float_t*); - virtual void AddDigit(Int_t*, Int_t*); + virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits); + virtual void AddDigit(Int_t *tracks, Int_t *digits); virtual void BuildGeometry(); virtual void CreateGeometry(){} virtual void CreateMaterials(){} @@ -39,15 +37,6 @@ public: void Hit2digit(){return;} virtual void MakeBranch(Option_t *opt=" "); virtual void StepManager(){} - /* - TTree *fTreeD; //tree - TTree * GetTree() { return fTreeD;}//return reference to actual tree - Bool_t SetTree(Int_t nevent=0, TDirectory *dir = gDirectory);//map tree from given directory - Bool_t MakeTree(Int_t nevent=0);//map tree from given directory - */ - - // void Fill(); - // void Write(); protected: Int_t fIdSens; // Sensetive Cherenkov radiator diff --git a/START/AliSTARTdigit.cxx b/START/AliSTARTdigit.cxx index 60cd3b292ae..72fc1477484 100644 --- a/START/AliSTARTdigit.cxx +++ b/START/AliSTARTdigit.cxx @@ -14,6 +14,9 @@ **************************************************************************/ /* $Log$ +Revision 1.2 2000/03/24 17:40:35 alla +New AliSTART + */ #include #include @@ -33,10 +36,10 @@ AliSTARTdigit::AliSTARTdigit(Int_t Timeav, Int_t Timediff) // AliSTARTdigit data members from the array digits. The array of track // numbers are passed to the AliDigit creator. The order of the elements // in the digits array are fEvent = digits[0], fAmplitude = digits[1], - // fTime_average = digits[1], fTime_diff = digits[1], and fDet = digits[4]. + // fTimeAverage = digits[1], fTimeDiff = digits[1], and fDet = digits[4]. // Therefore the array digits is expected to be at least 5 elements long. // - Timeav = fTime_average; - Timediff = fTime_diff; + Timeav = fTimeAverage; + Timediff = fTimeDiff; } diff --git a/START/AliSTARTdigit.h b/START/AliSTARTdigit.h index f98762f86c7..7070499eeb7 100644 --- a/START/AliSTARTdigit.h +++ b/START/AliSTARTdigit.h @@ -1,5 +1,5 @@ -#ifndef STARTDIGIT_H -#define STARTDIGIT_H +#ifndef ALISTARTDIGIT_H +#define ALISTARTDIGIT_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -9,9 +9,9 @@ //___________________________________________ class AliSTARTdigit: public TObject { //////////////////////////////////////////////////////////////////////// - public: - Int_t fTime_average; // Average time - Int_t fTime_diff; // Time difference + protected: + Int_t fTimeAverage; // Average time + Int_t fTimeDiff; // Time difference public: @@ -19,19 +19,21 @@ class AliSTARTdigit: public TObject { AliSTARTdigit(Int_t , Int_t ); virtual ~AliSTARTdigit() {} void Set(Int_t, Int_t); + Int_t GetTime(); void MyDump(); ClassDef(AliSTARTdigit,1) //Digit (Header) object for set:START }; -inline AliSTARTdigit::AliSTARTdigit(){fTime_average=99999.;fTime_diff=99999.;} +inline AliSTARTdigit::AliSTARTdigit(){fTimeAverage=999999;fTimeDiff=999999;} +inline Int_t AliSTARTdigit::GetTime(){return fTimeDiff;} inline void AliSTARTdigit::Set(Int_t Timeav, Int_t Timediff) - {fTime_average=Timeav; fTime_diff=Timediff;} + {fTimeAverage=Timeav; fTimeDiff=Timediff;} inline void AliSTARTdigit::MyDump(){ - printf("AliSTARTdigit: fTime_average=%d, fTime_diff=%d\n", - fTime_average, fTime_diff); + printf("AliSTARTdigit: fTimeAverage=%d, fTimeDiff=%d\n", + fTimeAverage, fTimeDiff); } #endif diff --git a/START/AliSTARThit.h b/START/AliSTARThit.h index c98a147c6da..1032b85e693 100644 --- a/START/AliSTARThit.h +++ b/START/AliSTARThit.h @@ -1,5 +1,5 @@ -#ifndef AliSTARThit_H -#define AliSTARThit_H +#ifndef ALISTARTHIT_H +#define ALISTARTHIT_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ diff --git a/START/AliSTARTv0.cxx b/START/AliSTARTv0.cxx index 8706954bdab..f4db1dc8135 100755 --- a/START/AliSTARTv0.cxx +++ b/START/AliSTARTv0.cxx @@ -15,6 +15,9 @@ /* $Log$ +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 @@ -115,7 +118,7 @@ void AliSTARTv0::CreateGeometry() gMC->Gsvolu("PMT ","TUBE",idtmed[3],ppmt,3); gMC->Gsvolu("DIVI","TUBE",idtmed[3],pdivider,3); -// first ring: 13 units of Scintillator+PMT+divider +// first ring: 12 units of Scintillator+PMT+divider Double_t dang1 = 2*TMath::Pi()/12; for (is=1; is<=12; is++) { @@ -216,8 +219,8 @@ void AliSTARTv0::CreateGeometry() //------------------------------------------------------------------------ void AliSTARTv0::CreateMaterials() { - Int_t ISXFLD = gAlice->Field()->Integ(); - Float_t SXMGMX = gAlice->Field()->Max(); + Int_t isxfld = gAlice->Field()->Integ(); + Float_t sxmgmx = gAlice->Field()->Max(); Float_t a,z,d,radl,absl,buf[1]; Int_t nbuf; @@ -286,14 +289,14 @@ void AliSTARTv0::CreateMaterials() AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber); - AliMedium(1, "START Air$", 2, 0, ISXFLD, SXMGMX, 10., .1, 1., .003, .003); - AliMedium(2, "Scintillator$", 5, 1, ISXFLD, SXMGMX, 10., .01, 1., .003, .003); - AliMedium(3, "Vacuum$", 1, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(4, "Ceramic$", 9, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(6, "Glass$", 4, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(8, "Steel$", 0, 0, ISXFLD, SXMGMX, 1., .001, 1., .001, .001); - AliMedium(11, "Brass $", 6, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(9, "Ribber $", 7, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); + AliMedium(1, "START Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003); + AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003); + AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(6, "Glass$", 4, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001); + AliMedium(11, "Brass $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(9, "Ribber $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); // geant3->Gsckov(idtmed[2105], 14, ppckov, absco_quarz, effic_all,rindex_quarz); diff --git a/START/AliSTARTv1.cxx b/START/AliSTARTv1.cxx index 253624cd40a..396466df125 100755 --- a/START/AliSTARTv1.cxx +++ b/START/AliSTARTv1.cxx @@ -75,6 +75,7 @@ void AliSTARTv1::CreateGeometry() Float_t x,y,z; Float_t pstart[3]={4.5,10.7,5.3}; + Float_t pinstart[3]={0.,1.3,5.25}; Float_t ppmt[3]={0.,1.3,3.5}; Float_t pdivider[3]={0.,1.2,1.75}; Float_t pdiv2[3]={0.,1.2,1.25}; @@ -106,6 +107,7 @@ void AliSTARTv1::CreateGeometry() gMC->Gspos("STRT",2,"ALIC",0.,0.,-zdet,idrotm[901],"ONLY"); //START interior + gMC->Gsvolu("INST","TUBE",idtmed[1],pinstart,3); gMC->Gsvolu("PMT ","TUBE",idtmed[3],ppmt,3); gMC->Gsvolu("DIVI","TUBE",idtmed[3],pdivider,3); @@ -119,12 +121,18 @@ void AliSTARTv1::CreateGeometry() theta, 180.+30.*is); x=6.5*TMath::Sin(is*dang1); y=6.5*TMath::Cos(is*dang1); - z=-pstart[2]+ppmt[2]; - gMC->Gspos("PMT ",is,"STRT",x,y,z,idrotm[901+is],"ONLY"); + z=-pstart[2]+pinstart[2]; + gMC->Gspos("INST",is,"STRT",x,y,z,idrotm[901+is],"ONLY"); printf("z PMT %f\n",z); - z=z+ppmt[2]+pdiv2[2]-pdiv1[2]; + + + x=0; + y=0; + z=-pinstart[2]+ppmt[2]; printf(" is %d, z Divider %f\n",is,z); - gMC->Gspos("DIVI",is,"STRT",x,y,z,idrotm[901+is],"ONLY"); + gMC->Gspos("PMT ",is,"INST",x,y,z,0,"ONLY"); + z=pinstart[2]-pdivider[2]; + gMC->Gspos("DIVI",is,"INST",x,y,z,0,"ONLY"); } /* //second ring: 20 units of Scintillator+PMT+divider @@ -214,8 +222,8 @@ void AliSTARTv1::CreateGeometry() //------------------------------------------------------------------------ void AliSTARTv1::CreateMaterials() { - Int_t ISXFLD = gAlice->Field()->Integ(); - Float_t SXMGMX = gAlice->Field()->Max(); + Int_t isxfld = gAlice->Field()->Integ(); + Float_t sxmgmx = gAlice->Field()->Max(); Float_t a,z,d,radl,absl,buf[1]; Int_t nbuf; @@ -258,9 +266,6 @@ void AliSTARTv1::CreateMaterials() Float_t absco_quarz[14] = { 20.126,16.27,13.49,11.728,9.224,8.38,7.44,7.17, 6.324,4.483,1.6,.323,.073,0. }; */ - Int_t *idtmed = fIdtmed->GetArray()-2100; - - // TGeant3 *geant3 = (TGeant3*) gMC; //*** Definition Of avaible START materials *** AliMaterial(0, "START Steel$", 55.850,26.,7.87,1.76,999); @@ -284,14 +289,14 @@ void AliSTARTv1::CreateMaterials() AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber); - AliMedium(1, "START Air$", 2, 0, ISXFLD, SXMGMX, 10., .1, 1., .003, .003); - AliMedium(2, "Scintillator$", 5, 1, ISXFLD, SXMGMX, 10., .01, 1., .003, .003); - AliMedium(3, "Vacuum$", 1, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(4, "Ceramic$", 9, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(6, "Glass$", 4, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(8, "Steel$", 0, 0, ISXFLD, SXMGMX, 1., .001, 1., .001, .001); - AliMedium(9, "Ribber $", 7, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); - AliMedium(11, "Brass $", 6, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003); + AliMedium(1, "START Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003); + AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003); + AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(6, "Glass$", 4, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001); + AliMedium(9, "Ribber $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); + AliMedium(11, "Brass $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003); cout<<"++++++++++++++Medium set++++++++++"<Gsckov(idtmed[2105], 14, ppckov, absco_quarz, effic_all,rindex_quarz); @@ -308,7 +313,8 @@ void AliSTARTv1::DrawDetector() gMC->Gsatt("ALIC","SEEN",0); // //Set volumes visible - gMC->Gsatt("STRT","SEEN",0); + // gMC->Gsatt("STRT","SEEN",0); + gMC->Gsatt("INST","SEEN",0); gMC->Gsatt("PMT ","SEEN",1); gMC->Gsatt("DIVI","SEEN",1); // @@ -369,8 +375,9 @@ void AliSTARTv1::StepManager() hits[2] = pos[2]; Float_t etot=gMC->Etot(); hits[4]=etot; - Int_t part= gMC->TrackPid(); - hits[5]=part; + Int_t iPart= gMC->TrackPid(); + Int_t partID=gMC->IdFromPDG(iPart); + hits[5]=partID; Float_t ttime=gMC->TrackTime(); hits[6]=ttime*1e9; edep=0; @@ -389,7 +396,7 @@ void AliSTARTv1::StepManager() Int_t i; for (i=0; i<=6; i++){ printf(" HITS on START Exit %f\n",hits[i]); } - for (i=0; i<=1; i++) { printf("START vol %d\n",vol[i]);} + // for (i=0; i<=1; i++) { printf("START vol %d\n",vol[i]);} new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->CurrentTrack(),vol,hits); } diff --git a/START/AliSTARTvertex.cxx b/START/AliSTARTvertex.cxx index ff87eafae17..d9b3509a8c9 100644 --- a/START/AliSTARTvertex.cxx +++ b/START/AliSTARTvertex.cxx @@ -14,6 +14,9 @@ **************************************************************************/ /* $Log$ +Revision 1.1 2000/03/24 17:46:58 alla +Vertex reconstruction + */ #include #include "AliSTARTvertex.h" @@ -28,7 +31,6 @@ ClassImp(AliSTARTvertex) AliSTARTvertex::AliSTARTvertex( Int_t * Zposit) { // - // Create START digit // The creator for the AliSTARTvertex class. This routine fills the // AliSTARTvertex data members from the array vertex. // The order of the elements in the vertex array are @@ -58,36 +60,38 @@ void AliSTARTvertex::Reconstruct(Int_t evNumber=1) // TParticle *particle; digits = new AliSTARTdigit(); vertex = new AliSTARTvertex(); - // AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); // Event ------------------------- LOOP - sprintf(nameTD,"TreeD%d",evNumber); - printf("%s\n",nameTD); - TTree *TD = (TTree*)gDirectory->Get(nameTD); - bd = TD->GetBranch("START"); - bd->SetAddress(&digits); - bd->GetEvent(0); - printf(" Digits: "); digits->MyDump(); - - sprintf(nameTR,"TreeR%d",evNumber); - TTree *TR = new TTree(nameTR,"START"); - bRec = TR->Branch("START","AliSTARTvertex",&vertex,buffersize,split); + sprintf(nameTD,"TreeD%d",evNumber); + printf("%s\n",nameTD); + TTree *td = (TTree*)gDirectory->Get(nameTD); + bd = td->GetBranch("START"); + bd->SetAddress(&digits); + bd->GetEvent(0); + printf(" Digits: "); digits->MyDump(); + sprintf(nameTR,"TreeR%d",evNumber); + TTree *tr = new TTree(nameTR,"START"); + bRec = tr->Branch("START","AliSTARTvertex",&vertex,buffersize,split); - // TD->Print(); TD->Show(0); TD->GetBranch("START")->Dump(); + // td->Print(); td->Show(0); td->GetBranch("START")->Dump(); + digits->MyDump(); + printf("digits-> %d \n",digits->GetTime()); - if(digits->fTime_average!=0) - { - timediff=digits->fTime_diff; //time in number of channels - timePs=(timediff-128)*10.; // time in Ps + if(digits->GetTime()!=999999) + { + timediff=digits->GetTime(); //time in number of channels + timePs=(timediff-128)*10.; // time in Ps channel_width =10ps printf(" timediff %d in PS %f\n",timediff,timePs); Float_t c = 299792458/1.e9; //speed of light cm/ps - Float_t Zposit=timePs*c; - printf(" Z position %f\n",Zposit); + //Float_t c = 0.3; //speed of light mm/ps + Float_t Zposit=timePs*c;// for 0 vertex + // Float_t Zposit=timePs*c/2.;// for spread vertex + // printf(" Z position %f\n",Zposit); // vertex->GetVertex(); vertex->Set(Zposit); - TR->Fill(); - TR->Write(); + tr->Fill(); + tr->Write(); //hTimediff->Fill(timePs); //hVertex->Fill(Zposit); } diff --git a/START/AliSTARTvertex.h b/START/AliSTARTvertex.h index 6aa0dc70d0e..5887727e957 100644 --- a/START/AliSTARTvertex.h +++ b/START/AliSTARTvertex.h @@ -11,7 +11,7 @@ class AliSTARTvertex : public TObject { //////////////////////////////////////////////////////////////////////// - public: + private: Int_t fZposition; // Z position of vertex public: diff --git a/START/DigitMaker.C b/START/DigitMaker.C new file mode 100644 index 00000000000..1b47fcba15c --- /dev/null +++ b/START/DigitMaker.C @@ -0,0 +1,75 @@ +void DigitMaker (Int_t evNumber=1) +{ + ///////////////////////////////////////////////////////////////////////// + // This macro is a small example of a ROOT macro + // illustrating how to read the output of GALICE + // and fill some histograms. + // + // Root > .L anal.C //this loads the macro in memory + // Root > anal(); //by default process first event + // Root > anal(2); //process third event + //Begin_Html + /* + + */ + //End_Html + ///////////////////////////////////////////////////////////////////////// + + + // 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 = 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"); + } + + TParticle *particle; + AliSTARThit *startHit; + + Int_t buffersize=256; + Int_t split=1; + + digits= new AliSTARTdigit(); + TBranch *bDig=0; + printf("Branch\n"); + + + AliSTART *START = (AliSTART*) gAlice->GetDetector("START"); + + // Event ------------------------- LOOP + + for (j=0; jHit2digit(j); + + }// event loop + + file->Write(); + file->Close(); + + +}//endmacro + + + + + + + + + + + + + diff --git a/START/DrawSTART.C b/START/DrawSTART.C index 0c323cdde78..80448d2643e 100755 --- a/START/DrawSTART.C +++ b/START/DrawSTART.C @@ -10,7 +10,8 @@ void DrawSTART() gMC->SetClipBox("."); // gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); gMC->DefaultRange(); - gMC->Gdraw("alic", 40, 30, 0, 6, 9, .08, .08); + //gMC->Gdraw("alic", 40, 30, 0, -8, 2, 1, 1); + gMC->Gdraw("alic", 40, 30, 0, 10, 9, 1., 1.); gMC->Gdhead(1111, "START Detector"); - gMC->Gdman(13, 9, "MAN"); + // gMC->Gdman(13, 9, "MAN"); } diff --git a/START/Makefile b/START/Makefile index e1f58684356..fcd0a8ed4bb 100644 --- a/START/Makefile +++ b/START/Makefile @@ -1,3 +1,4 @@ + ###############################START Makefile################################## # Include machine specific definitions @@ -9,7 +10,7 @@ PACKAGE = START # C++ sources -SRCS = AliSTART.cxx AliSTARTv0.cxx AliSTARThit.cxx AliSTARTdigit.cxx +SRCS = AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx # C++ Headers diff --git a/START/STARTLinkDef.h b/START/STARTLinkDef.h index 6538c363e10..6d3196b0af1 100755 --- a/START/STARTLinkDef.h +++ b/START/STARTLinkDef.h @@ -10,7 +10,9 @@ #pragma link C++ class AliSTART; #pragma link C++ class AliSTARTv0; +#pragma link C++ class AliSTARTv1; #pragma link C++ class AliSTARThit; #pragma link C++ class AliSTARTdigit; +#pragma link C++ class AliSTARTvertex; #endif diff --git a/START/ViewSTART.C b/START/ViewSTART.C index 095aad2d192..4d1ba28dc31 100755 --- a/START/ViewSTART.C +++ b/START/ViewSTART.C @@ -1,7 +1,8 @@ void ViewSTART() { - gMC->Gsatt("STRT","seen",0); - gMC->Gsatt("PMT ","seen",1); + // gMC->Gsatt("STRT","seen",0); + gMC->Gsatt("INST","seen",0); + gMC->Gsatt("PMT","seen",1); gMC->Gsatt("DIVI","seen",1); } diff --git a/START/readDigits.C b/START/readDigits.C new file mode 100644 index 00000000000..9ab99bd4d49 --- /dev/null +++ b/START/readDigits.C @@ -0,0 +1,67 @@ +void readDigits(Int_t evNumber=1) +{ + + // 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"); + //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + if (!file) 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"); + } + char nameTD[8],nameTR[8]; + + TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,256); + TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,-2000,2000); + + digits = new AliSTARTdigit(); + TBranch *bd; + + + // Event ------------------------- LOOP + for (j=0; jGet(nameTD); + bd = TD->GetBranch("START"); + bd->SetAddress(&digits); + bd->GetEvent(0); + // printf(" Digits: %d \n ",digits->GetTime()); + + printf("time %d\n",digits->GetTime()); + + if(digits->GetTime()!=999999){ + Int_t timediff = digits->GetTime(); + Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps + // cout<<"timediff "<Fill(timediff); + hTimePs->Fill(timePs); + } + } + + Hfile = new TFile("figs.root","UPDATE","Histograms for STASRT digits"); + printf("Writting histograms to root file \n"); + Hfile->cd(); +//Create a canvas, set the view range, show histograms + gStyle->SetOptStat(111111); + TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600); + hTimePs->SetXTitle("arriving time, ps"); + hTimePs->SetYTitle("number of events"); + hTimePs->Write(); + + + +} // end of macro + + + + diff --git a/START/readVertex.C b/START/readVertex.C new file mode 100644 index 00000000000..a7da4b345a1 --- /dev/null +++ b/START/readVertex.C @@ -0,0 +1,69 @@ +void readVertex(Int_t evNumber=1) +{ + + // 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 = 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"); + } + char nameTD[8],nameTR[8]; + + TH1F *hVertex = new TH1F("hVertex","Z position of vertex",100,-350,350); + + digits = new AliSTARTdigit(); + vertex = new AliSTARTvertex(); + TBranch *bd; + TBranch *bRec; + + // Event ------------------------- LOOP + for (j=0; jGet(nameTD); + bd = TD->GetBranch("START"); + bd->SetAddress(&digits); + bd->GetEvent(0); + printf(" Digits: %d \n ",digits->GetTime()); + + + sprintf(nameTR,"TreeR%d",j); + printf("%s\n",nameTR); + TTree *TR = (TTree*)gDirectory->Get(nameTR); + bRec = TR->GetBranch("START"); + bRec->SetAddress(&vertex); + bRec->GetEvent(0); + if(digits->GetTime()!=999999){ + hVertex->Fill(vertex->GetVertex()); + // printf(" Z position %f\n",vertex->GetVertex()); + } + } + Hfile = new TFile("figs1.root","RECREATE","Histograms for START Vertex"); + printf("Writting histograms to root file \n"); + Hfile->cd(); + + //Create a canvas, set the view range, show histograms + + gStyle->SetOptStat(111111); + TCanvas *c1 = new TCanvas("c1","Alice START Time (vertex)",400,10,600,600); + + hVertex->SetXTitle("vertex position, mm"); + hVertex->SetYTitle("number of events"); + hVertex->Write(); + +} // end of macro + + + + diff --git a/START/vertex.C b/START/vertex.C new file mode 100644 index 00000000000..802b5472b33 --- /dev/null +++ b/START/vertex.C @@ -0,0 +1,37 @@ +void VertexMaker(Int_t evNumber=1) +{ + + // 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 = 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"); + } + + + vertex= new AliSTARTvertex(); + TBranch *bRec=0; + + + // Event ------------------------- LOOP + for (j=0; jReconstruct(j); + } + file->Write(); + file->Close(); + +} // end of macro + + + + -- 2.43.0