+++ /dev/null
-/****************************************************************************
- * This macro is supposed to do reconstruction in the barrel ALICE trackers *
- * (Make sure you have TPC digits and ITS hits before using this macro !!!) *
- * It does the following steps (April 12, 2001): *
- * 1) TPC cluster finding *
- * 2) TPC track finding *
- * 3) ITS cluster finding V2 (via fast points !) *
- * 4) ITS track finding V2 *
- * 5) ITS back track propagation V2 *
- * 6) TPC back track propagation *
- * (Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch) *
- ****************************************************************************/
-
-#ifndef __CINT__
- #include "alles.h"
- #include "AliMagF.h"
- #include "AliTPCtracker.h"
-
- #include "AliITS.h"
- #include "AliITSgeom.h"
- #include "AliITSRecPoint.h"
- #include "AliITSclusterV2.h"
- #include "AliITSsimulationFastPoints.h"
- #include "AliITStrackerV2.h"
-#endif
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n);
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname);
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t ITSFindTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n);
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname);
-
-
-Int_t AliBarrelReconstruction4ITS(Int_t n=1) {
- const Char_t *TPCdigName="rfio:galice.root";
- const Char_t *TPCclsName="AliTPCclusters.root";
- const Char_t *TPCtrkName="AliTPCtracks.root";
- const Char_t *TPCtrkNameS="AliTPCtracksSorted.root";
-
-
- const Char_t *ITSdigName="rfio:galice.root";
- const Char_t *ITSclsName="AliITSclustersV2.root";
- const Char_t *ITStrkName="AliITStracksV2.root";
-
- AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
-
-
-// ********** Find TPC clusters *********** //
- if (TPCFindClusters(TPCdigName,TPCclsName, n)) {
- cerr<<"Failed to get TPC clusters !\n";
- return 1;
- }
-
-// ********** Find TPC tracks *********** //
- if (TPCFindTracks(TPCclsName,TPCtrkName,n)) {
- cerr<<"Failed to get TPC tracks !\n";
- return 1;
- }
-
-// ********** Sort and label TPC tracks *********** //
- if (TPCSortTracks(TPCclsName,TPCtrkName,TPCtrkNameS,n)) {
- cerr<<"Failed to sort TPC tracks !\n";
- return 1;
- }
-/*
-// ********** Find ITS clusters *********** //
- if (ITSFindClusters(ITSdigName,ITSclsName,n)) {
- cerr<<"Failed to get ITS clusters !\n";
- return 1;
- }
-
-// ********** Find ITS tracks *********** //
- {
- //TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSFindTracks(TPCtrkNameS,ITSclsName,ITStrkName,n)) {
- cerr<<"Failed to get ITS tracks !\n";
- return 1;
- }
- //clsFile->Close();
- }
- return 1;
-// ********** Back propagation of the ITS tracks *********** //
- {TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSPropagateBack(ITStrkName,TPCtrkNameS)) {
- cerr<<"Failed to propagate back the ITS tracks !\n";
- return 1;
- }
- clsFile->Close();}
-
-
-// ********** Back propagation of the TPC tracks *********** //
- {TFile *clsFile=TFile::Open(TPCclsName);
- if (TPCPropagateBack(TPCtrkName,TPCtrkName)) {
- cerr<<"Failed to propagate back the TPC tracks !\n";
- return 1;
- }
- clsFile->Close();}
-*/
- return 0;
-}
-
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="TPCFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
-
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCv2 tpc;
- tpc.SetParam(param);
-
- //tpc.Digits2Clusters(out); //MI change
- for (Int_t i=0;i<n;i++){
- printf("Processing event %d\n",i);
- tpc.Digits2Clusters(out,i);
- // AliTPCclusterer::Digits2Clusters(dig, out, i);
- }
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="TPCFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
- //AliTPCtracker *tracker=new AliTPCtracker(param);
- //rc=tracker->Clusters2Tracks(0,out);
- //delete tracker;
-
- for (Int_t i=0;i<n;i++){
- printf("Processing event %d\n",i);
- AliTPCtracker *tracker = new AliTPCtracker(param,i);
- //Int_t rc=
- tracker->Clusters2Tracks(0,out);
- delete tracker;
- }
-
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t * outname, Int_t eventn){
- Int_t rc=0;
- const Char_t *name="TPCSortTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out =TFile::Open(outname,"recreate");
- TFile *in1 =TFile::Open(inname);
- TFile *in2 =TFile::Open(inname2);
-
-
- AliTPCParam *param=(AliTPCParam *)in1->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
-
-
- // loop over events
- for (Int_t event=0;event<eventn; event++){
- TObjArray tarray(10000);
- AliTPCtrack *iotrack=0;
- Int_t i;
-
-
- in2->cd();
- char tname[100];
- sprintf(tname,"TreeT_TPC_%d",event);
-
- TTree *tracktree=(TTree*)in2->Get(tname);
- TBranch *tbranch=tracktree->GetBranch("tracks");
- Int_t nentr=(Int_t)tracktree->GetEntries();
- for (i=0; i<nentr; i++) {
- iotrack=new AliTPCtrack;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- tarray.AddLast(iotrack);
- }
- tarray.Sort();
- // in2->Close();
-
- //assign thacks GEANT labels
- in1->cd();
- AliTPCtracker *tracker = new AliTPCtracker(param,event);
- tracker->LoadInnerSectors();
- tracker->LoadOuterSectors();
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracker->CookLabel(iotrack,0.1);
- }
- delete tracker;
- //in->Close();
- //end of GEANT label assignment
-
- tracktree=new TTree(tname,"Tree with TPC tracks");
- tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0);
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracktree->Fill();
- }
- out->cd();
- tracktree->Write();
- }
-
- out->Close();
- in2->Close();
- in1->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="ITSFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname,"update");
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't get gAlice !\n";
- return 1;
- }
-
- AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
- if (!ITS) { cerr<<"Can't get the ITS !\n"; return 1;}
- AliITSgeom *geom=ITS->GetITSgeom();
- out->cd();
- geom->Write();
-
- Int_t ev=0;
- for (ev = 0; ev<n; ev++){
- in->cd(); // !!!! MI directory must point to galice. - othervise problem with Tree -connection
- gAlice->GetEvent(ev);
- //gAlice->TreeR()->Reset(); //reset reconstructed tree
-
-
- TTree *pTree=gAlice->TreeR();
- if (!pTree){
- gAlice->MakeTree("R");
- pTree = gAlice->TreeR();
- }
- TBranch *branch=pTree->GetBranch("ITSRecPoints");
- if (!branch) {
- //if not reconstructed ITS branch do reconstruction
- ITS->MakeBranch("R",0);
- //////////////// Taken from ITSHitsToFastPoints.C ///////////////////////
- AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
- for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,sim); }
- Int_t nsignal=25;
- Int_t size=-1;
- Int_t bgr_ev=Int_t(ev/nsignal);
- ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
- //////////////////////////////////////////////////////////////////////////
- gAlice->GetEvent(ev); //MI comment - in HitsToFast... they reset treeR to 0
- //they overwrite full reconstructed event ???? ... so lets connect TreeR one more
- //time
- }
-
-
-
- out->cd();
- TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
- char cname[100];
- sprintf(cname,"TreeC_ITS_%d",ev);
-
- TTree *cTree=new TTree(cname,"ITS clusters");
- cTree->Branch("Clusters",&clusters);
-
- pTree=gAlice->TreeR();
- if (!pTree) { cerr<<"Can't get TreeR !\n"; return 1; }
- branch=pTree->GetBranch("ITSRecPoints");
- if (!branch) { cerr<<"Can't get ITSRecPoints branch !\n"; return 1;}
- TClonesArray *points=new TClonesArray("AliITSRecPoint",10000);
- branch->SetAddress(&points);
-
- TClonesArray &cl=*clusters;
- Int_t nclusters=0;
- Int_t nentr=(Int_t)pTree->GetEntries();
- AliITSgeom *geom=ITS->GetITSgeom();
-
- for (Int_t i=0; i<nentr; i++) {
- if (!pTree->GetEvent(i)) {cTree->Fill(); continue;}
- Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det);
- Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift);
- Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot);
- Double_t yshift = x*rot[0] + y*rot[1];
- Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1);
- Int_t ncl=points->GetEntriesFast();
- nclusters+=ncl;
- for (Int_t j=0; j<ncl; j++) {
- AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(j);
- Float_t lp[5];
- lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0];
- lp[1]=p->GetZ()+zshift;
- lp[2]=p->GetSigmaX2();
- lp[3]=p->GetSigmaZ2();
- lp[4]=p->GetQ();
- Int_t lab[6];
- lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2);
- lab[3]=ndet;
-
- Int_t label=lab[0];
- TParticle *part=(TParticle*)gAlice->Particle(label);
- label=-3;
- while (part->P() < 0.005) {
- Int_t m=part->GetFirstMother();
- if (m<0) {cerr<<"Primary momentum: "<<part->P()<<endl; break;}
- label=m;
- part=(TParticle*)gAlice->Particle(label);
- }
- if (lab[1]<0) lab[1]=label;
- else if (lab[2]<0) lab[2]=label;
- else cerr<<"No empty labels !\n";
-
- new(cl[j]) AliITSclusterV2(lab,lp);
- }
- cTree->Fill(); clusters->Delete();
- points->Delete();
- }
- cTree->Write();
- cerr<<"Number of clusters: "<<nclusters<<endl;
- delete cTree; delete clusters; delete points;
-
- }
-
- delete gAlice; gAlice=0;
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindTracks(const Char_t * inname, const Char_t *inname2, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="ITSFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- TFile *in2 =TFile::Open(inname2);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
-
-
- for (Int_t i=0;i<n;i++){
- AliITStrackerV2 tracker(geom,i);
- rc=tracker.Clusters2Tracks(in,out);
- }
-
- in->Close();
- in2->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname) {
-
- Int_t rc=0;
- /*
- const Char_t *name="ITSPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
- AliITStrackerV2 tracker(geom);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker.PropagateBack(in,out);
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
- */
- return rc;
-}
-
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliTPCParam *param=(AliTPCParam *)gFile->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCtracker *tracker=new AliTPCtracker(param);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker->PropagateBack(in,out);
- delete tracker;
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
+++ /dev/null
-/****************************************************************************
- * This macro is supposed to do reconstruction in the barrel ALICE trackers *
- * (Make sure you have TPC digits and ITS hits before using this macro !!!) *
- * It does the following steps (April 12, 2001): *
- * 1) TPC cluster finding *
- * 2) TPC track finding *
- * 3) ITS cluster finding V2 (via fast points !) *
- * 4) ITS track finding V2 *
- * 5) ITS back track propagation V2 *
- * 6) TPC back track propagation *
- * (Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch) *
- ****************************************************************************/
-
-#ifndef __CINT__
- #include "alles.h"
- #include "AliMagF.h"
- #include "AliTPCtracker.h"
-
- #include "AliITS.h"
- #include "AliITSgeom.h"
- #include "AliITSRecPoint.h"
- #include "AliITSclusterV2.h"
- #include "AliITSsimulationFastPoints.h"
- #include "AliITStrackerV2.h"
- #include<iostream.h>
-#endif
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n);
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname);
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n);
-Int_t ITSFindTracks(const Char_t *inname, const Char_t *inname2, const Char_t *outname, Int_t n);
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname);
-
-
-Int_t AliBarrelReconstructionV2(Int_t n=1) {
- //const Char_t *TPCdigName="rfio:galice.root";
- const Char_t *TPCdigName="galice.root";
- const Char_t *TPCclsName="AliTPCclusters.root";
- const Char_t *TPCtrkName="AliTPCtracks.root";
- const Char_t *TPCtrkNameS="AliTPCtracksSorted.root";
-
-
- //const Char_t *ITSdigName="rfio:galice.root";
- const Char_t *ITSdigName="galice.root";
- const Char_t *ITSclsName="AliITSclustersV2.root";
- const Char_t *ITStrkName="AliITStracksV2.root";
-
- AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
-
-
-// ********** Find TPC clusters *********** //
- if (TPCFindClusters(TPCdigName,TPCclsName, n)) {
- cerr<<"Failed to get TPC clusters !\n";
- return 1;
- }
-
-// ********** Find TPC tracks *********** //
- if (TPCFindTracks(TPCclsName,TPCtrkName,n)) {
- cerr<<"Failed to get TPC tracks !\n";
- return 1;
- }
-
-// ********** Sort and label TPC tracks *********** //
- if (TPCSortTracks(TPCclsName,TPCtrkName,TPCtrkNameS,n)) {
- cerr<<"Failed to sort TPC tracks !\n";
- return 1;
- }
-
-// ********** Find ITS clusters *********** //
- if (ITSFindClusters(ITSdigName,ITSclsName,n)) {
- cerr<<"Failed to get ITS clusters !\n";
- return 1;
- }
-
-// ********** Find ITS tracks *********** //
- {
- //TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSFindTracks(TPCtrkNameS,ITSclsName,ITStrkName,n)) {
- cerr<<"Failed to get ITS tracks !\n";
- return 1;
- }
- //clsFile->Close();
- }
- return 1;
-// ********** Back propagation of the ITS tracks *********** //
- {TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSPropagateBack(ITStrkName,TPCtrkNameS)) {
- cerr<<"Failed to propagate back the ITS tracks !\n";
- return 1;
- }
- clsFile->Close();}
-
-
-// ********** Back propagation of the TPC tracks *********** //
- {TFile *clsFile=TFile::Open(TPCclsName);
- if (TPCPropagateBack(TPCtrkName,TPCtrkName)) {
- cerr<<"Failed to propagate back the TPC tracks !\n";
- return 1;
- }
- clsFile->Close();}
-
- return 0;
-}
-
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="TPCFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
-
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCv2 tpc;
- tpc.SetParam(param);
-
- //tpc.Digits2Clusters(out); //MI change
- cout<<"TPCFindClusters: nev ="<<n<<endl;
- for (Int_t i=0;i<n;i++){
- printf("Processing event %d\n",i);
- tpc.Digits2Clusters(out,i);
- // AliTPCclusterer::Digits2Clusters(dig, out, i);
- }
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="TPCFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
- //AliTPCtracker *tracker=new AliTPCtracker(param);
- //rc=tracker->Clusters2Tracks(0,out);
- //delete tracker;
- cout<<"TPCFindTracks: nev ="<<n<<endl;
-
- for (Int_t i=0;i<n;i++){
- printf("Processing event %d\n",i);
- AliTPCtracker *tracker = new AliTPCtracker(param,i);
- //Int_t rc=
- tracker->Clusters2Tracks(0,out);
- delete tracker;
- }
-
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *inname2, const Char_t * outname, Int_t eventn){
- Int_t rc=0;
- const Char_t *name="TPCSortTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out =TFile::Open(outname,"recreate");
- TFile *in1 =TFile::Open(inname);
- TFile *in2 =TFile::Open(inname2);
-
-
- AliTPCParam *param=(AliTPCParam *)in1->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
- cout<<"TPCSortedtracks: nev ="<<eventn<<endl;
-
-
- // loop over events
- for (Int_t event=0;event<eventn; event++){
- TObjArray tarray(10000);
- AliTPCtrack *iotrack=0;
- Int_t i;
-
-
- in2->cd();
- char tname[100];
- sprintf(tname,"TreeT_TPC_%d",event);
-
- TTree *tracktree=(TTree*)in2->Get(tname);
- TBranch *tbranch=tracktree->GetBranch("tracks");
- Int_t nentr=(Int_t)tracktree->GetEntries();
- for (i=0; i<nentr; i++) {
- iotrack=new AliTPCtrack;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- tarray.AddLast(iotrack);
- }
- tarray.Sort();
- // in2->Close();
-
- //assign thacks GEANT labels
- in1->cd();
- AliTPCtracker *tracker = new AliTPCtracker(param,event);
- tracker->LoadInnerSectors();
- tracker->LoadOuterSectors();
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracker->CookLabel(iotrack,0.1);
- }
- delete tracker;
- //in->Close();
- //end of GEANT label assignment
-
- tracktree=new TTree(tname,"Tree with TPC tracks");
- tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0);
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracktree->Fill();
- }
- out->cd();
- tracktree->Write();
- }
-
- out->Close();
- in2->Close();
- in1->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="ITSFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname,"update");
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't get gAlice !\n";
- return 1;
- }
-
- AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
- if (!ITS) { cerr<<"Can't get the ITS !\n"; return 1;}
- AliITSgeom *geom=ITS->GetITSgeom();
- out->cd();
- geom->Write();
-
- cout<<"ITSFindClusters: nev ="<<n<<endl;
- Int_t ev=0;
- for (ev = 0; ev<n; ev++){
- in->cd(); // !!!! MI directory must point to galice. - othervise problem with Tree -connection
- gAlice->GetEvent(ev);
- //gAlice->TreeR()->Reset(); //reset reconstructed tree
-
-
- TTree *pTree=gAlice->TreeR();
- if (!pTree){
- gAlice->MakeTree("R");
- pTree = gAlice->TreeR();
- }
- TBranch *branch=pTree->GetBranch("ITSRecPoints");
- /*
- if (!branch) {
- //if not reconstructed ITS branch do reconstruction
- ITS->MakeBranch("R",0);
-
- //////////////// Taken from ITSHitsToFastPoints.C ///////////////////////
- AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
- for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,sim); }
- Int_t nsignal=25;
- Int_t size=-1;
- Int_t bgr_ev=Int_t(ev/nsignal);
- ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
- //////////////////////////////////////////////////////////////////////////
- gAlice->GetEvent(ev); //MI comment - in HitsToFast... they reset treeR to 0
- //they overwrite full reconstructed event ???? ... so lets connect TreeR one more
- //time
- }
- */
-
-
- out->cd();
- TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
- char cname[100];
- sprintf(cname,"TreeC_ITS_%d",ev);
-
- TTree *cTree=new TTree(cname,"ITS clusters");
- cTree->Branch("Clusters",&clusters);
-
- pTree=gAlice->TreeR();
- if (!pTree) { cerr<<"Can't get TreeR !\n"; return 1; }
- branch=pTree->GetBranch("ITSRecPoints");
- if (!branch) { cerr<<"Can't get ITSRecPoints branch !\n"; return 1;}
- TClonesArray *points=new TClonesArray("AliITSRecPoint",10000);
- branch->SetAddress(&points);
-
- TClonesArray &cl=*clusters;
- Int_t nclusters=0;
- Int_t nentr=(Int_t)pTree->GetEntries();
- Int_t lab[6];
- Float_t lp[5];
- AliITSgeom *geom=ITS->GetITSgeom();
-
- cout<<"!!!! nentr ="<<nentr<<endl;
- for (Int_t i=0; i<nentr; i++) {
- if (!pTree->GetEvent(i)) {cTree->Fill(); continue;}
- Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det);
- Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift);
- Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot);
- Double_t yshift = x*rot[0] + y*rot[1];
- Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1);
- Int_t ncl=points->GetEntriesFast();
- nclusters+=ncl;
-
- Float_t kmip=1.;
- if(lay<5&&lay>2){kmip=280.;}; // b.b.
- if(lay<7&&lay>4){kmip=38.;};
-
-
- for (Int_t j=0; j<ncl; j++) {
- AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(j);
- lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0];
- lp[1]=p->GetZ()+zshift;
- lp[2]=p->GetSigmaX2();
- lp[3]=p->GetSigmaZ2();
- lp[4]=p->GetQ(); lp[4]/=kmip; // b.b.
- if(ncl==11)cout<<"mod,cl,Q ="<<i<<","<<j<<","<<lp[4]<<endl;
- lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2);
- lab[3]=ndet;
-
- Int_t label=lab[0];
- if(label>=0) { // b.b.
- TParticle *part=(TParticle*)gAlice->Particle(label);
- label=-3;
- while (part->P() < 0.005) {
- Int_t m=part->GetFirstMother();
- if (m<0) {cerr<<"Primary momentum: "<<part->P()<<endl; break;}
- label=m;
- part=(TParticle*)gAlice->Particle(label);
- }
- }
- if (lab[1]<0) lab[1]=label;
- else if (lab[2]<0) lab[2]=label;
- else cerr<<"No empty labels !\n";
-
- new(cl[j]) AliITSclusterV2(lab,lp);
- }
- cTree->Fill(); clusters->Delete();
- points->Delete();
- }
- cTree->Write();
- cerr<<"Number of clusters: "<<nclusters<<endl;
- delete cTree; delete clusters; delete points;
-
- }
-
- delete gAlice; gAlice=0;
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindTracks(const Char_t * inname, const Char_t *inname2, const Char_t *outname, Int_t n) {
- Int_t rc=0;
- const Char_t *name="ITSFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- TFile *in2 =TFile::Open(inname2);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
-
- cout<<"ITSFindtracks: nev ="<<n<<endl;
-
- for (Int_t i=0;i<n;i++){
- AliITStrackerV2 tracker(geom,i);
- rc=tracker.Clusters2Tracks(in,out);
- }
-
- in->Close();
- in2->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname) {
-
- Int_t rc=0;
- /*
- const Char_t *name="ITSPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
- AliITStrackerV2 tracker(geom);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker.PropagateBack(in,out);
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
- */
- return rc;
-}
-
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliTPCParam *param=(AliTPCParam *)gFile->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCtracker *tracker=new AliTPCtracker(param);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker->PropagateBack(in,out);
- delete tracker;
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-
-
-
-
+++ /dev/null
-/****************************************************************************
- * Very important, delicate and rather obscure macro. *
- * *
- * Creates list of "findable" cascades, *
- * calculates efficiency, resolutions etc. *
- * *
- * Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr *
- ****************************************************************************/
-
-#ifndef __CINT__
- #include <iostream.h>
- #include <fstream.h>
-
- #include "TH1.h"
- #include "TFile.h"
- #include "TTree.h"
- #include "TObjArray.h"
- #include "TStyle.h"
- #include "TCanvas.h"
- #include "TLine.h"
- #include "TText.h"
- #include "TParticle.h"
- #include "TStopwatch.h"
-
- #include "AliRun.h"
- #include "AliPDG.h"
- #include "AliCascadeVertex.h"
-#endif
-
-struct GoodCascade {
- Int_t nlab,plab; // V0's daughter labels
- Int_t blab; // Bachelor label
- Int_t code;
- Float_t px,py,pz;
- Float_t x,y,z;
-};
-Int_t good_cascades(GoodCascade *gt, Int_t max);
-
-Int_t AliCascadeComparison(Int_t code=3312) {
- //code= 3312; //kXiMinus
- //code=-3312; //kXiPlusBar
- //code= 3334; //kOmegaMinus
- //code=-3334; //kOmegaPlusBar
-
- cerr<<"Doing comparison...\n";
-
- const Double_t cascadeWindow=0.05, cascadeWidth=0.015;
- Double_t cascadeMass=0.5;
- switch (code) {
- case kXiMinus:
- case kXiPlusBar: cascadeMass=1.32131; break;
- case kOmegaMinus:
- case kOmegaPlusBar: cascadeMass=1.67245; break;
- default: cerr<<"Invalid PDG code !\n"; return 1;
- }
-
- TStopwatch timer;
-
- /*** Load reconstructed cascades ***/
- TFile *cf=TFile::Open("AliCascadeVertices.root");
- if (!cf->IsOpen()){cerr<<"Can't open AliCascadeVertices.root !\n";return 2;}
- TObjArray carray(1000);
- TTree *cTree=(TTree*)cf->Get("TreeCasc");
- TBranch *branch=cTree->GetBranch("cascades");
- Int_t nentr=(Int_t)cTree->GetEntries();
- for (Int_t i=0; i<nentr; i++) {
- AliCascadeVertex *iovertex=new AliCascadeVertex;
- branch->SetAddress(&iovertex);
- cTree->GetEvent(i);
- carray.AddLast(iovertex);
- }
- delete cTree;
- cf->Close();
-
- /*** Check if the file with the "good" cascades exists ***/
- GoodCascade gc[100];
- Int_t ngood=0;
- ifstream in("good_cascades");
- if (in) {
- cerr<<"Reading good cascades...\n";
- while (in>>gc[ngood].nlab>>gc[ngood].plab>>
- gc[ngood].blab>>gc[ngood].code>>
- gc[ngood].px>>gc[ngood].py>>gc[ngood].pz>>
- gc[ngood].x >>gc[ngood].y >>gc[ngood].z) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==100) {
- cerr<<"Too many good cascades !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_cascades) !\n";
- } else {
- /*** generate a file with the "good" cascades ***/
- cerr<<"Marking good cascades (this will take a while)...\n";
- ngood=good_cascades(gc,100);
- ofstream out("good_cascades");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gc[ngd].nlab<<' '<<gc[ngd].plab<<' '<<
- gc[ngd].blab<<' '<<gc[ngd].code<<' '<<
- gc[ngd].px<<' '<<gc[ngd].py<<' '<<gc[ngd].pz<<' '<<
- gc[ngd].x <<' '<<gc[ngd].y <<' '<<gc[ngd].z <<endl;
- } else cerr<<"Can not open file (good_cascades) !\n";
- out.close();
- }
-
- /*** create some histograms ***/
- TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution
- hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
- TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
- hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013);
- TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.);
- hpt->SetXTitle("(%)"); hpt->SetFillColor(2);
-
- TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res.
- hx->SetXTitle("(mm)"); hx->SetFillColor(6);
- TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.); //y res
- hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
- TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.); //z res.
- hz->SetXTitle("(mm)"); hz->SetFillColor(6);
-
- Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
- TH1F *hgood=new TH1F("hgood","Good Cascades",nchan,pmin,pmax);
- TH1F *hfound=new TH1F("hfound","Found Cascades",nchan,pmin,pmax);
- TH1F *hfake=new TH1F("hfake","Fake Cascades",nchan,pmin,pmax);
- TH1F *hg=new TH1F("hg","Efficiency for Good Cascades",nchan,pmin,pmax);
- hg->SetLineColor(4); hg->SetLineWidth(2);
- TH1F *hf=new TH1F("hf","Probability of Fake Cascades",nchan,pmin,pmax);
- hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
- Double_t mmin=cascadeMass-cascadeWindow, mmax=cascadeMass+cascadeWindow;
- TH1F *cs =new TH1F("cs","Cascade Effective Mass",40, mmin, mmax);
- cs->SetXTitle("(GeV)"); cs->SetFillColor(6);
-
- Double_t pxg=0.,pyg=0.,ptg=0.;
- Int_t nlab=-1, plab=-1, blab=-1;
- Int_t i;
- for (i=0; i<nentr; i++) {
- AliCascadeVertex *cascade=(AliCascadeVertex*)carray.UncheckedAt(i);
- cascade->GetV0labels(nlab,plab);
- nlab=TMath::Abs(nlab); plab=TMath::Abs(plab);
- blab=TMath::Abs(cascade->GetBachelorLabel());
-
- cascade->ChangeMassHypothesis(code);
-
- Double_t mass=cascade->GetEffMass();
- cs->Fill(mass);
-
- if (TMath::Abs(mass-cascadeMass)>cascadeWidth) continue;
-
- Int_t j;
- for (j=0; j<ngood; j++) {
- if (gc[j].code != cascade->GetPdgCode()) continue;
- if (gc[j].nlab == nlab)
- if (gc[j].plab == plab)
- if (gc[j].blab == blab) break;
- }
-
- Double_t px,py,pz; cascade->GetPxPyPz(px,py,pz);
- Double_t pt=TMath::Sqrt(px*px+py*py);
-
- if (j==ngood) {
- hfake->Fill(pt);
- cerr<<"Fake cascade: ("<<nlab<<","<<plab<<","<<blab<<")\n";
- continue;
- }
-
- pxg=gc[j].px; pyg=gc[j].py; ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
- Double_t phig=TMath::ATan2(pyg,pxg), phi=TMath::ATan2(py,px);
- Double_t lamg=TMath::ATan2(gc[j].pz,ptg), lam=TMath::ATan2(pz,pt);
- hp->Fill((phi - phig)*1000.);
- hl->Fill((lam - lamg)*1000.);
- hpt->Fill((1/pt - 1/ptg)/(1/ptg)*100.);
-
- Double_t x,y,z; cascade->GetXYZ(x,y,z);
- hx->Fill((x-gc[j].x)*10);
- hy->Fill((y-gc[j].y)*10);
- hz->Fill((z-gc[j].z)*10);
-
- hfound->Fill(ptg);
- gc[j].nlab=-1;
-
- }
- for (i=0; i<ngood; i++) {
- if (gc[i].code != code) continue;
- pxg=gc[i].px; pyg=gc[i].py; ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
- hgood->Fill(ptg);
- nlab=gc[i].nlab; plab=gc[i].plab; blab=gc[i].blab;
- if (nlab < 0) continue;
- cerr<<"Cascade ("<<nlab<<','<<plab<<","<<blab<<") has not been found !\n";
- }
-
- carray.Delete();
-
- Stat_t ng=hgood->GetEntries();
- Stat_t nf=hfound->GetEntries();
-
- cerr<<"Number of found cascades: "<<nentr<<" ("<<nf<<" in the peak)\n";
- cerr<<"Number of good cascades: "<<ng<<endl;
-
- if (ng!=0)
- cerr<<"Integral efficiency is about "<<nf/ng*100.<<" %\n";
-
- gStyle->SetOptStat(111110);
- gStyle->SetOptFit(1);
-
- TCanvas *c1=new TCanvas("c1","",0,0,580,610);
- c1->Divide(2,2);
-
- c1->cd(1);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hp->Fit("gaus");
- hp->Draw();
- hl->Draw("same"); c1->cd();
-
- c1->cd(2);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hpt->Fit("gaus"); c1->cd();
- hpt->Draw(); c1->cd();
-
- c1->cd(3);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hx->Fit("gaus");
- hx->Draw();
- hy->Draw("same"); c1->cd();
-
- c1->cd(4);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hz->Fit("gaus");
- hz->Draw();
-
-
- TCanvas *c2=new TCanvas("c2","",600,0,580,610);
- c2->Divide(1,2);
-
- c2->cd(1);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2();
- hg->Divide(hfound,hgood,1,1.,"b");
- hf->Divide(hfake,hgood,1,1.,"b");
- hg->SetMaximum(1.4);
- hg->SetYTitle("Cascade reconstruction efficiency");
- hg->SetXTitle("Pt (GeV/c)");
- hg->Draw();
-
- TLine *line1 = new TLine(pmin,1.0,pmax,1.0); line1->SetLineStyle(4);
- line1->Draw("same");
- TLine *line2 = new TLine(pmin,0.9,pmax,0.9); line2->SetLineStyle(4);
- line2->Draw("same");
-
- hf->SetFillColor(1);
- hf->SetFillStyle(3013);
- hf->SetLineColor(2);
- hf->SetLineWidth(2);
- hf->Draw("histsame");
- TText *text = new TText(0.461176,0.248448,"Fake cascades");
- text->SetTextSize(0.05);
- text->Draw();
- text = new TText(0.453919,1.11408,"Good cascades");
- text->SetTextSize(0.05);
- text->Draw();
-
-
- c2->cd(2);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- cs->SetXTitle("(GeV/c)");
- //cs->Fit("gaus","","",cascadeMass-cascadeWidth,cascadeMass+cascadeWidth);
- cs->Draw();
- Double_t max=cs->GetMaximum();
- TLine *line3 =
- new TLine(cascadeMass-cascadeWidth,0.,cascadeMass-cascadeWidth,max);
- line3->Draw("same");
- TLine *line4 =
- new TLine(cascadeMass+cascadeWidth,0.,cascadeMass+cascadeWidth,max);
- line4->Draw("same");
-
- timer.Stop(); timer.Print();
-
- return 0;
-}
-
-
-
-Int_t good_cascades(GoodCascade *gc, Int_t max) {
- Int_t nc=0;
- /*** Get information about the cuts ***/
- Double_t r2min=0.9*0.9;
- Double_t r2max=2.9*2.9;
-
- /*** Get labels of the "good" tracks ***/
- Double_t dd; Int_t id, label[15000], ngt=0;
- ifstream in("good_tracks_its");
- if (!in) {
- cerr<<"Can't open the file good_tracks_its \n";
- return nc;
- }
- while (in>>label[ngt]>>id>>dd>>dd>>dd>>dd>>dd>>dd) {
- ngt++;
- if (ngt>=15000) {
- cerr<<"Too many good ITS tracks !\n";
- return nc;
- }
- }
- if (!in.eof()) {
- cerr<<"Read error (good_tracks_its) !\n";
- return nc;
- }
-
- /*** Get an access to the kinematics ***/
- if (gAlice) {delete gAlice; gAlice=0;}
-
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
- if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
- cerr<<"gAlice has not been found on galice.root !\n";
- exit(5);
- }
-
- Int_t np=gAlice->GetEvent(0);
- while (np--) {
- cerr<<np<<'\r';
- TParticle *cp=gAlice->Particle(np);
-
- /*** only these cascades are "good" ***/
- Int_t code=cp->GetPdgCode();
- if (code!=kXiMinus) if (code!=kXiPlusBar)
- if (code!=kOmegaMinus) if (code!=kOmegaPlusBar) continue;
-
- /*** daughter tracks must be "good" ***/
- Int_t v0lab=cp->GetFirstDaughter(), blab=cp->GetLastDaughter();
- if (v0lab==blab) continue;
- if (v0lab<0) continue;
- if (blab<0) continue;
-
- TParticle *p0=gAlice->Particle(v0lab);
- TParticle *bp=gAlice->Particle(blab);
- if ((p0->GetPdgCode()!=kLambda0) && (p0->GetPdgCode()!=kLambda0Bar)) {
- TParticle *p=p0; p0=bp; bp=p;
- Int_t i=v0lab; v0lab=blab; blab=i;
- if ((p0->GetPdgCode()!=kLambda0) && (p0->GetPdgCode()!=kLambda0Bar))
- continue;
- }
-
- /** is the bachelor "good" ? **/
- Int_t i;
- for (i=0; i<ngt; i++) if (label[i]==blab) break;
- if (i==ngt) continue;
-
- /** is the V0 "good" ? **/
- Int_t plab=p0->GetFirstDaughter(), nlab=p0->GetLastDaughter();
- if (nlab==plab) continue;
- if (nlab<0) continue;
- if (plab<0) continue;
-
- for (i=0; i<ngt; i++) if (label[i]==nlab) break;
- if (i==ngt) continue;
- for (i=0; i<ngt; i++) if (label[i]==plab) break;
- if (i==ngt) continue;
-
- /*** fiducial volume ***/
- Double_t x=bp->Vx(), y=bp->Vy(), r2=x*x+y*y; //bachelor
- if (r2<r2min) continue;
- if (r2>r2max) continue;
- TParticle *pp=gAlice->Particle(plab);
- x=pp->Vx(); y=pp->Vy(); r2=x*x+y*y; //V0
- if (r2<r2min) continue;
- if (r2>r2max) continue;
-
- if (gAlice->Particle(plab)->GetPDG()->Charge() < 0.) {
- i=plab; plab=nlab; nlab=i;
- }
-
- gc[nc].code=code;
- gc[nc].plab=plab; gc[nc].nlab=nlab; gc[nc].blab=blab;
- gc[nc].px=cp->Px(); gc[nc].py=cp->Py(); gc[nc].pz=cp->Pz();
- gc[nc].x=bp->Vx(); gc[nc].y=bp->Vy(); gc[nc].z=bp->Vz();
- nc++;
-
- }
-
-
- return nc;
-}
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
- #include "AliCascadeVertexer.h"
- #include "TFile.h"
- #include "TStopwatch.h"
-#endif
-
-Int_t AliCascadeFindVertices() {
- cerr<<"Looking for cascade vertices...\n";
-
- TFile *out=TFile::Open("AliCascadeVertices.root","new");
- if (!out->IsOpen()) {
- cerr<<"Delete old AliCascadeVertices.root !\n"; return 1;
- }
- TFile *in=TFile::Open("AliITStracksV2.root");
- if (!in->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 2;}
-
- TFile *file=TFile::Open("AliV0vertices.root");
- if (!file->IsOpen()) {
- cerr<<"Can't open AliV0vertices.root !\n";return 3;
- }
- Double_t cuts[]={33., // max. allowed chi2
- 0.015,// min. allowed V0 impact parameter
- 0.05, // window around the Lambda mass
- 0.015,// min. allowed track impact parameter
- 0.060,// max. allowed DCA between a V0 and a track
- 0.997,// max. allowed cosine of the cascade pointing angle
- 0.9, // min. radius of the fiducial volume
- 2.9 // max. radius of the fiducial volume
- };
- TStopwatch timer;
- AliCascadeVertexer *vertexer=new AliCascadeVertexer(cuts);
- Int_t rc=vertexer->V0sTracks2CascadeVertices(in,out);
- delete vertexer;
- timer.Stop(); timer.Print();
-
- file->Close();
- in->Close();
- out->Close();
-
- return rc;
-}
+++ /dev/null
-#include "iostream.h"
-
-
- void AliITSComparisonV1(Int_t evNumber1=0,Int_t evNumber2=0) {
-
- const char *filename="itstracks.root";
-
- ///////////////// Dynamically link some shared libs ////////////////////////////////
-
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } else {
- delete gAlice;
- gAlice=0;
- }
-
-// Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if (!file) file = new TFile(filename);
-
- ifstream in("itsgood_tracks");
-//
-// Loop over events
-//
-
- char tname[30];
-
-
- struct GoodTrack {
- Int_t fEventN;
- Int_t lab,code;
- Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
- Bool_t flag;
- };
- Int_t i;
- GoodTrack gt[50000];
- Int_t ngood=0;
- cerr<<"Reading itsgood tracks...\n";
- while (in>>gt[ngood].fEventN>>gt[ngood].lab>>gt[ngood].code
- >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
- >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
- >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
- >>gt[ngood].ptg >>gt[ngood].flag) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==50000) {
- cerr<<"Too many good tracks !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (itsgood_tracks) !\n";
- ofstream out1 ("AliITSTrag.out");
- Int_t countpos=0,countneg=0;
-
-
- //for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
- for (i=0; i<ngood; i++) {
- out1 << gt[i].ptg << "\n";
- Int_t codpar=gt[i].code;
- if(codpar==2212 || codpar==-11 || codpar==-13 || codpar==211 || codpar==321 || codpar==3222
- || codpar==213 || codpar==323 || codpar==10323 || codpar==3224 || codpar==2224 || codpar==2214
- || codpar==-1114 || codpar==-3112 || codpar==-3312 || codpar==3224 || codpar==-3114 || codpar==-3314
- || codpar==411 || codpar==431 || codpar==413 || codpar==433 || codpar==-15 || codpar==4232
- || codpar==4222 || codpar==4322 || codpar==4422 || codpar==4412 || codpar==4432 || codpar==4224
- ||codpar==4214 || codpar==4324 || codpar==4424 || codpar==4414 || codpar==4434 || codpar==4444)
- countpos++;
- if(codpar==-2212 || codpar==11 || codpar==13 || codpar==-211 || codpar==-321 || codpar==3112
- || codpar==-213 || codpar==-323 || codpar==-10323 || codpar==3114 || codpar==1114 || codpar==-2224
- || codpar==-2214 || codpar==33112 || codpar==-3222 || codpar==3114 || codpar==3314 || codpar==3334
- || codpar==-3224 || codpar==-411 || codpar==-431 || codpar==-413 || codpar==-433 || codpar==15
- || codpar==-4422 || codpar==-4432 || codpar==-4214 || codpar==-4324 || codpar==-4424 || codpar==-4434
- || codpar==-444)
- countneg++;
- }
- out1.close();
- ofstream out ("AliITSTra.out");
-/// definition of nm of good track for each event
- TVector ntrackevtpc(evNumber2-evNumber1 +1);
- Int_t nchange=-1;
- Int_t nmev=-100;
-
-
- Int_t i;
- for( i =0; i<ngood ; i++){
- if(gt[i].fEventN != nmev ){
- nmev=gt[i].fEventN;
- nchange++;
- }
- if(nmev == gt[i].fEventN) ntrackevtpc(nchange)++;
- }
-//////////////////////////////////////////////////////////////
-
- for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
-
-
- sprintf(tname,"TreeT%d",nev);
- TTree *tracktree=(TTree*)file->Get(tname);
- TBranch *tbranch=tracktree->GetBranch("ITStracks");
- cout<<" nev = "<<nev<<"\n";
- //cout<<" open the file \n";
-
- Int_t nentr=tracktree->GetEntries();
-
- TObjArray tarray(nentr);
- // AliITSIOTrack *iotrack=0;
- printf("nentr %d\n",nentr);
-
- for (Int_t i=0; i<nentr; i++) {
- AliITSIOTrack *iotrack=new AliITSIOTrack;
- // tarray.AddAt(new AliITSIOTrack,i);
- // iotrack=(AliITSiotrack*)tarray.UncheckedAt(i);
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- tarray.AddLast(iotrack);
- }
- //file->Close();
-
- AliITSIOTrack *iotrack;
- for (Int_t i=0; i<nentr; i++) {
- AliITSIOTrack *iotrack=new AliITSIOTrack;
- iotrack=(AliITSIOTrack*)tarray.UncheckedAt(i);
- if(!iotrack) continue;
- Int_t labITS=iotrack->GetLabel();
- Int_t labTPC=iotrack->GetTPCLabel();
- Double_t phistate=iotrack->GetStatePhi();
- Double_t tgl=iotrack->GetStateTgl();
- Double_t Zstate=iotrack->GetStateZ();
- Double_t Dr=iotrack->GetStateD();
- Double_t C=iotrack->GetStateC();
- Double_t px=iotrack->GetPx();
- Double_t py=iotrack->GetPy();
- Double_t pz=iotrack->GetPz();
- Double_t pt=TMath::Sqrt(px*px+py*py);
- Int_t c = iotrack->GetCharge();
- Double_t x=iotrack->GetX();
- Double_t y=iotrack->GetY();
- Double_t z= iotrack->GetZ();
- Double_t Dz=iotrack->GetDz();
-
-
- // cout<<" track label = "<<label<<"\n";
- // cout<<" phi z D tanl C = "<<phistate<<" "<<Zstate<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n";
-
- // Int_t ilab=TMath::Abs(iotrack->GetLabel());
- Int_t flaglab=0;
- Int_t iii=0;
- Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
- Double_t xo=0., yo=0., zo=0.;
-
- Int_t mingood=0, maxgood=0, jj=0;
- if(nev==evNumber1) mingood=0;
- else
- {for(jj=evNumber1; jj<nev; jj++) mingood += ntrackevtpc(jj);}
- for(jj=evNumber1; jj<=nev; jj++) maxgood+= ntrackevtpc(jj);
-
- Int_t ilab=TMath::Abs(labTPC);
- // for (iii=0;iii<ngood;iii++) {
- for(iii=mingood; iii<maxgood; iii++){
- //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar();
- if (ilab==gt[iii].lab) {
- flaglab=1;
- ptg=gt[iii].ptg;
- pxg=gt[iii].pxg;
- pyg=gt[iii].pyg;
- pzg=gt[iii].pzg;
- xo=gt[iii].x;
- yo=gt[iii].y;
- zo=gt[iii].z;
- break;
- }
- }
-
- if (!flaglab) continue;
- //cout<<" j = " <<j<<"\n"; getchar();
- TVector dataOut(10);
- Int_t kkk=0;
-
- dataOut(kkk) = ptg; kkk++; dataOut(kkk)=labITS; kkk++; dataOut(kkk)=labTPC; kkk++;
-
- ///////////////////////////////
- Double_t difpt= (pt-ptg)/ptg*100.;
- //cout<<" difpt = "<<difpt<<"\n"; getchar();
- dataOut(kkk)=difpt; kkk++;
- Double_t lambdag=TMath::ATan(pzg/ptg);
- Double_t lam=TMath::ATan(tgl);
- Double_t diflam = (lam - lambdag)*1000.;
- dataOut(kkk) = diflam; kkk++;
- Double_t phig=TMath::ATan2(pyg,pxg); if(phig<0) phig=2.*TMath::Pi()+phig;
- // Double_t phi=phivertex;
- Double_t phi=TMath::ACos(px/pt);
- Double_t duepi=2.*TMath::Pi();
- if(phi>duepi) phi-=duepi;
- if(phi<0.) phi+=duepi;
- Double_t signC=0.;
- if(c>0) signC=1.; else signC=-1.;
- Double_t Dtot= TMath::Sqrt(Dr*Dr+Dz*Dz);
- Double_t difphi = (phi - phig)*1000.;
- dataOut(kkk)=difphi; kkk++;
- dataOut(kkk)=Dtot*1.e4; kkk++;
- dataOut(kkk)=Dr*1.e4; kkk++;
- dataOut(kkk)=Dz*1.e4; kkk++;
- dataOut(kkk)=signC; kkk++;
- Int_t r;
- for (r=0; r<10; r++) { out<<dataOut(r)<<" ";}
- out<<"\n";
- kkk=0;
-
- delete iotrack;
- }
- //out.close();
- } // event loop
- out.close();
- in.close();
- file->Close();
-}
-
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
- #include <fstream.h>
-
- #include "AliRun.h"
- #include "AliITS.h"
- #include "AliITSgeom.h"
- #include "AliITStrackerV2.h"
- #include "AliITStrackV2.h"
- #include "AliITSclusterV2.h"
-
- #include "TFile.h"
- #include "TTree.h"
- #include "TH1.h"
- #include "TObjArray.h"
- #include "TStyle.h"
- #include "TCanvas.h"
- #include "TLine.h"
- #include "TText.h"
- #include "TParticle.h"
-#endif
-
-struct GoodTrackITS {
- Int_t lab;
- Int_t code;
- Float_t px,py,pz;
- Float_t x,y,z;
-};
-
-Int_t AliITSComparisonV2(Int_t event=0) {
- cerr<<"Doing comparison...\n";
-
- const Int_t MAX=15000;
- Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event);
-
- Int_t nentr=0; TObjArray tarray(2000);
- {/* Load tracks */
- TFile *tf=TFile::Open("AliITStracksV2.root");
- if (!tf->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 3;}
- char tname[100]; sprintf(tname,"TreeT_ITS_%d",event);
- TTree *tracktree=(TTree*)tf->Get(tname);
- if (!tracktree) {cerr<<"Can't get a tree with ITS tracks !\n"; return 4;}
- TBranch *tbranch=tracktree->GetBranch("tracks");
- nentr=(Int_t)tracktree->GetEntries();
- for (Int_t i=0; i<nentr; i++) {
- AliITStrackV2 *iotrack=new AliITStrackV2;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- tarray.AddLast(iotrack);
- /*if (itsLabel != 1234) continue;
- Int_t nc=iotrack->GetNumberOfClusters();
- for (Int_t k=0; k<nc; k++) {
- Int_t index=iotrack->GetClusterIndex(k);
- AliITSclusterV2 *c=tracker.GetCluster(index);
- cout<<c->GetLabel(0)<<' '<<c->GetLabel(1)<<' '<<c->GetLabel(2)<<endl;
- }*/
- }
- delete tracktree; //Thanks to Mariana Bondila
- tf->Close();
- }
-
- /* Generate a list of "good" tracks */
- GoodTrackITS gt[MAX];
- Int_t ngood=0;
- ifstream in("good_tracks_its");
- if (in) {
- cerr<<"Reading good tracks...\n";
- while (in>>gt[ngood].lab>>gt[ngood].code>>
- gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>>
- gt[ngood].x >>gt[ngood].y >>gt[ngood].z) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==MAX) {
- cerr<<"Too many good tracks !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_tracks_its) !\n";
- } else {
- cerr<<"Marking good tracks (this will take a while)...\n";
- ngood=good_tracks_its(gt,MAX,event);
- ofstream out("good_tracks_its");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gt[ngd].lab<<' '<<gt[ngd].code<<' '
- <<gt[ngd].px<<' '<<gt[ngd].py<<' '<<gt[ngd].pz<<' '
- <<gt[ngd].x <<' '<<gt[ngd].y <<' '<<gt[ngd].z <<endl;
- } else cerr<<"Can not open file (good_tracks_its) !\n";
- out.close();
- }
- cerr<<"Number of good tracks : "<<ngood<<endl;
-
- TH1F *hp=new TH1F("hp","PHI resolution",50,-20.,20.); hp->SetFillColor(4);
- TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-20,20);hl->SetFillColor(4);
- TH1F *hpt=new TH1F("hpt","Relative Pt resolution",30,-10.,10.);
- hpt->SetFillColor(2);
- TH1F *hmpt=new TH1F("hmpt","Transverse impact parameter",30,-300,300);
- hmpt->SetFillColor(6);
- TH1F *hz=new TH1F("hz","Longitudinal impact parameter",30,-300,300);
- //hmpt->SetFillColor(6);
-
- AliITStrackV2 *trk=(AliITStrackV2*)tarray.UncheckedAt(0);
- Double_t pmin=0.1*(100/0.299792458/0.2/trk->GetConvConst());
- Double_t pmax=6.0+pmin;
-
- TH1F *hgood=new TH1F("hgood","Good tracks",30,pmin,pmax);
- TH1F *hfound=new TH1F("hfound","Found tracks",30,pmin,pmax);
- TH1F *hfake=new TH1F("hfake","Fake tracks",30,pmin,pmax);
- TH1F *hg=new TH1F("hg","",30,pmin,pmax); //efficiency for good tracks
- hg->SetLineColor(4); hg->SetLineWidth(2);
- TH1F *hf=new TH1F("hf","Efficiency for fake tracks",30,pmin,pmax);
- hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
- TH1F *hptw=new TH1F("hptw","Weghted pt",30,pmax,pmin);
-
- while (ngood--) {
- Int_t lab=gt[ngood].lab, tlab=-1;
- Double_t pxg=gt[ngood].px, pyg=gt[ngood].py, pzg=gt[ngood].pz;
- Double_t ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
-
- if (ptg<pmin) continue;
-
- hgood->Fill(ptg);
-
- AliITStrackV2 *track=0;
- Int_t j;
- for (j=0; j<nentr; j++) {
- track=(AliITStrackV2*)tarray.UncheckedAt(j);
- tlab=track->GetLabel();
- if (lab==TMath::Abs(tlab)) break;
- }
- if (j==nentr) {
- cerr<<"Track "<<lab<<" was not found !\n";
- continue;
- }
- track->PropagateTo(3.,0.0028,65.19);
- track->PropagateToVertex();
-
- if (lab==tlab) hfound->Fill(ptg);
- else { hfake->Fill(ptg); cerr<<lab<<" fake\n";}
-
- Double_t xv,par[5]; track->GetExternalParameters(xv,par);
- Float_t phi=TMath::ASin(par[2]) + track->GetAlpha();
- if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
- if (phi>=TMath::Pi()) phi-=2*TMath::Pi();
- Float_t lam=TMath::ATan(par[3]);
- Float_t pt_1=TMath::Abs(par[4]);
-
- Double_t phig=TMath::ATan2(pyg,pxg);
- hp->Fill((phi - phig)*1000.);
-
- Double_t lamg=TMath::ATan2(pzg,ptg);
- hl->Fill((lam - lamg)*1000.);
-
- Double_t d=10000*track->GetD();
- hmpt->Fill(d);
-
- hptw->Fill(ptg,TMath::Abs(d));
-
- Double_t z=10000*track->GetZ();
- hz->Fill(z);
-
-//if (TMath::Abs(gt[ngood].code)==11 && ptg>4.)
- hpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.);
-
- }
-
- Stat_t ng=hgood->GetEntries(); cerr<<"Good tracks "<<ng<<endl;
- Stat_t nf=hfound->GetEntries();
- if (ng!=0)
- cerr<<"Integral efficiency is about "<<nf/ng*100.<<" %\n";
-
- gStyle->SetOptStat(111110);
- gStyle->SetOptFit(1);
-
- TCanvas *c1=new TCanvas("c1","",0,0,700,850);
-
- TPad *p1=new TPad("p1","",0,0.3,.5,.6); p1->Draw();
- p1->cd(); p1->SetFillColor(42); p1->SetFrameFillColor(10);
- hp->SetFillColor(4); hp->SetXTitle("(mrad)"); hp->Fit("gaus"); c1->cd();
-
- TPad *p2=new TPad("p2","",0.5,.3,1,.6); p2->Draw();
- p2->cd(); p2->SetFillColor(42); p2->SetFrameFillColor(10);
- hl->SetXTitle("(mrad)"); hl->Fit("gaus"); c1->cd();
-
- TPad *p3=new TPad("p3","",0,0,0.5,0.3); p3->Draw();
- p3->cd(); p3->SetFillColor(42); p3->SetFrameFillColor(10);
- hpt->SetXTitle("(%)"); hpt->Fit("gaus"); c1->cd();
-
- TPad *p4=new TPad("p4","",0.5,0,1,0.3); p4->Draw();
- p4->cd(); p4->SetFillColor(42); p4->SetFrameFillColor(10);
- hmpt->SetXTitle("(micron)"); hmpt->Fit("gaus"); hz->Draw("same"); c1->cd();
- //hfound->Sumw2();
- //hptw->Sumw2();
- //hg->SetMaximum(333);
- //hg->SetYTitle("Impact Parameter Resolution (micron)");
- //hg->SetXTitle("Pt (GeV/c)");
- //hg->GetXaxis()->SetRange(0,10);
- //hg->Divide(hptw,hfound,1,1.);
- //hg->DrawCopy(); c1->cd();
-
-
- TPad *p5=new TPad("p5","",0,0.6,1,1); p5->Draw(); p5->cd();
- p5->SetFillColor(41); p5->SetFrameFillColor(10);
- hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2();
- hg->Divide(hfound,hgood,1,1.,"b");
- hf->Divide(hfake,hgood,1,1.,"b");
- hg->SetMaximum(1.4);
- hg->SetYTitle("Tracking efficiency");
- hg->SetXTitle("Pt (GeV/c)");
- hg->Draw();
-
- TLine *line1 = new TLine(pmin,1.0,pmax,1.0); line1->SetLineStyle(4);
- line1->Draw("same");
- TLine *line2 = new TLine(pmin,0.9,pmax,0.9); line2->SetLineStyle(4);
- line2->Draw("same");
-
- hf->SetFillColor(1);
- hf->SetFillStyle(3013);
- hf->SetLineColor(2);
- hf->SetLineWidth(2);
- hf->Draw("histsame");
- TText *text = new TText(0.461176,0.248448,"Fake tracks");
- text->SetTextSize(0.05);
- text->Draw();
- text = new TText(0.453919,1.11408,"Good tracks");
- text->SetTextSize(0.05);
- text->Draw();
-
- return 0;
-}
-
-Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) {
- if (gAlice) {delete gAlice; gAlice=0;}
-
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
- if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
- cerr<<"gAlice have not been found on galice.root !\n";
- exit(5);
- }
-
- Int_t np=gAlice->GetEvent(event);
-
- Int_t *good=new Int_t[np];
- Int_t k;
- for (k=0; k<np; k++) good[k]=0;
-
- AliITS *ITS=(AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"can't get ITS !\n"; exit(8);
- }
- AliITSgeom *geom=ITS->GetITSgeom();
- if (!geom) {
- cerr<<"can't get ITS geometry !\n"; exit(9);
- }
-
- TFile *cf=TFile::Open("AliITSclustersV2.root");
- if (!cf->IsOpen()){
- cerr<<"Can't open AliITSclustersV2.root !\n"; exit(6);
- }
- char cname[100]; sprintf(cname,"TreeC_ITS_%d",event);
- TTree *cTree=(TTree*)cf->Get(cname);
- if (!cTree) {
- cerr<<"Can't get cTree !\n"; exit(7);
- }
- TBranch *branch=cTree->GetBranch("Clusters");
- if (!branch) {
- cerr<<"Can't get clusters branch !\n"; exit(8);
- }
- TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
- branch->SetAddress(&clusters);
-
- Int_t entr=(Int_t)cTree->GetEntries();
- for (k=0; k<entr; k++) {
- cTree->GetEvent(k);
- Int_t ncl=clusters->GetEntriesFast(); if (ncl==0) continue;
- Int_t lay,lad,det; geom->GetModuleId(k,lay,lad,det);
- if (lay<1 || lay>6) {
- cerr<<"wrong layer !\n"; exit(10);
- }
- while (ncl--) {
- AliITSclusterV2 *pnt=(AliITSclusterV2*)clusters->UncheckedAt(ncl);
- Int_t l0=pnt->GetLabel(0);
- Int_t l1=pnt->GetLabel(1);
- Int_t l2=pnt->GetLabel(2);
- Int_t mask=1<<(lay-1);
- if (l0>=0) good[l0]|=mask;
- if (l1>=0) good[l1]|=mask;
- if (l2>=0) good[l2]|=mask;
- }
- }
- clusters->Delete(); delete clusters;
- delete cTree; //Thanks to Mariana Bondila
- cf->Close();
-
- ifstream in("good_tracks_tpc");
- if (!in) {
- cerr<<"can't get good_tracks_tpc !\n"; exit(11);
- }
- Int_t nt=0;
- Double_t px,py,pz,x,y,z;
- Int_t code,lab;
- while (in>>lab>>code>>px>>py>>pz>>x>>y>>z) {
- if (good[lab] != 0x3F) continue;
- TParticle *p = (TParticle*)gAlice->Particle(lab);
- gt[nt].lab=lab;
- gt[nt].code=p->GetPdgCode();
-//**** px py pz - in global coordinate system
- gt[nt].px=p->Px(); gt[nt].py=p->Py(); gt[nt].pz=p->Pz();
- gt[nt].x=gt[nt].y=gt[nt].z=0.;
- nt++;
- if (nt==max) {cerr<<"Too many good tracks !\n"; break;}
- }
-
- delete[] good;
-
- delete gAlice; gAlice=0;
- file->Close();
-
- return nt;
-}
-
-
+++ /dev/null
-void AliITSDigits2Clusters(const char *filename="galice.root"){
- AliITSreconstruction *itsr = new AliITSreconstruction(filename);
- itsr->Exec();
- delete itsr;
-}
+++ /dev/null
-Int_t AliITSFindClusters() {
-
- printf("FindClusters\n");
-
- TFile *in=TFile::Open("galice.root","UPDATE");
- if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;}
-
- in->ls();
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"gAlice have not been found on galice.root !\n";
- return 2;
- }
-
-
- gAlice->GetEvent(0);
-
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"ITSFindClusters.C : AliITS object not found on file\n";
- return 3;
- }
- Int_t ver = ITS->IsVersion();
- cerr<<"ITS version "<<ver<<" has been found !\n";
-
- ITS->MakeTreeC();
-// Set the models for cluster finding
- AliITSgeom *geom = ITS->GetITSgeom();
-
- // SPD
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
- TClonesArray *dig0 = ITS->DigitsAddress(0);
- TClonesArray *recp0 = ITS->ClustersAddress(0);
- AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0);
- ITS->SetReconstructionModel(0,rec0);
- // test
- printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
- printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
-
-
- // SDD
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
- if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) res1=new AliITSresponseSDD();
- Float_t baseline,noise;
- res1->GetNoiseParam(noise,baseline);
- Float_t noise_after_el = res1->GetNoiseAfterElectronics();
- Float_t thres = baseline;
- thres += (4.*noise_after_el); // TB // (4.*noise_after_el);
- printf("thres %f\n",thres);
-// res1->Print();
- TClonesArray *dig1 = ITS->DigitsAddress(1);
- TClonesArray *recp1 = ITS->ClustersAddress(1);
- AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
- rec1->SetCutAmplitude((int)thres);
- ITS->SetReconstructionModel(1,rec1);
-
-
- // SSD
- AliITSDetType *iDetType=ITS->DetType(2);
- AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
- TClonesArray *dig2 = ITS->DigitsAddress(2);
- AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
- ITS->SetReconstructionModel(2,rec2);
- // test
- printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
- printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
-
-
-
- if(!gAlice->TreeR()) gAlice->MakeTree("R");
- //make branch
- ITS->MakeBranch("R");
-
- TStopwatch timer;
-
- cerr<<"Looking for clusters...\n";
- timer.Start();
- ITS->DigitsToRecPoints(0,0,"All");
- timer.Stop(); timer.Print();
-
- delete gAlice; gAlice=0;
-
- in->Close();
-
- return 0;
-}
+++ /dev/null
-Int_t AliITSFindClustersDubna() {
-
- printf("FindClusters\n");
-
- TFile *in=TFile::Open("galice.root","UPDATE");
- if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;}
-
- in->ls();
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"gAlice have not been found on galice.root !\n";
- return 2;
- }
-
-
- gAlice->GetEvent(0);
-
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"ITSFindClusters.C : AliITS object not found on file\n";
- return 3;
- }
- Int_t ver = ITS->IsVersion();
- cerr<<"ITS version "<<ver<<" has been found !\n";
-
- ITS->MakeTreeC();
-// Set the models for cluster finding
- AliITSgeom *geom = ITS->GetITSgeom();
-
- // SPD
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
- TClonesArray *dig0 = ITS->DigitsAddress(0);
- TClonesArray *recp0 = ITS->ClustersAddress(0);
- AliITSClusterFinderSPDdubna *rec0=new AliITSClusterFinderSPDdubna(seg0,dig0,recp0);
- ITS->SetReconstructionModel(0,rec0);
-
- // SDD
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
- if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) res1=new AliITSresponseSDD();
- Float_t baseline,noise;
- res1->GetNoiseParam(noise,baseline);
- Float_t noise_after_el = res1->GetNoiseAfterElectronics();
- Float_t thres = baseline;
- thres += (4.*noise_after_el); // TB // (4.*noise_after_el);
- printf("thres %f\n",thres);
- res1->Print();
- TClonesArray *dig1 = ITS->DigitsAddress(1);
- TClonesArray *recp1 = ITS->ClustersAddress(1);
- AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
- rec1->SetCutAmplitude((int)thres);
- ITS->SetReconstructionModel(1,rec1);
-
-
- // SSD
- AliITSDetType *iDetType=ITS->DetType(2);
- AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
- TClonesArray *dig2 = ITS->DigitsAddress(2);
- AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
- ITS->SetReconstructionModel(2,rec2);
- // test
- printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
- printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
-
-
-
- if(!gAlice->TreeR()) gAlice->MakeTree("R");
- //make branch
- ITS->MakeBranch("R");
-
- TStopwatch timer;
-
- switch (ver) {
- case 5:
- cerr<<"Looking for clusters...\n";
- {
- timer.Start();
- ITS->DigitsToRecPoints(0,0,"All");
- }
- break;
- default:
- cerr<<"Invalid ITS version !\n";
- return 5;
- }
-
- timer.Stop(); timer.Print();
-
- delete rec0;
- delete rec1;
- delete rec2;
-
-
- delete gAlice; gAlice=0;
-
- in->Close();
-
- return 0;
-}
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
-
- #include "AliRun.h"
- #include "AliITS.h"
- #include "AliITSgeom.h"
- #include "AliITSRecPoint.h"
- #include "AliITSclusterV2.h"
-
- #include "TFile.h"
- #include "TTree.h"
- #include "TParticle.h"
-#endif
-
-Int_t AliITSFindClustersV2() {
-/****************************************************************
- * This macro converts AliITSRecPoint(s) to AliITSclusterV2(s) *
- ****************************************************************/
- cerr<<"AliITSRecPoint(s) -> AliITSclusterV2(s)...\n";
-
- if (gAlice) {delete gAlice; gAlice=0;}
-
- TFile *in=TFile::Open("galice.root");
- if (!in->IsOpen()) { cerr<<"Can't open galice.root !\n"; return 1; }
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't find gAlice !\n";
- return 2;
- }
- gAlice->GetEvent(0);
-
- AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
- if (!ITS) { cerr<<"Can't find the ITS !\n"; return 3; }
- AliITSgeom *geom=ITS->GetITSgeom();
-
- TFile *out=TFile::Open("AliITSclustersV2.root","new");
- if (!out->IsOpen()) {
- cerr<<"Delete old AliITSclustersV2.root !\n";
- return 4;
- }
- geom->Write();
-
- TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
- TTree *cTree=new TTree("TreeC_ITS_0","ITS clusters");
- cTree->Branch("Clusters",&clusters);
-
- TTree *pTree=gAlice->TreeR();
- if (!pTree) { cerr<<"Can't get TreeR !\n"; return 5; }
- TBranch *branch=pTree->GetBranch("ITSRecPoints");
- if (!branch) { cerr<<"Can't get ITSRecPoints branch !\n"; return 6; }
- TClonesArray *points=new TClonesArray("AliITSRecPoint",10000);
- branch->SetAddress(&points);
-
- TClonesArray &cl=*clusters;
- Int_t nclusters=0;
- Int_t nentr=(Int_t)pTree->GetEntries();
-
- cerr<<"Number of entries: "<<nentr<<endl;
-
- Float_t lp[5]; Int_t lab[6]; //Why can't it be inside a loop ?
-
- for (Int_t i=0; i<nentr; i++) {
- points->Clear();
- pTree->GetEvent(i);
- Int_t ncl=points->GetEntriesFast(); if (ncl==0){cTree->Fill();continue;}
- Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det);
- Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift);
- Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot);
- Double_t yshift = x*rot[0] + y*rot[1];
- Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1);
- nclusters+=ncl;
-
- Float_t kmip=1; // ADC->mip normalization factor for the SDD and SSD
- if(lay==4 || lay==3){kmip=280.;};
- if(lay==6 || lay==5){kmip=38.;};
-
- for (Int_t j=0; j<ncl; j++) {
- AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(j);
- //Float_t lp[5];
- lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0];
- lp[1]=p->GetZ()+zshift;
- lp[2]=p->GetSigmaX2();
- lp[3]=p->GetSigmaZ2();
- lp[4]=p->GetQ(); lp[4]/=kmip;
- //Int_t lab[6];
- lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2);
- lab[3]=ndet;
-
- Int_t label=lab[0];
- if (label>=0) {
- TParticle *part=(TParticle*)gAlice->Particle(label);
- label=-3;
- while (part->P() < 0.005) {
- Int_t m=part->GetFirstMother();
- if (m<0) {cerr<<"Primary momentum: "<<part->P()<<endl; break;}
- label=m;
- part=(TParticle*)gAlice->Particle(label);
- }
- if (lab[1]<0) lab[1]=label;
- else if (lab[2]<0) lab[2]=label;
- else cerr<<"No empty labels !\n";
- }
-
- new(cl[j]) AliITSclusterV2(lab,lp);
- }
- cTree->Fill(); clusters->Delete();
- points->Delete();
- }
- cTree->Write();
-
- cerr<<"Number of clusters: "<<nclusters<<endl;
-
- delete cTree; delete clusters; delete points;
-
- delete gAlice; gAlice=0;
-
- in->Close();
- out->Close();
-
- return 0;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
- #include "AliITSgeom.h"
- #include "AliITStrackerV2.h"
-
- #include "TFile.h"
- #include "TStopwatch.h"
-#endif
-
-Int_t AliITSFindTracksV2() {
- cerr<<"Looking for tracks...\n";
-
- TFile *out=TFile::Open("AliITStracksV2.root","new");
- if (!out->IsOpen()) {cerr<<"Delete old AliITStracksV2.root !\n"; return 1;}
-
- TFile *in=TFile::Open("AliTPCtracks.root");
- if (!in->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 2;}
-
- TFile *file=TFile::Open("AliITSclustersV2.root");
- if (!file->IsOpen()) {cerr<<"Can't open AliITSclustersV2.root !\n";return 3;}
-
- AliITSgeom *geom=(AliITSgeom*)file->Get("AliITSgeom");
-
- TStopwatch timer;
- AliITStrackerV2 tracker(geom);
-
- //Double_t xyz[]={0.,0.,0.}; tracker.SetVertex(xyz); //primary vertex
- //Int_t flag[]={1}; //some default flags
- //flag[0]= 0; tracker.SetupFirstPass(flag); //no constraint
- //flag[0]=-1; tracker.SetupSecondPass(flag); //skip second pass
-
- Int_t rc=tracker.Clusters2Tracks(in,out);
- timer.Stop(); timer.Print();
-
- delete geom; //Thanks to Mariana Bondila
-
- file->Close();
- in->Close();
- out->Close();
-
- return rc;
-}
+++ /dev/null
-Int_t AliITSHits2Digits(const char *inFile = "galice.root"){
- ////////////////////////////////////////////////////////////////////
- // This macro will take hits from a galice.root file and
- // produce digits for the ITS using the settings for the detector
- // simulations defined in this file. It will measure the time
- // required to do so and the increase in the galice.root file.
- // There is only one input, that of the name of the root file
- // containing the hits and to which the digits will be written to.
- // This macro will process all of the events on the root file.
- ////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2Digits" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
- << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- // SPD
- cout << "Changing from Default SPD simulation, and responce." << endl;
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
- AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
- ITS->SetSimulationModel(0,sim0);
- // test
- cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
- cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
- cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
- // end test
-
- // SDD
- cout << "Changing from Default SDD simulation, and responce." << endl;
- //Set response functions
- Float_t baseline = 10.;
- Float_t noise = 1.75;
- // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
- // 2 fTolerance
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) {
- res1=new AliITSresponseSDD();
- ITS->SetResponseModel(1,res1);
- } // end if !res1
- Float_t fCutAmp = baseline + 2.*noise;
- Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
-
- //res1->SetZeroSupp("2D");
- res1->SetZeroSupp("1D");
- res1->SetNoiseParam(noise,baseline);
- res1->SetDo10to8(kTRUE);
- res1->SetCompressParam(cp);
- res1->SetMinVal(4);
- res1->SetDiffCoeff(3.6,40.);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
- GetSegmentationModel();
- if (!seg1) {
- seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
- ITS->SetSegmentationModel(1,seg1);
- } // end if !seg1
- AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
- sim1->SetDoFFT(1);
- sim1->SetCheckNoise(kFALSE);
- ITS->SetSimulationModel(1,sim1);
-
- // SSD
- cout << "Changing from Default SSD simulation, and responce." << endl;
- AliITSDetType *iDetType = ITS->DetType(2);
- AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
- res2->SetSigmaSpread(3.,2.);
- AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
- ITS->SetSimulationModel(2,sim2);
-
- cout << "Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
- timer.Start();
- gAlice->Hits2Digits("ITS");
- timer.Stop(); timer.Print();
-
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
-
+++ /dev/null
-Int_t AliITSHits2DigitsDefault(const char *inFile = "galice.root"){
- ////////////////////////////////////////////////////////////////////
- // This macro will take hits from a galice.root file and
- // produce digits for the ITS using the standard detector
- // simulations. It will measure the time required to do so and the
- // increase in the galice.root file. There is only one input, that
- // of the name of the root file containing the hits and to which the
- // digits will be written to. This macro will process all of the
- // events on the root file.
- ////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2DigitsDefault" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"ITSHits2Digits.C : AliITS object not found on file" << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
- cout << "Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
- timer.Start();
- gAlice->Hits2Digits("ITS");
- timer.Stop(); timer.Print();
-
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
-
+++ /dev/null
-Int_t AliITSHits2DigitsDubna(const char *inFile = "galice.root"){
- ////////////////////////////////////////////////////////////////////
- // This macro will take hits from a galice.root file and
- // produce digits for the ITS using the settings for the detector
- // simulations defined in this file. Specificaly it replaces the
- // default SPD simulation with that of Dubna It will measure the
- // time required to do so and the increase in the galice.root file.
- // There is only one input, that of the name of the root file
- // containing the hits and to which the digits will be written to.
- // This macro will process all of the events on the root file.
- ////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2DigitsDubna" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr<<"AliITSHits2DigitsDubna.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"ITSHits2Digits.C : AliITS object not found on file" << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- // SPD
- cout << "Changing from Default SPD simulation, and responce." << endl;
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSPDdubna *res0 = new AliITSresponseSPDdubna();
- ITS->SetResponseModel(0,res0);
- AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0);
- ITS->SetSimulationModel(0,sim0);
- // test
- cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
- cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
- cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
- // end test
-
- // SDD
- cout << "Changing from Default SDD simulation, and responce." << endl;
- //Set response functions
- Float_t baseline = 10.;
- Float_t noise = 1.75;
- // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
- // 2 fTolerance
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) {
- res1=new AliITSresponseSDD();
- ITS->SetResponseModel(1,res1);
- } // end if !res1
- Float_t fCutAmp = baseline + 2.*noise;
- Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
-
- //res1->SetZeroSupp("2D");
- res1->SetZeroSupp("1D");
- res1->SetNoiseParam(noise,baseline);
- res1->SetDo10to8(kTRUE);
- res1->SetCompressParam(cp);
- res1->SetMinVal(4);
- res1->SetDiffCoeff(3.6,40.);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
- GetSegmentationModel();
- if (!seg1) {
- seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
- ITS->SetSegmentationModel(1,seg1);
- } // end if !seg1
- AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
- sim1->SetDoFFT(1);
- sim1->SetCheckNoise(kFALSE);
- ITS->SetSimulationModel(1,sim1);
-
- // SSD
- cout << "Changing from Default SSD simulation, and responce." << endl;
- AliITSDetType *iDetType = ITS->DetType(2);
- AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
- res2->SetSigmaSpread(3.,2.);
- AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
- ITS->SetSimulationModel(2,sim2);
-
- cout << "Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
- timer.Start();
- gAlice->Hits2Digits();
- timer.Stop(); timer.Print();
-
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
-
+++ /dev/null
-Int_t AliITSHits2SDigits(const char *inFile = "galice.root"){
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2SDigits" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- gAlice->GetEvent(0);
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
- << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- // SPD
- cout << "Changing from Default SPD simulation, and responce." << endl;
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
- AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
- ITS->SetSimulationModel(0,sim0);
- // test
- cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
- cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
- cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
- // end test
-
- // SDD
- cout << "Changing from Default SDD simulation, and responce." << endl;
- //Set response functions
- Float_t baseline = 10.;
- Float_t noise = 1.75;
- // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
- // 2 fTolerance
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) {
- res1=new AliITSresponseSDD();
- ITS->SetResponseModel(1,res1);
- } // end if !res1
- Float_t fCutAmp = baseline + 2.*noise;
- Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
-
- //res1->SetZeroSupp("2D");
- res1->SetZeroSupp("1D");
- res1->SetNoiseParam(noise,baseline);
- res1->SetDo10to8(kTRUE);
- res1->SetCompressParam(cp);
- res1->SetMinVal(4);
- res1->SetDiffCoeff(3.6,40.);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
- GetSegmentationModel();
- if (!seg1) {
- seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
- ITS->SetSegmentationModel(1,seg1);
- } // end if !seg1
- AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
- sim1->SetDoFFT(1);
- sim1->SetCheckNoise(kFALSE);
- ITS->SetSimulationModel(1,sim1);
-
- // SSD
- cout << "Changing from Default SSD simulation, and responce." << endl;
- AliITSDetType *iDetType = ITS->DetType(2);
- AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
- res2->SetSigmaSpread(3.,2.);
- AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
- ITS->SetSimulationModel(2,sim2);
-
- if(!gAlice->TreeS()){
- cout << "Having to create the SDigits Tree." << endl;
- gAlice->MakeTree("S");
- } // end if !gAlice->TreeS()
- //make branch
- ITS->MakeBranch("S");
- ITS->SetTreeAddress();
- cout << "Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
- timer.Start();
- ITS->Hits2SDigits();
- timer.Stop(); timer.Print();
-
- delete gAlice; gAlice=0;
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
-
+++ /dev/null
-Int_t AliITSHits2SDigitsDefault(const char *inFile = "galice.root"){
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2SDigitsDefault" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- gAlice->GetEvent(0);
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
- << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- if(!gAlice->TreeS()){
- cout << "Having to create the SDigits Tree." << endl;
- gAlice->MakeTree("S");
- } // end if !gAlice->TreeS()
- //make branch
- ITS->MakeBranch("S");
- ITS->SetTreeAddress();
- cout << "Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
- timer.Start();
- ITS->Hits2SDigits();
- timer.Stop(); timer.Print();
-
- delete gAlice; gAlice=0;
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
-
+++ /dev/null
-Int_t AliITSHitsToDigitsDefault(Int_t evNumber1=0,Int_t evNumber2=0,
- const char *inFile="galice.root"){
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro
-// illustrating how to read the output of GALICE
-// and do some analysis.
-//
-/////////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHitsToDigitsDefault" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or return if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- gAlice->GetEvent(0);
- AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
- if (!ITS){
- cerr << "ITS not found in gAlice. Exiting." << endl;
- return 3;
- } // end if
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- if(!gAlice->TreeD()){
- cout << "Having to create the Digits Tree." << endl;
- gAlice->MakeTree("D");
- } // end if !gAlice->TreeD()
- //make branch
- ITS->MakeBranch("D");
- ITS->SetTreeAddress();
-
- cout<<"Digitizing ITS..." << endl;
- TStopwatch timer;
- Long_t size0 = file->GetSize();
-
- for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
- cout << "nev " <<nev<<endl;
- if(nev>0) {
- gAlice->SetEvent(nev);
- if(!gAlice->TreeD()) gAlice->MakeTree("D");
- ITS->MakeBranch("D");
- } // end if nev>0
- if (nev < evNumber1) continue;
- timer.Start();
- ITS->HitsToDigits(nev,0,-1," ","All"," ");
- timer.Stop(); timer.Print();
- } // event loop
-
- delete gAlice; gAlice=0;
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
+++ /dev/null
-Int_t AliITSHitsToSDigits(const char *inFile="galice.root"){
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro
-// illustrating how to read the output of GALICE
-// and do some analysis.
-//
-/////////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hit
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2SDigitsDefault" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or create it if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- gAlice->GetEvent(0);
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
- << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end ifs
-
- // SPD
- cout << "Changing from Default SPD simulation, and responce." << endl;
- AliITSDetType *iDetType=ITS->DetType(0);
- AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
- AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
- ITS->SetSimulationModel(0,sim0);
- // test
- cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
- cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
- cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
- // end test
-
- // SDD
- cout << "Changing from Default SDD simulation, and responce." << endl;
- //Set response functions
- Float_t baseline = 10.;
- Float_t noise = 1.75;
- // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
- // 2 fTolerance
- AliITSDetType *iDetType=ITS->DetType(1);
- AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
- if (!res1) {
- res1=new AliITSresponseSDD();
- ITS->SetResponseModel(1,res1);
- } // end if !res1
- Float_t fCutAmp = baseline + 2.*noise;
- Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
-
- //res1->SetZeroSupp("2D");
- res1->SetZeroSupp("1D");
- res1->SetNoiseParam(noise,baseline);
- res1->SetDo10to8(kTRUE);
- res1->SetCompressParam(cp);
- res1->SetMinVal(4);
- res1->SetDiffCoeff(3.6,40.);
- AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
- GetSegmentationModel();
- if (!seg1) {
- seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
- ITS->SetSegmentationModel(1,seg1);
- } // end if !seg1
- AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
- sim1->SetDoFFT(1);
- sim1->SetCheckNoise(kFALSE);
- ITS->SetSimulationModel(1,sim1);
-
- // SSD
- cout << "Changing from Default SSD simulation, and responce." << endl;
- AliITSDetType *iDetType = ITS->DetType(2);
- AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
- GetSegmentationModel();
- AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
- res2->SetSigmaSpread(3.,2.);
- AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
- ITS->SetSimulationModel(2,sim2);
-
- if(!gAlice->TreeS()){
- cout << "Having to create the SDigits Tree." << endl;
- gAlice->MakeTree("S");
- } // end if !gAlice->TreeS()
- //make branch
- ITS->MakeBranch("S");
- ITS->SetTreeAddress();
- cout<<"Digitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
-
- for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
- cout << "nev " <<nev<<endl;
- if(nev>0) {
- gAlice->SetEvent(nev);
- if(!gAlice->TreeD()) gAlice->MakeTree("D");
- ITS->MakeBranch("D");
- } // end if nev>0
- if (nev < evNumber1) continue;
- timer.Start();
- ITS->HitsToSDigits(nev,0,-1," ","All"," ");
- timer.Stop(); timer.Print();
- } // event loop
-
- delete gAlice; gAlice=0;
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
+++ /dev/null
-Int_t AliITSHitsToSDigitsDefault(Int_t evNumber1=0,Int_t evNumber2=1,const char *inFile="galice.root"){
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro
-// illustrating how to read the output of GALICE
-// and do some analysis.
-//
-/////////////////////////////////////////////////////////////////////////
-
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
-
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
- if (file) {file->Close(); delete file;}
- cout << "AliITSHits2SDigitsDefault" << endl;
- file = new TFile(inFile,"UPDATE");
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<inFile<<" !" << endl;
- return 1;
- } // end if !file
- file->ls();
-
- // Get AliRun object from file or create it if not on file
- if (gAlice) delete gAlice;
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) {
- cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
- << endl;
- return 2;
- } // end if !gAlice
-
- gAlice->GetEvent(0);
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if (!ITS) {
- cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
- << endl;
- return 3;
- } // end if !ITS
- if(!(ITS->GetITSgeom())){
- cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
- return 4;
- } // end if
-
- if(!gAlice->TreeS()){
- cout << "Having to create the SDigits Tree." << endl;
- gAlice->MakeTree("S");
- } // end if !gAlice->TreeS()
- //make branch
- ITS->MakeBranch("S");
- ITS->SetTreeAddress();
- gAlice->GetEvent(0);
- cout<<"SDigitizing ITS..." << endl;
-
- TStopwatch timer;
- Long_t size0 = file->GetSize();
-
- for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
- cout << "nev " <<nev<<endl;
- if(nev>0) {
- gAlice->SetEvent(nev);
- if(!gAlice->TreeD()) gAlice->MakeTree("D");
- ITS->MakeBranch("D");
- } // end if nev>0
- if (nev < evNumber1) continue;
- timer.Start();
- ITS->HitsToDigits(nev,0,-1," ","All"," ");
- timer.Stop(); timer.Print();
- } // event loop
-
- delete gAlice; gAlice=0;
- file->Close();
- Long_t size1 = file->GetSize();
- cout << "File size before = " << size0 << " file size after = " << size1;
- cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
- delete file;
- return 0;
-};
+++ /dev/null
-void AliITSPrintHits(Int_t track, Int_t hit=-1, Int_t evNumber=0
- ,const char *filename="galice.root"){
-/*
- This macro will print the a specific hit or all of the hits from a give
-track.
-*/
- if(gAlice){
- delete gAlice;
- gAlice=0;
- }else{
- // Dynamically link some shared libs
- if(gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
- }
-// Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if(!file) file = new TFile(filename);
-
-// 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");
- } // end if !gAlice
-
-// Set event pointer to this event
- Int_t nparticles = gAlice->GetEvent(evNumber);
- if (nparticles <= 0){
- cout << "No particles found for event " << evNumber;
- cout << " in file " << filename << endl;
- return;
- } // end if nparticles <=0
-// Pointer to specific detector hits.
- AliITShit *itsHit;
-// Get pointers to ALL Alice detectors and Hits containers
- AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
- Int_t t,h,ntracks = gAlice->TreeH()->GetEntries();
-// Start loop on tracks in the hits containers
- for(t=0; t<ntracks;t++){
- gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(t);
- h = 0;
- for(itsHit=(AliITShit*)ITS->FirstHit(-1);itsHit;
- itsHit=(AliITShit*)ITS->NextHit()){
- if((track==itsHit->GetTrack())&&(h==hit||hit<0)){
- cout << h << " ";
- itsHit->Print((ostream*)cout);
- cout << endl;
- } // end if
- h++;
- } // end for itsHit
- } // end for t
-}
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
- #include "AliITStrackerV2.h"
-
- #include "TFile.h"
- #include "TStopwatch.h"
-#endif
-
-Int_t AliITSPropagateBackV2() {
- cerr<<"Propagating tracks back through the ITS...\n";
-
- TFile *in=TFile::Open("AliITStracksV2.root");
- if (!in->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 1;}
-
- TFile *out=TFile::Open("AliTPCtracks.root","update");
- if (!out->IsOpen()) {
- cerr<<"Can't open AliTPCtracks.root !\n"; return 2;
- }
- TFile *file=TFile::Open("AliITSclustersV2.root");
- if (!file->IsOpen()) {
- cerr<<"Can't open AliITSclustersV2.root !\n";return 3;
- }
- AliITSgeom *geom=(AliITSgeom*)file->Get("AliITSgeom");
-
- TStopwatch timer;
- AliITStrackerV2 tracker(geom);
- Int_t rc=tracker.PropagateBack(in,out);
- timer.Stop(); timer.Print();
-
- file->Close();
- in->Close();
- out->Close();
-
- return rc;
-}
+++ /dev/null
-void AliITSplotgeom(const char *filename="galice.root"){
-/////////////////////////////////////////////////////////////////////////
-// This macro displays part of the ITS sensitive volume as defined
-// in the root file.
-//
-// Root > .L AliITSplotgeom.C //this loads the macro in memory
-// Root > AliITSplotgeom(); //by default process first event
-// Root > AliITSplotgeom("galice2.root"); //process third event from
-// galice2.root file.
-//Begin_Html
-/*
-<img src="picts/AliITSplotgeom.gif">
-*/
-//End_Html
-/////////////////////////////////////////////////////////////////////////
- if(gAlice){
- delete gAlice;
- gAlice=0;
- }else{
- // Dynamically link some shared libs
- if(gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
- } // end if gAlice
- // Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if(!file) file = new TFile(filename);
-
- // 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");
- } // end if !gAlice
-
-
-// Get pointers to the ITS Alice detectors and Hits containers
- AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
- if(ITS==0){
- cout << "ITS not found. Exiting." << endl;
- return;
- } // end if ITS==0
- AliITSgeom *itsgeom = ITS->GetITSgeom();
- if(itsgeom==0){
- cout << "ITSgeom not defined. Exiting." << endl;
- return;
- } // end if itsgeom==0
- Int_t is,ie,in;
- is = itsgeom->GetStartSPD();
- ie = itsgeom->GetLastSPD()+1;
- in = ie-is;
-
- // Transformations.
-// Float_t *x = new Float_t[in];
-// Float_t *y = new Float_t[in];
-// Float_t *z = new Float_t[in];
- Float_t x,y,z;
- TRotMatrix **r = new TRotMatrix*[in];
- Int_t i,j;
- Double_t m[9];
- char name[10],title[20],name2[10],title2[20];
-// cout << in << endl;
- for(i=0;i<in;i++){
- itsgeom->GetRotMatrix(i+is,m);
- sprintf(name,"ROT%d",i+is);
- sprintf(title,"ROT%d",i+is);
- r[i] = new TRotMatrix(name,title,m);
-// cout << name << title << endl;
-// itsgeom->GetTrans(i+is,x[i],y[i],z[i]);
-// cout << i << " " << x[i] << " " << y[i] << " " << z[i] <<endl;
- } // end for i
-
- // Sensitive volumes.
- if(itsgeom->IsShapeDefined(0)){
- TBRIK *spds = (TShape*) (itsgeom->GetShape(0));
- }else{
- TBRIK *spds = new TBRIK("SPD","SPD","void",0.64,0.015,3.48);
- } // end if
-// cout << spds << endl;
- if(itsgeom->IsShapeDefined(1)){
- TBRIK *sdds = (TShape*) (itsgeom->GetShape(240));
- }else{
- TBRIK *sdds = new TBRIK("SDD","SDD","void",3.50850,0.01499,3.76320);
- } // end if
-// cout << sdds << endl;
- if(itsgeom->IsShapeDefined(2)){
- TBRIK *ssds = (TShape*) (itsgeom->GetShape(1000));
- }else{
- TBRIK *ssds = new TBRIK("SSD","SSD","void",3.65,0.015,2.00);
- } // end if
-// cout << ssds << endl;
-
- // Set up display.
-
- TCanvas *c1 = new TCanvas("c1","ITS geometry",10,10,700,700);
-// TPad *p1 = new TPad("p1","p1",0.01,0.01,0.99,0.99,46,3,1);
-// p1->Draw();
-// p1->cd();
-// TView *view = new TView(1);
-// view->SetRange(-5,-5,-5,5,5,5);
- TShape *mother = new TBRIK("Mother","Mother Volume","void",10,10,10);
-// TShape *mother = new TBRIK("Mother","Mother Volume","void",30,30,30);
-// TShape *mother = new TBRIK("Mother","Mother Volume","void",50,50,50);
- TNode *node = new TNode("node","Mother Node",mother);
- node->cd();
-
- // Set up nodes
- TNode **itsn = new TNode*[in];
- TPolyLine3D **pl = new TPolyLine3D*[in];
-/* Double_t p[5*3],axis[5*3]={1.,0.,0.,
- 0.,0.,0.,
- 0.,1.,0.,
- 0.,0.,0.,
- 0.,0.,1.}; */
- Double_t p[19*3],axis[19*3]={-0.25,0.,1.25, // 1
- +0.00,0.,1.25, // 2
- -0.25,0.,1.00, // 3
- +0.00,0.,1.00, // 4
- +0.00,0.,0.00, // 5
- +1.00,0.,0.00, // 6
- +1.25,0.,0.25, // 7
- +1.125,0.,0.125, // 8
- +1.00,0.,0.25, // 9
- +1.125,0.,0.125, // 10
- +1.25,0.,0.00, // 11
- +1.125,0.,0.125, // 12
- +1.00,0.,0.00, // 13
- +0.00,0.,0.00, // 14
- +0.00,1.,0.00, // 15
- +0.00,1.,0.125, // 16
- +0.25,1.,0.25, // 17
- +0.00,1.,0.125, // 18
- -0.25,1.,0.25, // 19
- };
- for(i=0;i<in;i++){
- itsgeom->GetTrans(i+is,x,y,z);
-/* switch (itsgeom->GetGeomMatrix(i+is)->GetDetectorIndex())
- case 0:
- sprintf(name,"SPD%d",i+is);
- sprintf(title,"SPD%d",i+is);
- sprintf(name2,"BSPD%d",i+is);
- sprintf(title2,"BSPD%d",i+is);
- itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
- spds->GetDx(),spds->GetDy(),spds->GetDz()),x,y,z,r[i]);
- break;
- case 1:
- sprintf(name,"SDD%d",i+is);
- sprintf(title,"SDD%d",i+is);
- sprintf(name2,"BSDD%d",i+is);
- sprintf(title2,"BSDD%d",i+is);
- itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
- sdds->GetDx(),sdds->GetDy(),sdds->GetDz()),x,y,z,r[i]);
- break;
- case 2:
- sprintf(name,"SSD%d",i+is);
- sprintf(title,"SSD%d",i+is);
- sprintf(name2,"BSSD%d",i+is);
- sprintf(title2,"BSSD%d",i+is);
- itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
- ssds->GetDx(),ssds->GetDy(),ssds->GetDz()),x,y,z,r[i]);
- break; */
- for(j=0;j<19;j++) itsgeom->LtoG(i+is,(Double_t*)&axis[3*j],
- (Double_t*)&p[3*j]);
- pl[i] = new TPolyLine3D(19,p);
- } // end for i
-
- // display it
- node->cd();
- node->Draw();
-// for(i=0;i<in;i++) itsn[i]->Draw();
-// node->Draw();
- for(i=0;i<in;i++) pl[i]->Draw();
- c1->Update();
-
- // clean up
-// delete[] x;
-// delete[] y;
-// delete[] z;
-// for(i=0;i<itsgeom->GetIndexMax();i++) delete[] r[i];
-// delete[] r;
-}
-
+++ /dev/null
-void AliITSsDigits2Digits(const char *filename = "galice.root"){
- // This macro takes SDigits and produces Digits. No merging is done
- // and only one galice.root file is used.
- // Dynamically link some shared libs
- TStopwatch timer;
-
- if(gAlice){
- delete gAlice;
- gAlice = 0;
- } // end if gAlice
- AliRunDigitizer * manager = new AliRunDigitizer(1,1);
- manager->SetInputStream(0,filename);
- AliITSDigitizer *dITS = new AliITSDigitizer(manager);
- timer.Start();
- manager->Exec("");
- timer.Stop(); timer.Print();
-}
+++ /dev/null
-Int_t AliITStest() {
- Int_t rc=0;
-
-//Test ITS simulation
- gROOT->LoadMacro("$(ALICE_ROOT)/macros/grun.C");
- grun();
-
- AliITSgeom *gm = ((AliITS*)(gAlice->GetDetector("ITS")))->GetITSgeom();
- delete gAlice; gAlice=0;
-
- if (!gm) {
- cerr << "This version of the ITS geometry does not have a"
- << " AliITSgeom defined" << endl;
- return 12345;
- }
-
- if (gm) {
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2DigitsDefault.C");
- if (rc=AliITSHits2DigitsDefault()) return rc;
- }
-
- cout << "start reconstruction" << endl;
-
- //Test ITS reconstruction
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClusters.C");
-
- delete gAlice; gAlice=0;
-
- if (rc=AliITSFindClusters()) return rc;
-
- //gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSgraphycs.C");
- //if (rc=AliITSgraphycs()) return rc;
-
- return rc;
-}
+++ /dev/null
-Int_t AliITStestDubna() {
- Int_t rc=0;
-
-//Test ITS simulation
- gROOT->LoadMacro("$(ALICE_ROOT)/macros/grun.C");
- grun();
-
- Int_t ver=gAlice->GetDetector("ITS")->IsVersion();
- delete gAlice; gAlice=0;
-
- if (ver!=5) {
- cerr<<"Invalid ITS version: "<<ver<<" ! (must be 5 for the moment)\n";
- return 12345;
- }
-
- if (ver==5) {
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2DigitsDubna.C");
- if (rc=AliITSHits2DigitsDubna()) return rc;
-
- }
-
- printf("start reconstruction\n");
-
-//Test ITS reconstruction
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersDubna.C");
- if (rc=AliITSFindClustersDubna()) return rc;
-
- //gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSgraphycs.C");
- //if (rc=AliITSgraphycs()) return rc;
-
- return rc;
-}
+++ /dev/null
-Int_t AliITStestV2(Char_t SlowOrFast='s') {
- Int_t rc=0;
-
- if (gAlice) {delete gAlice; gAlice=0;}
- TFile *in=TFile::Open("galice.root");
- if (!in->IsOpen()) {
- cerr<<"Can't open galice.root !\n";
- return 1;
- }
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't find gAlice !\n";
- return 2;
- }
- AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField());
- delete gAlice; gAlice=0;
- in->Close();
-
- if (SlowOrFast=='f') {
- cerr<<"Fast AliITSRecPoint(s) !\n";
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2FastRecPoints.C");
- AliITSHits2FastRecPoints();
- } else {
- cerr<<"Slow AliITSRecPoint(s) !\n";
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2SDigits.C");
- AliITSHits2SDigits();
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClusters.C");
- AliITSFindClusters();
- }
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C");
- if (rc=AliITSFindClustersV2()) return rc;
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindTracksV2.C");
- if (rc=AliITSFindTracksV2()) return rc;
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSComparisonV2.C");
- if (rc=AliITSComparisonV2()) return rc;
-
- return rc;
-}
+++ /dev/null
-Int_t AliITStestV2(Char_t SlowOrFast='s') {
- Int_t rc=0;
-
- if (gAlice) {delete gAlice; gAlice=0;}
- TFile *in=TFile::Open("galice.root");
- if (!in->IsOpen()) {
- cerr<<"Can't open galice.root !\n";
- return 1;
- }
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't find gAlice !\n";
- return 2;
- }
- AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField());
- delete gAlice; gAlice=0;
- in->Close();
-
- if (SlowOrFast=='f') {
- cerr<<"Fast AliITSRecPoint(s) !\n";
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/ITSHitsToFastPoints.C");
- ITSHitsToFastPoints();
- } else {
- cerr<<"Slow AliITSRecPoint(s) !\n";
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2Digits.C");
- AliITSHits2Digits();
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClusters.C");
- AliITSFindClusters();
- }
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C");
- if (rc=AliITSFindClustersV2()) return rc;
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindTracksV2.C");
- if (rc=AliITSFindTracksV2()) return rc;
-
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSComparisonV2.C");
- if (rc=AliITSComparisonV2()) return rc;
-
- return rc;
-}
+++ /dev/null
-#ifndef __CINT__
- #include "alles.h"
- #include "AliTPCtracker.h"
-#endif
-static const kNGoodTracks = 120000;
-
-struct GoodTrack {
- Int_t fEventN; //event number
- Int_t lab;
- Int_t code;
- Float_t px,py,pz;
- Float_t x,y,z;
- Float_t pxg,pyg,pzg,ptg;
- Bool_t flag;
-};
-Int_t good_tracks(GoodTrack *gt, Int_t max, Int_t eventn=1);
-
-Int_t AliTPCComparison4ITS(Int_t eventn=1) {
- Int_t i;
-
- gBenchmark->Start("AliTPCComparison");
-
- TFile *cf=TFile::Open("AliTPCclusters.root");
- if (!cf->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 1;}
- AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60");
- if (!digp) { cerr<<"TPC parameters have not been found !\n"; return 2; }
-
- ///////////
- AliTPCtracker *tracker =0;
- TObjArray tarray(5000);
- AliTPCtrack *iotrack=0;
- Int_t nentr= 0;
- Int_t eventptr[1000];
- TFile *tf=TFile::Open("AliTPCtracksSorted.root");
- TTree *tracktree=0;
- // Load clusters
- eventptr[0]=0;
- eventptr[1]=0;
- for (Int_t event=0;event<eventn; event++){
- cf->cd();
- tracker = new AliTPCtracker(digp,event);
- tracker->LoadInnerSectors();
- tracker->LoadOuterSectors();
-
-
- char tname[100];
- cout<<"eventn = "<<eventn<<endl;
- if (eventn==-1) {
- sprintf(tname,"TreeT_TPC");
- }
- else {
- sprintf(tname,"TreeT_TPC_%d",event);
- }
-
- // Load tracks
- if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 3;}
- tracktree=(TTree*)tf->Get(tname);
- if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n"; return 4;}
-
- TBranch *tbranch=tracktree->GetBranch("tracks");
- Int_t nentr0=(Int_t)tracktree->GetEntries();
- nentr+=nentr0;
- cout<<"Got "<<nentr0<<" entries\n";
- for (i=0; i<nentr0; i++) {
- iotrack=new AliTPCtrack;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- //iotrack->Dump();
- tracker->CookLabel(iotrack,0.1);
- tarray.AddLast(iotrack);
- }
- eventptr[event+1] = nentr; //store end of the event
- delete tracker;
- }
- tf->Close();
- cf->Close();
-
- //MI change for a moment
-
-
-/////////////////////////////////////////////////////////////////////////
- // GoodTrack gt[15000];
- GoodTrack gt[kNGoodTracks];
-
- Int_t ngood=0;
- ifstream in("good_tracks_tpc");
- /*********************************************************/
- if (in) //Case good tracks already exists
- {
- cerr<<"Reading good tracks...\n";
- while (in>>gt[ngood].fEventN>>gt[ngood].lab>>gt[ngood].code>>
- gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>>
- gt[ngood].x >>gt[ngood].y >>gt[ngood].z>>
- gt[ngood].pxg>>gt[ngood].pyg>>gt[ngood].pzg>>
- gt[ngood].ptg>>gt[ngood].flag) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==kNGoodTracks) {
- cerr<<"Too many good tracks !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_tracks_tpc) !\n";
- }
- /*********************************************************/
- else //Case good tracks do not yet exist
- {
- cerr<<"Marking good tracks (this will take a while)...\n";
- ngood=good_tracks(gt,kNGoodTracks,eventn); //mi change
- ofstream out("good_tracks_tpc");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gt[ngd].fEventN<<' '<<gt[ngd].lab<<' '<<gt[ngd].code<<' '<<
- gt[ngd].px<<' '<<gt[ngd].py<<' '<<gt[ngd].pz<<' '<<
- gt[ngd].x <<' '<<gt[ngd].y <<' '<<gt[ngd].z<<' '<<
- gt[ngd].pxg<<' '<<gt[ngd].pyg<<' '<<gt[ngd].pzg<<' '<<' '
- <<gt[ngd].ptg<<gt[ngd].flag<<endl;
- } else cerr<<"Can not open file (good_tracks_tpc) !\n";
- out.close();
-
- /*
- cerr<<"Preparing tracks for matching with the ITS...\n";
- tarray.Sort();
- tf=TFile::Open("AliTPCtracks.root","recreate");
- tracktree=new TTree("TPCf","Tree with TPC tracks");
- tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0);
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracktree->Fill();
- }
- tracktree->Write();
- tf->Close();
- */
- }
- /*********************************************************/
- cerr<<"Number of good tracks : "<<ngood<<endl;
-
- TH1F *hp=new TH1F("hp","PHI resolution",50,-20.,20.); hp->SetFillColor(4);
- TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-20,20);hl->SetFillColor(4);
- TH1F *hpt=new TH1F("hpt","Relative Pt resolution",30,-10.,10.);
- hpt->SetFillColor(2);
- TH1F *hmpt=new TH1F("hmpt","Relative Pt resolution (pt>4GeV/c)",30,-60,60);
- hmpt->SetFillColor(6);
-
- AliTPCtrack *trk=(AliTPCtrack*)tarray.UncheckedAt(0);
- Double_t pmin=0.1*(100/0.299792458/0.2/trk->GetConvConst());
- Double_t pmax=6.0+pmin;
-
- TH1F *hgood=new TH1F("hgood","Good tracks",30,pmin,pmax);
- TH1F *hfound=new TH1F("hfound","Found tracks",30,pmin,pmax);
- TH1F *hfake=new TH1F("hfake","Fake tracks",30,pmin,pmax);
- TH1F *hg=new TH1F("hg","",30,pmin,pmax); //efficiency for good tracks
- hg->SetLineColor(4); hg->SetLineWidth(2);
- TH1F *hf=new TH1F("hf","Efficiency for fake tracks",30,pmin,pmax);
- hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
- TH1F *he =new TH1F("he","dE/dX for pions with 0.4<p<0.5 GeV/c",50,0.,100.);
- TH2F *hep=new TH2F("hep","dE/dX vs momentum",50,0.,2.,50,0.,250.);
- hep->SetMarkerStyle(8);
- hep->SetMarkerSize(0.4);
-
- Int_t mingood = ngood; //MI change
- Int_t * track_notfound = new Int_t[ngood];
- Int_t itrack_notfound =0;
- Int_t * track_fake = new Int_t[ngood];
- Int_t itrack_fake = 0;
- Int_t * track_multifound = new Int_t[ngood];
- Int_t * track_multifound_n = new Int_t[ngood];
- Int_t itrack_multifound =0;
-
- while (ngood--) {
- Int_t lab=gt[ngood].lab,tlab=-1;
- Float_t ptg=
- TMath::Sqrt(gt[ngood].px*gt[ngood].px + gt[ngood].py*gt[ngood].py);
-
- if (ptg<pmin) continue;
-
- hgood->Fill(ptg);
- Int_t ievent = gt[ngood].fEventN;
-
- AliTPCtrack *track=0;
- // for (i=0; i<nentr; i++) {
- for (i=eventptr[ievent]; i<eventptr[ievent+1]; i++) {
-
- track=(AliTPCtrack*)tarray.UncheckedAt(i);
- tlab=track->GetLabel();
- if (lab==TMath::Abs(tlab)) break;
- }
- // if (i==nentr) {
- if (i==eventptr[ievent+1]) {
-
- cerr<<"Track "<<lab<<" was not found !\n";
- track_notfound[itrack_notfound++]=lab;
- continue;
- }
-
- //MI change - addition
- Int_t micount=0;
- Int_t mi;
- AliTPCtrack * mitrack;
- // for (mi=0; mi<nentr; mi++) {
- for (mi=eventptr[ievent]; mi<eventptr[ievent+1]; mi++) {
-
- mitrack=(AliTPCtrack*)tarray.UncheckedAt(mi);
- if (lab==TMath::Abs(mitrack->GetLabel())) micount++;
- }
- if (micount>1) {
- //cout<<"Track no. "<<lab<<" found "<<micount<<" times\n";
- track_multifound[itrack_multifound]=lab;
- track_multifound_n[itrack_multifound]=micount;
- itrack_multifound++;
- }
-
-
- //
- Double_t xk=gt[ngood].x;//digp->GetPadRowRadii(0,0);
- track->PropagateTo(xk);
-
- if (lab==tlab) hfound->Fill(ptg);
- else {
- track_fake[itrack_fake++]=lab;
- hfake->Fill(ptg);
- //cerr<<lab<<" fake\n";
- }
-
- Double_t par[5]; track->GetExternalParameters(xk,par);
- Float_t phi=TMath::ASin(par[2]) + track->GetAlpha();
- if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
- if (phi>=TMath::Pi()) phi-=2*TMath::Pi();
- Float_t lam=TMath::ATan(par[3]);
- Float_t pt_1=TMath::Abs(par[4]);
-
- if (TMath::Abs(gt[ngood].code)==11 && ptg>4.) {
- hmpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.);
- } else {
- Float_t phig=TMath::ATan2(gt[ngood].py,gt[ngood].px);
- hp->Fill((phi - phig)*1000.);
-
- Float_t lamg=TMath::ATan2(gt[ngood].pz,ptg);
- hl->Fill((lam - lamg)*1000.);
-
- hpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.);
- }
-
- Float_t mom=1./(pt_1*TMath::Cos(lam));
- Float_t dedx=track->GetdEdx();
- hep->Fill(mom,dedx,1.);
- if (TMath::Abs(gt[ngood].code)==211)
- if (mom>0.4 && mom<0.5) {
- he->Fill(dedx,1.);
- }
-
- }
-
-
- Stat_t ng=hgood->GetEntries(); cerr<<"Good tracks "<<ng<<endl;
- Stat_t nf=hfound->GetEntries();
- if (ng!=0)
- cerr<<"\n\n\nIntegral efficiency is about "<<nf/ng*100.<<" %\n";
-
- //MI change - addition
- cout<<"Total number of found tracks ="<<nentr<<"\n";
- cout<<"Total number of \"good\" tracks ="<<mingood<<"\n";
-
-
- cout<<"\nList of Not found tracks :\n";
- // Int_t i;
- for ( i = 0; i< itrack_notfound; i++){
- cout<<track_notfound[i]<<"\t";
- if ((i%5)==4) cout<<"\n";
- }
- cout<<"\nList of fake tracks :\n";
- for ( i = 0; i< itrack_fake; i++){
- cout<<track_fake[i]<<"\t";
- if ((i%5)==4) cout<<"\n";
- }
- cout<<"\nList of multiple found tracks :\n";
- for ( i=0; i<itrack_multifound; i++) {
- cout<<"id. "<<track_multifound[i]<<" found - "<<track_multifound_n[i]<<"times\n";
- }
- cout<<"\n\n\n";
-
-
- gStyle->SetOptStat(111110);
- gStyle->SetOptFit(1);
-
- TCanvas *c1=new TCanvas("c1","",0,0,700,850);
-
- TPad *p1=new TPad("p1","",0,0.3,.5,.6); p1->Draw();
- p1->cd(); p1->SetFillColor(42); p1->SetFrameFillColor(10);
- hp->SetFillColor(4); hp->SetXTitle("(mrad)"); hp->Fit("gaus"); c1->cd();
-
- TPad *p2=new TPad("p2","",0.5,.3,1,.6); p2->Draw();
- p2->cd(); p2->SetFillColor(42); p2->SetFrameFillColor(10);
- hl->SetXTitle("(mrad)"); hl->Fit("gaus"); c1->cd();
-
- TPad *p3=new TPad("p3","",0,0,0.5,0.3); p3->Draw();
- p3->cd(); p3->SetFillColor(42); p3->SetFrameFillColor(10);
- hpt->SetXTitle("(%)"); hpt->Fit("gaus"); c1->cd();
-
- TPad *p4=new TPad("p4","",0.5,0,1,0.3); p4->Draw();
- p4->cd(); p4->SetFillColor(42); p4->SetFrameFillColor(10);
- hmpt->SetXTitle("(%)"); hmpt->Fit("gaus"); c1->cd();
-
- TPad *p5=new TPad("p5","",0,0.6,1,1); p5->Draw(); p5->cd();
- p5->SetFillColor(41); p5->SetFrameFillColor(10);
- hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2();
- hg->Divide(hfound,hgood,1,1.,"b");
- hf->Divide(hfake,hgood,1,1.,"b");
- hg->SetMaximum(1.4);
- hg->SetYTitle("Tracking efficiency");
- hg->SetXTitle("Pt (GeV/c)");
- hg->Draw();
-
- TLine *line1 = new TLine(pmin,1.0,pmax,1.0); line1->SetLineStyle(4);
- line1->Draw("same");
- TLine *line2 = new TLine(pmin,0.9,pmax,0.9); line2->SetLineStyle(4);
- line2->Draw("same");
-
- hf->SetFillColor(1);
- hf->SetFillStyle(3013);
- hf->SetLineColor(2);
- hf->SetLineWidth(2);
- hf->Draw("histsame");
- TText *text = new TText(0.461176,0.248448,"Fake tracks");
- text->SetTextSize(0.05);
- text->Draw();
- text = new TText(0.453919,1.11408,"Good tracks");
- text->SetTextSize(0.05);
- text->Draw();
-
-
-
- TCanvas *c2=new TCanvas("c2","",320,32,530,590);
-
- TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw();
- p6->cd(); p6->SetFillColor(42); p6->SetFrameFillColor(10);
- he->SetFillColor(2); he->SetFillStyle(3005);
- he->SetXTitle("Arbitrary Units");
- he->Fit("gaus"); c2->cd();
-
- TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw();
- p7->cd(); p7->SetFillColor(42); p7->SetFrameFillColor(10);
- hep->SetXTitle("p (Gev/c)"); hep->SetYTitle("dE/dX (Arb. Units)");
- hep->Draw(); c1->cd();
-
- gBenchmark->Stop("AliTPCComparison");
- gBenchmark->Show("AliTPCComparison");
-
-
- return 0;
-}
-
-
-/*********************************************************/
-/*********************************************************/
-/*********************************************************/
-/*********************************************************/
-
-Int_t good_tracks(GoodTrack *gt, Int_t max, Int_t eventn) {
- //eventn - number of events in file
-
- TFile *file=TFile::Open("rfio:galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
-
- if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
- cerr<<"gAlice have not been found on galice.root !\n";
- exit(5);
- }
-
- // Int_t np=gAlice->GetEvent(0); //MI change
-
- AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
- Int_t ver = TPC->IsVersion();
- cerr<<"TPC version "<<ver<<" has been found !\n";
-
- AliTPCParam *digp=(AliTPCParam*)file->Get("75x40_100x60");
- if (!digp) { cerr<<"TPC parameters have not been found !\n"; exit(6); }
- TPC->SetParam(digp);
-
- Int_t nrow_up=digp->GetNRowUp();
- Int_t nrows=digp->GetNRowLow()+nrow_up;
- Int_t zero=digp->GetZeroSup();
- Int_t gap=Int_t(0.125*nrows);
- Int_t good_number=Int_t(0.4*nrows);
-
-
- //MI change
- Int_t nt=0; //reset counter
- char treeName[100]; //declare event identifier
-
- for (Int_t event=0;event<eventn;event++){
-
- Int_t np=gAlice->GetEvent(event);
- Int_t *good=new Int_t[np];
- for (Int_t ii=0; ii<np; ii++) good[ii]=0;
-
-
- //MI change to be possible compile macro
- //definition out of the swith statemnet
- Int_t sectors_by_rows=0;
- TTree *TD=0;
- AliSimDigits da, *digits=&da;
- Int_t *count=0;
- switch (ver) {
- case 1:
- {
- TFile *cf=TFile::Open("AliTPCclusters.root");
- if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n";exit(5);}
- AliTPCClustersArray *ca=new AliTPCClustersArray;
- ca->Setup(digp);
- ca->SetClusterType("AliTPCcluster");
- ca->ConnectTree("Segment Tree");
- Int_t nrows=Int_t(ca->GetTree()->GetEntries());
- for (Int_t n=0; n<nrows; n++) {
- AliSegmentID *s=ca->LoadEntry(n);
- Int_t sec,row;
- digp->AdjustSectorRow(s->GetID(),sec,row);
- AliTPCClustersRow &clrow = *ca->GetRow(sec,row);
- Int_t ncl=clrow.GetArray()->GetEntriesFast();
- while (ncl--) {
- AliTPCcluster *c=(AliTPCcluster*)clrow[ncl];
- Int_t lab=c->GetLabel(0);
- if (lab<0) continue; //noise cluster
- lab=TMath::Abs(lab);
- if (sec>=digp->GetNInnerSector())
- if (row==nrow_up-1 ) good[lab]|=0x1000;
- if (sec>=digp->GetNInnerSector())
- if (row==nrow_up-1-gap) good[lab]|=0x800;
- good[lab]++;
- }
- ca->ClearRow(sec,row);
- }
- cf->Close();
- }
- break;
- case 2:
-
- sprintf(treeName,"TreeD_75x40_100x60_%d",event);
- TD=(TTree*)gDirectory->Get(treeName);
- TD->GetBranch("Segment")->SetAddress(&digits);
- count = new Int_t[np];
- Int_t i;
- for (i=0; i<np; i++) count[i]=0;
- sectors_by_rows=(Int_t)TD->GetEntries();
- for (i=0; i<sectors_by_rows; i++) {
- if (!TD->GetEvent(i)) continue;
- Int_t sec,row;
- digp->AdjustSectorRow(digits->GetID(),sec,row);
- cerr<<sec<<' '<<row<<" \r";
- digits->First();
- do { //Many thanks to J.Chudoba who noticed this
- Int_t it=digits->CurrentRow(), ip=digits->CurrentColumn();
- Short_t dig = digits->GetDigit(it,ip);
- Int_t idx0=digits->GetTrackID(it,ip,0);
- Int_t idx1=digits->GetTrackID(it,ip,1);
- Int_t idx2=digits->GetTrackID(it,ip,2);
- if (idx0>=0 && dig>=zero) count[idx0]+=1;
- if (idx1>=0 && dig>=zero) count[idx1]+=1;
- if (idx2>=0 && dig>=zero) count[idx2]+=1;
- } while (digits->Next());
- for (Int_t j=0; j<np; j++) {
- if (count[j]>1) {
- if (sec>=digp->GetNInnerSector())
- if (row==nrow_up-1 ) good[j]|=0x1000;
- if (sec>=digp->GetNInnerSector())
- if (row==nrow_up-1-gap) good[j]|=0x800;
- good[j]++;
- }
- count[j]=0;
- }
- }
- delete[] count;
- break;
- default:
- cerr<<"Invalid TPC version !\n";
- file->Close();
- exit(7);
- }
-
- TTree *TH=gAlice->TreeH();
- Int_t npart=(Int_t)TH->GetEntries();
-
- while (npart--) {
- AliTPChit *hit0=0;
-
- TPC->ResetHits();
- TH->GetEvent(npart);
- AliTPChit * hit = (AliTPChit*) TPC->FirstHit(-1);
- while (hit){
- if (hit->fQ==0.) break;
- hit = (AliTPChit*) TPC->NextHit();
- }
- if (hit) {
- hit0 = new AliTPChit(*hit); //Make copy of hit
- hit = hit0;
- }
- else continue;
- AliTPChit *hit1=(AliTPChit*)TPC->NextHit();
- if (hit1==0) continue;
- if (hit1->fQ != 0.) continue;
- Int_t i=hit->Track();
- TParticle *p = (TParticle*)gAlice->Particle(i);
-
- if (p->GetFirstMother()>=0) continue; //secondary particle
- if (good[i] < 0x1000+0x800+2+good_number) continue;
- if (p->Pt()<0.100) continue;
- if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue;
-
- gt[nt].lab=i;
- gt[nt].code=p->GetPdgCode();
- //**** px py pz - in global coordinate system, x y z - in local !
- gt[nt].px=hit->X(); gt[nt].py=hit->Y(); gt[nt].pz=hit->Z();
- Float_t cs,sn; digp->AdjustCosSin(hit1->fSector,cs,sn);
- gt[nt].fEventN=event; //MI change
- gt[nt].x = hit1->X()*cs + hit1->Y()*sn;
- gt[nt].y =-hit1->X()*sn + hit1->Y()*cs;
- gt[nt].z = hit1->Z();
- gt[nt].pxg = p->Px();
- gt[nt].pyg = p->Py();
- gt[nt].pzg = p->Pz();
- gt[nt].ptg = p->Pt();
- gt[nt].flag = 0;
- nt++;
- if (hit0) delete hit0;
- cerr<<i<<" \r";
- if (nt==max) {cerr<<"Too many good tracks !\n"; break;}
- }
- delete[] good;
- }
- //delete gAlice; gAlice=0;
-
- file->Close();
- gBenchmark->Stop("AliTPCComparison");
- gBenchmark->Show("AliTPCComparison");
- return nt;
-}
-
-
-
+++ /dev/null
-/****************************************************************************
- * This macro is supposed to do reconstruction in the barrel ALICE trackers *
- * (Make sure you have TPC digits and ITS hits before using this macro !!!) *
- * It does the following steps (April 12, 2001): *
- * 1) TPC cluster finding *
- * 2) TPC track finding *
- * 3) ITS cluster finding V2 (via fast points !) *
- * 4) ITS track finding V2 *
- * 5) ITS back track propagation V2 *
- * 6) TPC back track propagation *
- * (Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch) *
- ****************************************************************************/
-
-#ifndef __CINT__
- #include "alles.h"
- #include "AliMagF.h"
- #include "AliTPCtracker.h"
-
- #include "AliITS.h"
- #include "AliITSgeom.h"
- #include "AliITSRecPoint.h"
- #include "AliITSclusterV2.h"
- #include "AliITSsimulationFastPoints.h"
- #include "AliITStrackerV2.h"
-#endif
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname);
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname);
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *outname);
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname);
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname);
-Int_t ITSFindTracks(const Char_t *inname, const Char_t *outname);
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname);
-
-
-Int_t AliTPCtracknew() {
- const Char_t *TPCdigName="galice.root";
- const Char_t *TPCclsName="AliTPCclusters.root";
- const Char_t *TPCtrkName="AliTPCtracks.root";
-
- const Char_t *ITSdigName="galice.root";
- const Char_t *ITSclsName="AliITSclustersV2.root";
- const Char_t *ITStrkName="AliITStracksV2.root";
-
- AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
- // AliKalmanTrack::SetConvConst(100/0.299792458/0.2/2);
-// ********** Find TPC clusters *********** //
- if (TPCFindClusters(TPCdigName,TPCclsName)) {
- cerr<<"Failed to get TPC clusters !\n";
- return 1;
- }
-
-// ********** Find TPC tracks *********** //
- if (TPCFindTracks(TPCclsName,TPCtrkName)) {
- cerr<<"Failed to get TPC tracks !\n";
- return 1;
- }
-
-// ********** Sort and label TPC tracks *********** //
- if (TPCSortTracks(TPCclsName,TPCtrkName)) {
- cerr<<"Failed to sort TPC tracks !\n";
- return 1;
- }
-/*
-// ********** Find ITS clusters *********** //
- if (ITSFindClusters(ITSdigName,ITSclsName)) {
- cerr<<"Failed to get ITS clusters !\n";
- return 1;
- }
-
-// ********** Find ITS tracks *********** //
- {TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSFindTracks(TPCtrkName,ITStrkName)) {
- cerr<<"Failed to get ITS tracks !\n";
- return 1;
- }
- clsFile->Close();}
-
-// ********** Back propagation of the ITS tracks *********** //
- {TFile *clsFile=TFile::Open(ITSclsName);
- if (ITSPropagateBack(ITStrkName,TPCtrkName)) {
- cerr<<"Failed to propagate back the ITS tracks !\n";
- return 1;
- }
- clsFile->Close();}
-
-
-// ********** Back propagation of the TPC tracks *********** //
- {TFile *clsFile=TFile::Open(TPCclsName);
- if (TPCPropagateBack(TPCtrkName,TPCtrkName)) {
- cerr<<"Failed to propagate back the TPC tracks !\n";
- return 1;
- }
- clsFile->Close();}
-*/
- return 0;
-}
-
-
-Int_t TPCFindClusters(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
-
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCv2 tpc;
- tpc.SetParam(param);
-
- tpc.Digits2Clusters(out);
-
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t TPCFindTracks(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
- AliTPCtracker *tracker=new AliTPCtracker(param);
- rc=tracker->Clusters2Tracks(0,out);
- delete tracker;
-
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t TPCSortTracks(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCSortTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- TFile *out=TFile::Open(outname);
- TFile *in =TFile::Open(inname);
- AliTPCParam *param=(AliTPCParam *)in->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
-
- TObjArray tarray(10000);
- AliTPCtrack *iotrack=0;
- Int_t i;
-
- out->cd();
- TTree *tracktree=(TTree*)out->Get("TPCf");
- TBranch *tbranch=tracktree->GetBranch("tracks");
- Int_t nentr=(Int_t)tracktree->GetEntries();
- for (i=0; i<nentr; i++) {
- iotrack=new AliTPCtrack;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- tarray.AddLast(iotrack);
- }
- tarray.Sort();
- out->Close();
-
- //assign thacks GEANT labels
- in->cd();
- AliTPCtracker *tracker = new AliTPCtracker(param);
- tracker->LoadInnerSectors();
- tracker->LoadOuterSectors();
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracker->CookLabel(iotrack,0.1);
- }
- delete tracker;
- in->Close();
- //end of GEANT label assignment
-
- out=TFile::Open(outname,"recreate");
- tracktree=new TTree("TPCf","Tree with TPC tracks");
- tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0);
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracktree->Fill();
- }
- tracktree->Write();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="ITSFindClusters";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname,"update");
-
- if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
- cerr<<"Can't get gAlice !\n";
- return 1;
- }
- Int_t ev=0;
- gAlice->GetEvent(ev);
- AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
- if (!ITS) { cerr<<"Can't get the ITS !\n"; return 1;}
-
- gAlice->MakeTree("R"); ITS->MakeBranch("R",0);
- //////////////// Taken from ITSHitsToFastPoints.C ///////////////////////
- AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
- for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,sim); }
- Int_t nsignal=25;
- Int_t size=-1;
- Int_t bgr_ev=Int_t(ev/nsignal);
- ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
- //////////////////////////////////////////////////////////////////////////
-
- gAlice->GetEvent(ev);
-
- AliITSgeom *geom=ITS->GetITSgeom();
- out->cd();
- geom->Write();
-
- TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
- TTree *cTree=new TTree("cTree","ITS clusters");
- cTree->Branch("Clusters",&clusters);
-
- TTree *pTree=gAlice->TreeR();
- if (!pTree) { cerr<<"Can't get TreeR !\n"; return 1; }
- TBranch *branch=pTree->GetBranch("ITSRecPoints");
- if (!branch) { cerr<<"Can't get ITSRecPoints branch !\n"; return 1;}
- TClonesArray *points=new TClonesArray("AliITSRecPoint",10000);
- branch->SetAddress(&points);
-
- TClonesArray &cl=*clusters;
- Int_t nclusters=0;
- Int_t nentr=(Int_t)pTree->GetEntries();
- for (Int_t i=0; i<nentr; i++) {
- if (!pTree->GetEvent(i)) {cTree->Fill(); continue;}
- Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det);
- Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift);
- Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot);
- Double_t yshift = x*rot[0] + y*rot[1];
- Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1);
- Int_t ncl=points->GetEntriesFast();
- nclusters+=ncl;
- for (Int_t j=0; j<ncl; j++) {
- AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(j);
- Float_t lp[5];
- lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0];
- lp[1]=p->GetZ()+zshift;
- lp[2]=p->GetSigmaX2();
- lp[3]=p->GetSigmaZ2();
- lp[4]=p->GetQ();
- Int_t lab[6];
- lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2);
- lab[3]=ndet;
-
- Int_t label=lab[0];
- TParticle *part=(TParticle*)gAlice->Particle(label);
- label=-3;
- while (part->P() < 0.005) {
- Int_t m=part->GetFirstMother();
- if (m<0) {cerr<<"Primary momentum: "<<part->P()<<endl; break;}
- label=m;
- part=(TParticle*)gAlice->Particle(label);
- }
- if (lab[1]<0) lab[1]=label;
- else if (lab[2]<0) lab[2]=label;
- else cerr<<"No empty labels !\n";
-
- new(cl[j]) AliITSclusterV2(lab,lp);
- }
- cTree->Fill(); clusters->Delete();
- points->Delete();
- }
- cTree->Write();
- cerr<<"Number of clusters: "<<nclusters<<endl;
-
- delete cTree; delete clusters; delete points;
-
- delete gAlice; gAlice=0;
- in->Close();
- out->Close();
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSFindTracks(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="ITSFindTracks";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
- AliITStrackerV2 tracker(geom);
-
- TFile *out=TFile::Open(outname,"recreate");
- TFile *in =TFile::Open(inname);
- rc=tracker.Clusters2Tracks(in,out);
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t ITSPropagateBack(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="ITSPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliITSgeom *geom=(AliITSgeom*)gFile->Get("AliITSgeom");
- if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
- AliITStrackerV2 tracker(geom);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker.PropagateBack(in,out);
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
-Int_t TPCPropagateBack(const Char_t *inname, const Char_t *outname) {
- Int_t rc=0;
- const Char_t *name="TPCPropagateBack";
- cerr<<'\n'<<name<<"...\n";
- gBenchmark->Start(name);
-
- AliTPCParam *param=(AliTPCParam *)gFile->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 1;}
- AliTPCtracker *tracker=new AliTPCtracker(param);
-
- TFile *out=TFile::Open(outname,"update");
- TFile *in =TFile::Open(inname);
- rc=tracker->PropagateBack(in,out);
- delete tracker;
- in->Close();
- out->Close();
-
- gBenchmark->Stop(name);
- gBenchmark->Show(name);
-
- return rc;
-}
-
+++ /dev/null
-Int_t AliTPCtracks() {
- Int_t rc=0;
-
-//Test TPC simulation
-
- gROOT->LoadMacro("$(ALICE_ROOT)/macros/grun.C");
- grun();
- //added new
- AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
-
- Int_t ver=gAlice->GetDetector("TPC")->IsVersion();
- delete gAlice; gAlice=0;
-
- if ((ver!=1)&&(ver!=2)) {
- cerr<<"Invalid TPC version: "<<ver<<" ! (must be 1 or 2)\n";
- return 12345;
- }
-
- if (ver==2) {
- gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCHits2Digits.C");
- if (rc=AliTPCHits2Digits()) return rc;
-
- }
-
-//Test TPC reconstruction
- gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindClusters.C");
- if (rc=AliTPCFindClusters()) return rc;
-
- gROOT->LoadMacro("$(ALICE_ROOT)/TPC/AliTPCFindTracks.C");
- if (rc=AliTPCFindTracks()) return rc;
- /*
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/TPCtracks.C");
- if (rc=TPCtracks()) return rc;
- */
- gROOT->LoadMacro("$(ALICE_ROOT)/ITS/TPCtracks.C");
- if (rc=TPCtracks()) return rc;
- return rc;
-}
+++ /dev/null
-/****************************************************************************
- * Very important, delicate and rather obscure macro. *
- * *
- * Creates list of "findable" V0s, *
- * calculates efficiency, resolutions etc. *
- * *
- * Origin: I.Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch *
- ****************************************************************************/
-
-#ifndef __CINT__
- #include <iostream.h>
- #include <fstream.h>
-
- #include "TH1.h"
- #include "TFile.h"
- #include "TTree.h"
- #include "TObjArray.h"
- #include "TStyle.h"
- #include "TCanvas.h"
- #include "TLine.h"
- #include "TText.h"
- #include "TParticle.h"
- #include "TStopwatch.h"
-
- #include "AliRun.h"
- #include "AliPDG.h"
- #include "AliV0vertex.h"
-#endif
-
-struct GoodVertex {
- Int_t nlab,plab;
- Int_t code;
- Float_t px,py,pz;
- Float_t x,y,z;
-};
-Int_t good_vertices(GoodVertex *gt, Int_t max);
-
-Int_t AliV0Comparison(Int_t code=310) { //Lambda=3122, LambdaBar=-3122
- cerr<<"Doing comparison...\n";
-
- const Double_t V0window=0.05, V0width=0.015;
- Double_t V0mass=0.5;
- switch (code) {
- case kK0Short: V0mass=0.497672; break;
- case kLambda0: V0mass=1.115683; break;
- case kLambda0Bar: V0mass=1.115683; break;
- default: cerr<<"Invalid PDG code !\n"; return 1;
- }
-
- TStopwatch timer;
-
- /*** Load reconstructed vertices ***/
- TFile *vf=TFile::Open("AliV0vertices.root");
- if (!vf->IsOpen()) {cerr<<"Can't open AliV0vertices.root !\n"; return 2;}
- TObjArray varray(1000);
- TTree *vTree=(TTree*)vf->Get("TreeV");
- TBranch *branch=vTree->GetBranch("vertices");
- Int_t nentr=(Int_t)vTree->GetEntries();
- for (Int_t i=0; i<nentr; i++) {
- AliV0vertex *iovertex=new AliV0vertex; branch->SetAddress(&iovertex);
- vTree->GetEvent(i);
- varray.AddLast(iovertex);
- }
-
- /*** Check if the file with the "good" vertices exists ***/
- GoodVertex gv[1000];
- Int_t ngood=0;
- ifstream in("good_vertices");
- if (in) {
- cerr<<"Reading good vertices...\n";
- while (in>>gv[ngood].nlab>>gv[ngood].plab>>gv[ngood].code>>
- gv[ngood].px>>gv[ngood].py>>gv[ngood].pz>>
- gv[ngood].x >>gv[ngood].y >>gv[ngood].z) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==1000) {
- cerr<<"Too many good vertices !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_vertices) !\n";
- } else {
- /*** generate a file with the "good" vertices ***/
- cerr<<"Marking good vertices (this will take a while)...\n";
- ngood=good_vertices(gv,1000);
- ofstream out("good_vertices");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gv[ngd].nlab<<' '<<gv[ngd].plab<<' '<<gv[ngd].code<<' '<<
- gv[ngd].px<<' '<<gv[ngd].py<<' '<<gv[ngd].pz<<' '<<
- gv[ngd].x <<' '<<gv[ngd].y <<' '<<gv[ngd].z <<endl;
- } else cerr<<"Can not open file (good_vertices) !\n";
- out.close();
- }
-
- vf->Close();
-
-
- TH1F *hp=new TH1F("hp","Angular Resolution",30,-30.,30.); //phi resolution
- hp->SetXTitle("(mrad)"); hp->SetFillColor(2);
- TH1F *hl=new TH1F("hl","Lambda Resolution",30,-30,30);
- hl->SetXTitle("(mrad)"); hl->SetFillColor(1); hl->SetFillStyle(3013);
- TH1F *hpt=new TH1F("hpt","Relative Pt Resolution",30,-10.,10.);
- hpt->SetXTitle("(%)"); hpt->SetFillColor(2);
-
- TH1F *hx=new TH1F("hx","Position Resolution (X,Y)",30,-3.,3.); //x res.
- hx->SetXTitle("(mm)"); hx->SetFillColor(6);
- TH1F *hy=new TH1F("hy","Position Resolution (Y)",30,-3.,3.); //y res
- hy->SetXTitle("(mm)"); hy->SetFillColor(1); hy->SetFillStyle(3013);
- TH1F *hz=new TH1F("hz","Position Resolution (Z)",30,-3.,3.); //z res.
- hz->SetXTitle("(mm)"); hz->SetFillColor(6);
-
-
- Double_t pmin=0.2, pmax=4.2; Int_t nchan=20;
- TH1F *hgood=new TH1F("hgood","Good Vertices",nchan,pmin,pmax);
- TH1F *hfound=new TH1F("hfound","Found Vertices",nchan,pmin,pmax);
- TH1F *hfake=new TH1F("hfake","Fake Vertices",nchan,pmin,pmax);
- TH1F *hg=new TH1F("hg","Efficiency for Good Vertices",nchan,pmin,pmax);
- hg->SetLineColor(4); hg->SetLineWidth(2);
- TH1F *hf=new TH1F("hf","Probability of Fake Vertices",nchan,pmin,pmax);
- hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
-
- Double_t mmin=V0mass-V0window, mmax=V0mass+V0window;
- TH1F *v0s =new TH1F("v0s","V0s Effective Mass",40, mmin, mmax);
- v0s->SetXTitle("(GeV)"); v0s->SetFillColor(6);
-
-
- Double_t pxg=0.,pyg=0.,ptg=0.;
- Int_t nlab=-1, plab=-1;
- Int_t i;
- for (i=0; i<nentr; i++) {
- AliV0vertex *vertex=(AliV0vertex*)varray.UncheckedAt(i);
- nlab=TMath::Abs(vertex->GetNlabel());
- plab=TMath::Abs(vertex->GetPlabel());
-
- vertex->ChangeMassHypothesis(code);
-
- Double_t mass=vertex->GetEffMass();
- v0s->Fill(mass);
-
- Int_t j;
- for (j=0; j<ngood; j++) {
- if (gv[j].code != vertex->GetPdgCode()) continue;
- if (gv[j].nlab == nlab)
- if (gv[j].plab == plab) break;
- }
-
- if (TMath::Abs(mass-V0mass)>V0width) continue;
-
- Double_t px,py,pz; vertex->GetPxPyPz(px,py,pz);
- Double_t pt=TMath::Sqrt(px*px+py*py);
-
- if (j==ngood) {
- hfake->Fill(pt);
- cerr<<"Fake vertex: ("<<nlab<<","<<plab<<")\n";
- continue;
- }
-
- pxg=gv[j].px; pyg=gv[j].py; ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
- Double_t phig=TMath::ATan2(pyg,pxg), phi=TMath::ATan2(py,px);
- Double_t lamg=TMath::ATan2(gv[j].pz,ptg), lam=TMath::ATan2(pz,pt);
- hp->Fill((phi - phig)*1000.);
- hl->Fill((lam - lamg)*1000.);
- hpt->Fill((1/pt - 1/ptg)/(1/ptg)*100.);
-
- Double_t x,y,z; vertex->GetXYZ(x,y,z);
- hx->Fill((x-gv[j].x)*10);
- hy->Fill((y-gv[j].y)*10);
- hz->Fill((z-gv[j].z)*10);
-
- hfound->Fill(ptg);
- gv[j].nlab=-1;
-
- }
- for (i=0; i<ngood; i++) {
- if (gv[i].code != code) continue;
- pxg=gv[i].px; pyg=gv[i].py; ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
- hgood->Fill(ptg);
- nlab=gv[i].nlab; plab=gv[i].plab;
- if (nlab < 0) continue;
- cerr<<"Vertex ("<<nlab<<','<<plab<<") has not been found !\n";
- }
-
- varray.Delete();
-
- Stat_t ng=hgood->GetEntries();
- Stat_t nf=hfound->GetEntries();
-
- cerr<<"Number of found vertices: "<<nentr<<" ("<<nf<<" in the peak)\n";
- cerr<<"Number of good vertices: "<<ng<<endl;
-
- if (ng!=0)
- cerr<<"Integral efficiency is about "<<nf/ng*100.<<" %\n";
-
- gStyle->SetOptStat(111110);
- gStyle->SetOptFit(1);
-
- TCanvas *c1=new TCanvas("c1","",0,0,580,610);
- c1->Divide(2,2);
-
- c1->cd(1);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hp->Fit("gaus");
- hp->Draw();
- hl->Draw("same"); c1->cd();
-
- c1->cd(2);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hpt->Fit("gaus"); c1->cd();
- hpt->Draw(); c1->cd();
-
- c1->cd(3);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hx->Fit("gaus");
- hx->Draw();
- hy->Draw("same"); c1->cd();
-
- c1->cd(4);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- //hz->Fit("gaus");
- hz->Draw();
-
-
- TCanvas *c2=new TCanvas("c2","",600,0,580,610);
- c2->Divide(1,2);
-
- c2->cd(1);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2();
- hg->Divide(hfound,hgood,1,1.,"b");
- hf->Divide(hfake,hgood,1,1.,"b");
- hg->SetMaximum(1.4);
- hg->SetYTitle("V0 reconstruction efficiency");
- hg->SetXTitle("Pt (GeV/c)");
- hg->Draw();
-
- TLine *line1 = new TLine(pmin,1.0,pmax,1.0); line1->SetLineStyle(4);
- line1->Draw("same");
- TLine *line2 = new TLine(pmin,0.9,pmax,0.9); line2->SetLineStyle(4);
- line2->Draw("same");
-
- hf->SetFillColor(1);
- hf->SetFillStyle(3013);
- hf->SetLineColor(2);
- hf->SetLineWidth(2);
- hf->Draw("histsame");
- TText *text = new TText(0.461176,0.248448,"Fake vertices");
- text->SetTextSize(0.05);
- text->Draw();
- text = new TText(0.453919,1.11408,"Good vertices");
- text->SetTextSize(0.05);
- text->Draw();
-
-
- c2->cd(2);
- gPad->SetFillColor(42); gPad->SetFrameFillColor(10);
- v0s->SetXTitle("(GeV/c)");
- v0s->Fit("gaus","","",V0mass-V0width,V0mass+V0width);
- Double_t max=v0s->GetMaximum();
- TLine *line3 = new TLine(V0mass-V0width,0.,V0mass-V0width,max);
- line3->Draw("same");
- TLine *line4 = new TLine(V0mass+V0width,0.,V0mass+V0width,max);
- line4->Draw("same");
-
- timer.Stop(); timer.Print();
-
- return 0;
-}
-
-Int_t good_vertices(GoodVertex *gv, Int_t max) {
- Int_t nv=0;
- /*** Get information about the cuts ***/
- Double_t r2min=0.9*0.9;
- Double_t r2max=2.9*2.9;
-
- /*** Get labels of the "good" tracks ***/
- Double_t dd; Int_t id, label[15000], ngt=0;
- ifstream in("good_tracks_its");
- if (!in) {
- cerr<<"Can't open the file good_tracks_its \n";
- return nv;
- }
- while (in>>label[ngt]>>id>>dd>>dd>>dd>>dd>>dd>>dd) {
- ngt++;
- if (ngt>=15000) {
- cerr<<"Too many good ITS tracks !\n";
- return nv;
- }
- }
- if (!in.eof()) {
- cerr<<"Read error (good_tracks_its) !\n";
- return nv;
- }
-
- /*** Get an access to the kinematics ***/
- if (gAlice) {delete gAlice; gAlice=0;}
-
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
- if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
- cerr<<"gAlice has not been found on galice.root !\n";
- exit(5);
- }
-
- Int_t np=gAlice->GetEvent(0);
- while (np--) {
- cerr<<np<<'\r';
- TParticle *p0=gAlice->Particle(np);
-
- /*** only these V0s are "good" ***/
- Int_t code=p0->GetPdgCode();
- if (code!=kK0Short)
- if (code!=kLambda0)
- if (code!=kLambda0Bar) continue;
-
- /*** daughter tracks should be "good" ***/
- Int_t plab=p0->GetFirstDaughter(), nlab=p0->GetLastDaughter();
- if (nlab==plab) continue;
- if (nlab<0) continue;
- if (plab<0) continue;
- Int_t i;
- for (i=0; i<ngt; i++) if (label[i]==nlab) break;
- if (i==ngt) continue;
- for (i=0; i<ngt; i++) if (label[i]==plab) break;
- if (i==ngt) continue;
-
- /*** fiducial volume ***/
- TParticle *p=gAlice->Particle(nlab);
- Double_t x=p->Vx(), y=p->Vy(), z=p->Vz(), r2=x*x+y*y;
- if (r2<r2min) continue;
- if (r2>r2max) continue;
-
- if (gAlice->Particle(plab)->GetPDG()->Charge() < 0.) {
- i=plab; plab=nlab; nlab=i;
- }
-
- gv[nv].code=code;
- gv[nv].plab=plab; gv[nv].nlab=nlab;
- gv[nv].px=p0->Px(); gv[nv].py=p0->Py(); gv[nv].pz=p0->Pz();
- gv[nv].x=x; gv[nv].y=y; gv[nv].z=z;
- nv++;
- }
-
- delete gAlice; gAlice=0;
-
- file->Close();
-
- return nv;
-}
+++ /dev/null
-#ifndef __CINT__
- #include <iostream.h>
- #include "AliV0vertexer.h"
- #include "TFile.h"
- #include "TStopwatch.h"
-#endif
-
-Int_t AliV0FindVertices() {
- cerr<<"Looking for V0 vertices...\n";
-
- TFile *out=TFile::Open("AliV0vertices.root","new");
- if (!out->IsOpen()) {cerr<<"Delete old AliV0vertices.root !\n"; return 1;}
-
- TFile *in=TFile::Open("AliITStracksV2.root");
- if (!in->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 2;}
-
- Double_t cuts[]={33, // max. allowed chi2
- 0.12,// min. allowed negative daughter's impact parameter
- 0.06,// min. allowed positive daughter's impact parameter
- 0.080,// max. allowed DCA between the daughter tracks
- 0.998,// max. allowed cosine of V0's pointing angle
- 0.9, // min. radius of the fiducial volume
- 2.9 // max. radius of the fiducial volume
- };
- TStopwatch timer;
- AliV0vertexer *vertexer=new AliV0vertexer(cuts);
- Int_t rc=vertexer->Tracks2V0vertices(in,out);
- delete vertexer;
- timer.Stop(); timer.Print();
-
- in->Close();
- out->Close();
-
- return rc;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
-};
-
-//
-void AlignITSmacro (const char *filename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro
-// illustrating how to read the output of GALICE
-// and fill some histograms.
-//
-// Root > .L AlignITS.C //this loads the macro in memory
-// Root > AlignITS(); //by default process first event
-// Root > AlignITS("galice.root"); //process file galice.root
-// Root > AlignITS("galice.root",3); // process file galice.root
-// the first 4 eventst
-// or
-// Root > .x AlignITS.C; //by default process first event
-// Root > .x AlignITS.C("galice.root"); //process file galice.root
-// Root > .x AlignITS.C("galice.root",3); // process file galice.root
-// the first 4 eventst
-/////////////////////////////////////////////////////////////////////////
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if(!file) file = new TFile(filename);
- printf("reading from file %s\n",filename);
-
- // 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");
- } /* end if gAlice */
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
-
- // define some variables for later use.
- Int_t nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TTree *TH = gAlice->TreeH();
- Int_t ntracks = TH->GetEntries();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- ClustAl_tl *trk = new ClustAl_tl[ntracks];
- Int_t ntrk;
- Float_t v0[3] = {0.0,0.0,0.0};
-
- printf("ntracks=%d\n",ntracks);
-
- HitsTo(trk,ntrk,ntracks,TH,ITS,sigma1,sigma2,sigma3,0.0,0.0,0.0);
-
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-// return;
- // setup to save all created histograms.
- char Hfilename[80];
- sprintf(Hfilename,"%s.root",sfile);
- TFile *Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
-
- FitAllTracks(trk,ntrk,v0,sfile,Hfile);
-// fit all tracks and do a track quality hist.
-
- printf("Fitted tracks, finding vertex next\n");
-
- FitVertexAll(trk,ntrk,sfile,Hfile);
-// Find all 2 track vertecies and hist. them.
-
- printf("Event %d done\n",evnt);
-
- for(Int_t i=0;i<ntrk;i++) delete trk[i].clust;
- delete[] trk;
- } /* end for evnt */
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- FILE *fp;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=0;Itimes<1;Itimes++){
- if(Itimes==0){
- fp = fopen();
- fprintf(fp,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6");
- }else if(Itimes==1){
- fp = fopen();
- fprintf(fp,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6");
- }else if(Itimes==2){
- fp = fopen();
- fprintf(fp,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6");
- }else if(Itimes==3){
- fp = fopen();
- fprintf(fp,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6");
- }else if(Itimes==4){
- fp = fopen();
- fprintf(fp,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6");
- }else if(Itimes==5){
- fp = fopen();
- fprintf(fp,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6")
- } // end if
- for(Isigmas=0;Isigmas<11;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fp = fclose();
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdta0[24];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=1;Itimes<2;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++) Fdta0[fp] = Fdta[fp];
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",ran[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",ran[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",ran[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",ran[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",ran[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",ran[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[0]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3A(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=3;Itimes<4;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3B(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=4;Itimes<5;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3C(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=5;Itimes<6;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3R(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=0;Itimes<1;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3Rphi(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=1;Itimes<2;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////
-// Alice ITS first detector alignment program. //
-// //
-// version: 0.0.0 Draft. //
-// Date: April 18 1999 //
-// By: Bjorn S. Nilsen //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
-
-// Data structure to hold averaged clusts.
-struct ClustAl_sl{
- Int_t lay,lad,det;
- Float_t xg,yg,zg,xl,yl,zl;
-};
-struct ClustAl_tl{
- Int_t track,nclust; // track number and number of data points.
- ClustAl_sl *clust; // data points to fit.
- Float_t a,b,c,d,a0,b0,c0,d0,qual; // fit parameters and fit quality.
- Float_t px,py,pz,p,pt;
- // x=a+bz and y=c+dz;
- // x=a0+b0*y and z=c0+d0*y in coordinate system of clust[0].lay,lad,det
-};
-
-//
-void AlignITSmacro3Z(const char *Rfilename="galice_ITS_B0.root",
- const char *sfile="Align_ITS_B0",
- Float_t sigma1=0.0,Float_t sigma2=0.0,Float_t sigma3=0.0,
- Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro illustrating how to
-// read the output of GALICE and fill some histograms.
-//
-// Root > .L AlignITSmacro2.C // this loads the macro in memory
-// Root > AlignITSmacro2(); // by default process first event
-// Root > AlignITSmacro2("galice.root"); // process file galice.root
-// Root > AlignITSmacro2("galice.root",3); // process file galice.root
-// the first 4 events
-// or
-// Root > .x AlignITSmacro2.C; //by default process first event
-// Root > .x AlignITSmacro2.C("galice.root"); // process file galice.root
-// Root > .x AlignITSmacro2.C("galice.root",3); // process file galice.root
-// the first 4 events
-/////////////////////////////////////////////////////////////////////////
-//
- gROOT->Reset(); // Reset root to it's default state
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
- // Connect the Root Galice file containing Geometry, Kine and Clusts
- TFile *Rfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Rfilename);
- if(!Rfile) Rfile = new TFile(Rfilename);
- printf("reading from file %s\n",Rfilename);
-
- // Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)Rfile->Get("gAlice");
- if( gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } /* end if gAlice */
-
- Float_t v0[3] = {0.0,0.0,0.0};
- Float_t tran[3] = {0.0,0.0,0.0},rot[3] = {0.0,0.0,0.0};
- Float_t trans[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // cm
- Float_t rots[15] ={0.0E-0,1.0E-4,4.0E-4,7.0E-4,1.0E-3,
- 2.0E-3,4.0E-3,6.0E-3,8.0E-3,1.0E-2,
- 2.0E-2,3.0E-2,5.0E-2,7.5E-2,1.0E-1}; // rad
- Int_t nparticles,Ntrkp,ntrk,Itimes,Isigmas;
- AliITS *ITS = 0;
- TTree *TH = 0;
- AliITSgeom *gm,gm2;
- char Hfilename[80];
-// char Gfilename[80];
- TFile *Hfile = 0;
- ClustAl_tl *trk = 0;
- Float_t Rdta[6];
- Float_t Fdta[24],Fdr[12],Fdta0[24],Fdr0[12];
- Int_t Ndta[12];
- FILE *fp1,*fp2;
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
- // define some variables for later use.
- nparticles = gAlice->GetEvent(evnt);
- printf("nparticles %d\n",nparticles);
- if (nparticles <= 0) continue; /* get next event */
-
- // Get pointers to Alice detectors and Clusts containers
- ITS = (AliITS*)gAlice->GetDetector("ITS");
- if(!ITS) return; /* error no ITS data exit */
- TH = gAlice->TreeH();
- Ntrkp = TH->GetEntries();
- gm = ITS->GetITSgeom();
-
- // Array (stucture) of clusts for the first and second layer
- // this should be replaced with either clusters or digits
- // when they are proporly defined.
- trk = new ClustAl_tl[Ntrkp];
-
- printf("Ntrkp=%d\n",Ntrkp);
-
- HitsToClustAl(trk,ntrk,Ntrkp,TH,ITS,1.0);
- printf("Filled data structures ntrk=%d fitting lines next\n",ntrk);
-//
- for(Itimes=2;Itimes<3;Itimes++){
- if(Itimes==0){
- fp1 = fopen("RvariationsR.csv","w");
- fp2 = fopen("RvariationsN.csv","w");
- fprintf(fp1,"Rr,Rs,Rrx1,Rerx1,Rsrx1,Rserx1,Rrz1,Rerz1,Rsrz1,Rserz1,"
- "Rrd1,Rerd1,Rsrd1,Resrd1,"
- "Rrx2,Rerx2,Rsrx2,Rserx2,Rrz2,Rerz2,Rsrz2,Rserz2,"
- "Rrd2,Rerd2,Rsrd2,Resrd2,"
- "Rrx3,Rerx3,Rsrx3,Rserx3,Rrz3,Rerz3,Rsrz3,Rserz3,"
- "Rrd3,Rerd3,Rsrd3,Resrd3,"
- "Rrx4,Rerx4,Rsrx4,Rserx4,Rrz4,Rerz4,Rsrz4,Rserz4,"
- "Rrd4,Rerd4,Rsrd4,Resrd4,"
- "Rrx5,Rerx5,Rsrx5,Rserx5,Rrz5,Rerz5,Rsrz5,Rserz5,"
- "Rrd5,Rerd5,Rsrd5,Resrd5,"
- "Rrx6,Rerx6,Rsrx6,Rserx6,Rrz6,Rerz6,Rsrz6,Rserz6,"
- "Rrd6,Rerd6,Rsrd6,Resrd6");
- fprintf(fp2,"Rr,Rs,RN1,RN2,RN3,RN4,RN5,RN6,RN7,RN8,RN9,RN10,"
- "RN50,Rcut");
- }else if(Itimes==1){
- fp1 = fopen("RPhivariationsR.csv","w");
- fp2 = fopen("RPhivariationsN.csv","w");
- fprintf(fp1,"Fr,Fs,Frx1,Ferx1,Fsrx1,Fserx1,Frz1,Ferz1,Fsrz1,Fserz1,"
- "Frd1,Ferd1,Fsrd1,Fesrd1,"
- "Frx2,Ferx2,Fsrx2,Fserx2,Frz2,Ferz2,Fsrz2,Fserz2,"
- "Frd2,Ferd2,Fsrd2,Fesrd2,"
- "Frx3,Ferx3,Fsrx3,Fserx3,Frz3,Ferz3,Fsrz3,Fserz3,"
- "Frd3,Ferd3,Fsrd3,Fesrd3,"
- "Frx4,Ferx4,Fsrx4,Fserx4,Frz4,Ferz4,Fsrz4,Fserz4,"
- "Frd4,Ferd4,Fsrd4,Fesrd4,"
- "Frx5,Ferx5,Fsrx5,Fserx5,Frz5,Ferz5,Fsrz5,Fserz5,"
- "Frd5,Ferd5,Fsrd5,Fesrd5,"
- "Frx6,Ferx6,Fsrx6,Fserx6,Frz6,Ferz6,Fsrz6,Fserz6,"
- "Frd6,Ferd6,Fsrd6,Fesrd6");
- fprintf(fp2,"Fr,Fs,FN1,FN2,FN3,FN4,FN5,FN6,FN7,FN8,FN9,FN10,"
- "FN50,Fcut");
- }else if(Itimes==2){
- fp1 = fopen("ZvariationsR.csv","w");
- fp2 = fopen("ZvariationsN.csv","w");
- fprintf(fp1,"Zr,Zs,Zrx1,Zerx1,Zsrx1,Zserx1,Zrz1,Zerz1,Zsrz1,Zserz1,"
- "Zrd1,Zerd1,Zsrd1,Zesrd1,"
- "Zrx2,Zerx2,Zsrx2,Zserx2,Zrz2,Zerz2,Zsrz2,Zserz2,"
- "Zrd2,Zerd2,Zsrd2,Zesrd2,"
- "Zrx3,Zerx3,Zsrx3,Zserx3,Zrz3,Zerz3,Zsrz3,Zserz3,"
- "Zrd3,Zerd3,Zsrd3,Zesrd3,"
- "Zrx4,Zerx4,Zsrx4,Zserx4,Zrz4,Zerz4,Zsrz4,Zserz4,"
- "Zrd4,Zerd4,Zsrd4,Zesrd4,"
- "Zrx5,Zerx5,Zsrx5,Zserx5,Zrz5,Zerz5,Zsrz5,Zserz5,"
- "Zrd5,Zerd5,Zsrd5,Zesrd5,"
- "Zrx6,Zerx6,Zsrx6,Zserx6,Zrz6,Zerz6,Zsrz6,Zserz6,"
- "Zrd6,Zerd6,Zsrd6,Zesrd6");
- fprintf(fp2,"Zr,Zs,ZN1,ZN2,ZN3,ZN4,ZN5,ZN6,ZN7,ZN8,ZN9,ZN10,"
- "ZN50,Zcut");
- }else if(Itimes==3){
- fp1 = fopen("AvariationsR.csv","w");
- fp2 = fopen("AvariationsN.csv","w");
- fprintf(fp1,"Ar,As,Arx1,Aerx1,Asrx1,Aserx1,Arz1,Aerz1,Asrz1,Aserz1,"
- "Ard1,Aerd1,Asrd1,Aesrd1,"
- "Arx2,Aerx2,Asrx2,Aserx2,Arz2,Aerz2,Asrz2,Aserz2,"
- "Ard2,Aerd2,Asrd2,Aesrd2,"
- "Arx3,Aerx3,Asrx3,Aserx3,Arz3,Aerz3,Asrz3,Aserz3,"
- "Ard3,Aerd3,Asrd3,Aesrd3,"
- "Arx4,Aerx4,Asrx4,Aserx4,Arz4,Aerz4,Asrz4,Aserz4,"
- "Ard4,Aerd4,Asrd4,Aesrd4,"
- "Arx5,Aerx5,Asrx5,Aserx5,Arz5,Aerz5,Asrz5,Aserz5,"
- "Ard5,Aerd5,Asrd5,Aesrd5,"
- "Arx6,Aerx6,Asrx6,Aserx6,Arz6,Aerz6,Asrz6,Aserz6,"
- "Ard6,Aerd6,Asrd6,Aesrd6");
- fprintf(fp2,"Ar,As,AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,AN9,AN10,"
- "AN50,Acut");
- }else if(Itimes==4){
- fp1 = fopen("BvariationsR.csv","w");
- fp2 = fopen("BvariationsN.csv","w");
- fprintf(fp1,"Br,Bs,Brx1,Berx1,Bsrx1,Bserx1,Brz1,Berz1,Bsrz1,Bserz1,"
- "Brd1,Berd1,Bsrd1,Besrd1,"
- "Brx2,Berx2,Bsrx2,Bserx2,Brz2,Berz2,Bsrz2,Bserz2,"
- "Brd2,Berd2,Bsrd2,Besrd2,"
- "Brx3,Berx3,Bsrx3,Bserx3,Brz3,Berz3,Bsrz3,Bserz3,"
- "Brd3,Berd3,Bsrd3,Besrd3,"
- "Brx4,Berx4,Bsrx4,Bserx4,Brz4,Berz4,Bsrz4,Bserz4,"
- "Brd4,Berd4,Bsrd4,Besrd4,"
- "Brx5,Berx5,Bsrx5,Bserx5,Brz5,Berz5,Bsrz5,Bserz5,"
- "Brd5,Berd5,Bsrd5,Besrd5,"
- "Brx6,Berx6,Bsrx6,Bserx6,Brz6,Berz6,Bsrz6,Bserz6,"
- "Brd6,Berd6,Bsrd6,Besrd6");
- fprintf(fp2,"Br,Bs,BN1,BN2,BN3,BN4,BN5,BN6,BN7,BN8,BN9,BN10,"
- "BN50,Bcut");
- }else if(Itimes==5){
- fp1 = fopen("CvariationsR.csv","w");
- fp2 = fopen("CvariationsN.csv","w");
- fprintf(fp1,"Cr,Cs,Crx1,Cerx1,Csrx1,Cserx1,Crz1,Cerz1,Csrz1,Cserz1,"
- "Crd1,Cerd1,Csrd1,Cesrd1,"
- "Crx2,Cerx2,Csrx2,Cserx2,Crz2,Cerz2,Csrz2,Cserz2,"
- "Crd2,Cerd2,Csrd2,Cesrd2,"
- "Crx3,Cerx3,Csrx3,Cserx3,Crz3,Cerz3,Csrz3,Cserz3,"
- "Crd3,Cerd3,Csrd3,Cesrd3,"
- "Crx4,Cerx4,Csrx4,Cserx4,Crz4,Cerz4,Csrz4,Cserz4,"
- "Crd4,Cerd4,Csrd4,Cesrd4,"
- "Crx5,Cerx5,Csrx5,Cserx5,Crz5,Cerz5,Csrz5,Cserz5,"
- "Crd5,Cerd5,Csrd5,Cesrd5,"
- "Crx6,Cerx6,Csrx6,Cserx6,Crz6,Cerz6,Csrz6,Cserz6,"
- "Crd6,Cerd6,Csrd6,Cesrd6");
- fprintf(fp2,"Cr,Cs,CN1,CN2,CN3,CN4,CN5,CN6,CN7,CN8,CN9,CN10,"
- "CN50,Ccut");
- } // end if
- fprintf(fp1,"\n");
- fprintf(fp2,"\n");
- for(Isigmas=0;Isigmas<15;Isigmas++){
-//
-// tran[0] = sigma1;
-// tran[1] = sigma2;
-// tran[2] = sigma3;
- if(Itimes==0){ tran[0] = trans[Isigmas];
- }else tran[0] = 0.0;
- if(Itimes==1){ tran[1] = trans[Isigmas];
- }else tran[1] = 0.0;
- if(Itimes==2){ tran[2] = trans[Isigmas];
- }else tran[2] = 0.0;
- if(Itimes==3){ rot[0] = rots[Isigmas];
- }else rot[0] = 0.0;
- if(Itimes==4){ rot[1] = rots[Isigmas];
- }else rot[1] = 0.0;
- if(Itimes==5){ rot[2] = rots[Isigmas];
- }else rot[2] = 0.0;
- printf("tran= %e %e %e (cm), rot=%e %e %e (rad)\n",
- tran[0],tran[1],tran[2],rot[0],rot[1],rot[2]);
-//
- gm2 = *gm;
- gm2.RandomCylindericalChange(tran,rot);
-
- FillGlobalPositions(trk,ntrk,&gm2);
- // setup to save all created histograms.
- sprintf(Hfilename,"%s_%04.0fr%04.0fp%04.0fz%04.0fx%04.0fy%04.0fz.root",
- sfile,
- 10000.*tran[0],10000.*tran[1],10000.*tran[2],
- 10000.* rot[0],10000.* rot[1],10000.* rot[2]);
- Hfile = (TFile*)gROOT->GetListOfFiles()->FindObject(Hfilename);
- if(Hfile) Hfile->Close();
- Hfile = new TFile(Hfilename,"RECREATE","Histograms from AlignITS.C");
- printf("Histograms saved to file %s\n",Hfilename);
- //
- PlotGeomChanges(gm,&gm2,Hfile,Rdta);
- //
- // fit all tracks and do a track quality hist.
- FitAllTracks(trk,ntrk,v0,&gm2,sfile,Hfile,Fdta,Ndta);
-//
- for(Int_t l=0;l<6;l++){
- Fdr[2*l+0] = sqrt(Fdta[4*l+0]*Fdta[4*l+0] +
- Fdta[4*l+2]*Fdta[4*l+2]);
- Fdr[2*l+1] = sqrt(Fdta[4*l+0]*Fdta[4*l+0]*
- Fdta[4*l+1]*Fdta[4*l+1] +
- Fdta[4*l+2]*Fdta[4*l+2]*
- Fdta[4*l+3]*Fdta[4*l+3])/Fdr[2*l+0];
- } // end for l
- if(Isigmas==0){
- for(Int_t fp=0;fp<24;fp++){
- Fdta0[fp] = Fdta[fp];
- if(fp<12) Fdr0[fp] = Fdr[fp];
- } // end for fp
- } // end if Itimes==0&&Isigmas==0
- if(Itimes==0) fprintf(fp1,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp1,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp1,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp1,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp1,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp1,"%e,%e,",rot[2],Rdta[5]);
- if(Itimes==0) fprintf(fp2,"%e,%e,",tran[0],Rdta[0]);
- else if(Itimes==1) fprintf(fp2,"%e,%e,",tran[1],Rdta[1]);
- else if(Itimes==2) fprintf(fp2,"%e,%e,",tran[2],Rdta[2]);
- else if(Itimes==3) fprintf(fp2,"%e,%e,",rot[0],Rdta[3]);
- else if(Itimes==4) fprintf(fp2,"%e,%e,",rot[1],Rdta[4]);
- else if(Itimes==5) fprintf(fp2,"%e,%e,",rot[2],Rdta[5]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[0],Fdta[1],Fdta[0]/Fdta0[0],Fdta[1]/Fdta0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[2],Fdta[3],Fdta[2]/Fdta0[2],Fdta[3]/Fdta0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[0],Fdr[1],Fdr[0]/Fdr0[0],Fdr[1]/Fdr0[0]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[4],Fdta[5],Fdta[4]/Fdta0[4],Fdta[5]/Fdta0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[6],Fdta[7],Fdta[6]/Fdta0[6],Fdta[7]/Fdta0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[2],Fdr[3],Fdr[2]/Fdr0[2],Fdr[3]/Fdr0[2]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[8],Fdta[9],Fdta[8]/Fdta0[8],Fdta[9]/Fdta0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[10],Fdta[11],Fdta[10]/Fdta0[10],Fdta[11]/Fdta0[10]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[4],Fdr[5],Fdr[4]/Fdr0[4],Fdr[5]/Fdr0[4]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[12],Fdta[12],Fdta[12]/Fdta0[12],Fdta[13]/Fdta0[12]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[14],Fdta[13],Fdta[14]/Fdta0[14],Fdta[15]/Fdta0[14]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[6],Fdr[7],Fdr[6]/Fdr0[6],Fdr[7]/Fdr0[6]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[16],Fdta[15],Fdta[16]/Fdta0[16],Fdta[17]/Fdta0[16]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[18],Fdta[17],Fdta[18]/Fdta0[18],Fdta[19]/Fdta0[18]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdr[8],Fdr[9],Fdr[8]/Fdr0[8],Fdr[9]/Fdr0[8]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[20],Fdta[19],Fdta[20]/Fdta0[20],Fdta[21]/Fdta0[20]);
- fprintf(fp1,"%e,%e,%e,%e,",Fdta[22],Fdta[21],Fdta[22]/Fdta0[22],Fdta[23]/Fdta0[22]);
- fprintf(fp1,"%e,%e,%e,%e\n",Fdr[10],Fdr[11],Fdr[10]/Fdr0[10],Fdr[11]/Fdr0[10]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[0],Ndta[1],Ndta[2],Ndta[3]);
- fprintf(fp2,"%d,%d,%d,%d,",Ndta[4],Ndta[5],Ndta[6],Ndta[7]);
- fprintf(fp2,"%d,%d,%d,%d\n",Ndta[8],Ndta[9],Ndta[10],Ndta[11]);
-// FitVertexAll(trk,ntrk,sfile,Hfile);
- // Find all 2 track vertecies and hist. them.
- Hfile->Close();
- //
- } // end for Isigmas
- fclose(fp1);
- fclose(fp2);
- } // end for Itimes
-//
- printf("Event %d done\n",evnt);
-//
- deleteClustAl(trk,ntrk); // subrotine to delet memory allocated
- // inside HitsToclustAl.
- delete[] trk; // now delet memory allocated above.
- } // end for evnt
- Rfile->Close();
- return;
-}
+++ /dev/null
-enum gentype_t {hijing, hijingParam, gun, box, pythia,
- param1, param2, param3, param4,
- cocktail, fluka, halo, ntuple, scan, doublescan};
-
-//gentype_t gentype=hijingParam;
-//gentype_t gentype=hijing;
- gentype_t gentype=
- //box;
- cocktail;
- //hijingParam;
- //hijing;
-
-void Config()
-{
- // 7-DEC-2000 09:00
- // Switch on Transition Radiation simulation. 6/12/00 18:00
- // iZDC=1 7/12/00 09:00
- // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
-
- // Set Random Number seed
- // gRandom->SetSeed(12345);
-
- new AliGeant3("C++ Interface to Geant3");
-
- if (!gSystem->Getenv("CONFIG_FILE"))
- {
- TFile *rootfile = new TFile("galice.root", "recreate");
- //TFile *rootfile = new TFile("galice.root", "recreate");
- rootfile->SetCompressionLevel(2);
- }
-
- TGeant3 *geant3 = (TGeant3 *) gMC;
-
- //
- // Set External decayer
- AliDecayer *decayer = new AliDecayerPythia();
-
- decayer->SetForceDecay(kAll);
- decayer->Init();
- gMC->SetExternalDecayer(decayer);
- //
- //
- //=======================================================================
- // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
- geant3->SetTRIG(1); //Number of events to be processed
- geant3->SetSWIT(4, 10);
- geant3->SetDEBU(0, 0, 1);
- //geant3->SetSWIT(2,2);
- geant3->SetDCAY(1);
- geant3->SetPAIR(1);
- geant3->SetCOMP(1);
- geant3->SetPHOT(1);
- geant3->SetPFIS(0);
- geant3->SetDRAY(0);
- geant3->SetANNI(1);
- geant3->SetBREM(1);
- geant3->SetMUNU(1);
- geant3->SetCKOV(1);
- geant3->SetHADR(1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
- geant3->SetLOSS(2);
- geant3->SetMULS(1);
- geant3->SetRAYL(1);
- geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
- geant3->SetABAN(0); //Restore 3.16 behaviour for abandoned tracks
- geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2)
- geant3->SetERAN(5.e-7);
-
- Float_t cut = 1.e-3; // 1MeV cut by default
- Float_t tofmax = 1.e10;
-
- // GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
- geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, cut,
- tofmax);
- //
- //=======================================================================
- // ************* STEERING parameters FOR ALICE SIMULATION **************
- // --- Specify event type to be tracked through the ALICE setup
- // --- All positions are in cm, angles in degrees, and P and E in GeV
- if (gSystem->Getenv("CONFIG_NPARTICLES"))
- {
- int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
- } else
- {
- int nParticles = 50;
- }
-//-----------------------------------------------------------
-switch(gentype)
-{
- case hijing:
-//-----------------------------------------HIJING------------
-AliGenHijing *gener = new AliGenHijing(-1);
- gener->SetEnergyCMS(5500);
- gener->SetReferenceFrame("CMS ");
- gener->SetProjectile("A ", 208, 82);
- gener->SetTarget ("A ", 208, 82);
- gener->SetImpactParameterRange(0, 3.);
- gener->SetEvaluate(1);
- gener->KeepFullEvent();
- gener->SetJetQuenching(1);
- gener->SetShadowing(1);
- gener->SetDecaysOff(1);
- gener->SetTrigger(0);
- gener->SetSelectAll(0);
- gener->SetMomentumRange( 0.05 , 1.3 );
- gener->SetPhiRange( 0.0 , 1.0 );
-// gener->SetPhiRange(-180.,180.)
- gener->SetThetaRange(45.0,135.);
- gener->SetFlavor(0); // 0 - all, 4 - charm and beaty
- gener->SetOrigin(0., 0.0 ,0);
- gener->SetSigma(0,0,5.3);
- gener->SetVertexSmear(kPerEvent);
-// gener->SetTrackingFlag(0);
- gener->Init();
- break;
-//-----------------------------------------HijingPARA----------
- case hijingParam:
-
- AliGenHIJINGpara *gener = new AliGenHIJINGpara(20);
-
- gener->SetMomentumRange(0.1, .7);
- gener->SetThetaRange(45.,135.);
- gener->SetPhiRange(0, 360);
- // gener->SetThetaRange(0.28,179.72);
- // gener->SetThetaRange(45., 135.);
- gener->SetOrigin(0, 0, 0); //vertex position
- gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
- gener->Init();
- break;
-//------------------------------------------ Box --------------
- case box:
- AliGenBox *gener = new AliGenBox(4000); //ntracks=100
- gener->SetMomentumRange(0.2,1.0);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(45, 135. );
- gener->SetOrigin(0,0,0);
- //vertex position
- gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener->SetPart(321); // K+
- //gener->SetPart(211); // Pi+
- break;
-
- //------------------------------------------------------------
- case cocktail:
- AliGenCocktail *gener = new AliGenCocktail();
- int Nmax=50;
- AliGenBox *gener1 = new AliGenBox(2*Nmax); //ntracks=100
- gener1->SetMomentumRange(.050,1.00);
- //gener1->SetMomentumRange(.050,0.80);
- gener1->SetPhiRange(0,360);
- gener1->SetThetaRange(45, 135. );
- gener1->SetOrigin(0,0,0);
- gener1->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener1->SetPart(321); // K+
-
- AliGenBox *gener2 = new AliGenBox(2*Nmax); //ntracks=100
- gener2->SetMomentumRange(.050,1.00);
- //gener1->SetMomentumRange(.050,0.80);
- gener2->SetPhiRange(0,360);
- gener2->SetThetaRange(45, 135. );
- gener2->SetOrigin(0,0,0);
- gener2->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener2->SetPart(2212); // Protons
-
- AliGenBox *gener3 = new AliGenBox(Nmax); //ntracks=100
- gener3->SetMomentumRange(.050,1.00);
- //gener1->SetMomentumRange(.050,0.80);
- gener3->SetPhiRange(0,360);
- gener3->SetThetaRange(45, 135. );
- gener3->SetOrigin(0,0,0);
- gener3->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener3->SetPart(11); // e+
-
-
- AliGenBox *gener4 = new AliGenBox(Nmax); //ntracks=100
- gener4->SetMomentumRange(.050,1.00);
- //gener1->SetMomentumRange(.050,0.80);
- gener4->SetPhiRange(0,360);
- gener4->SetThetaRange(45, 135. );
- gener4->SetOrigin(0,0,0);
- gener4->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener4->SetPart(211); // pi+
-
- gener->SetMomentumRange(.050,1.00);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(45., 135. );
- gener->SetOrigin(0,0,0);
- gener->SetSigma(0,0,0);
- gener->AddGenerator(gener1,"box1",0.5);
- gener->AddGenerator(gener2,"box2",0.5);
- gener->AddGenerator(gener3,"box3",0.5);
- gener->AddGenerator(gener4,"box4",0.5);
- gener->Init();
- break;
-
- default:
- break;
-}
- //
- // Activate this line if you want the vertex smearing to happen
- // track by track
- //
- //gener->SetVertexSmear(perTrack);
-
- gAlice->SetField(-999, 2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
-
- Int_t iABSO = 0;
- Int_t iCASTOR = 0;
- Int_t iDIPO = 0;
- Int_t iFMD = 0;
- Int_t iFRAME = 0;
- Int_t iHALL = 0;
- Int_t iITS = 1;
- Int_t iMAG = 0;
- Int_t iMUON = 0;
- Int_t iPHOS = 0;
- Int_t iPIPE = 1;
- Int_t iPMD = 0;
- Int_t iRICH = 0;
- Int_t iSHIL = 0;
- Int_t iSTART = 0;
- Int_t iTOF = 0;
- Int_t iTPC = 1;
- Int_t iTRD = 0;
- Int_t iZDC = 0;
-
- //=================== Alice BODY parameters =============================
- AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
-
-
- if (iMAG)
- {
- //=================== MAG parameters ============================
- // --- Start with Magnet since detector layouts may be depending ---
- // --- on the selected Magnet dimensions ---
- AliMAG *MAG = new AliMAG("MAG", "Magnet");
- }
-
-
- if (iABSO)
- {
- //=================== ABSO parameters ============================
- AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
- }
-
- if (iDIPO)
- {
- //=================== DIPO parameters ============================
-
- AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
- }
-
- if (iHALL)
- {
- //=================== HALL parameters ============================
-
- AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
- }
-
-
- if (iFRAME)
- {
- //=================== FRAME parameters ============================
-
- AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
-
- }
-
- if (iSHIL)
- {
- //=================== SHIL parameters ============================
-
- AliSHIL *SHIL = new AliSHILv0("SHIL", "Shielding");
- }
-
-
- if (iPIPE)
- {
- //=================== PIPE parameters ============================
-
- AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
- }
-
- if(iITS) {
-
-//=================== ITS parameters ============================
- //
- // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
- // almost all other detectors. This involves the fact that the ITS geometry
- // still has several options to be followed in parallel in order to determine
- // the best set-up which minimizes the induced background. All the geometries
- // available to date are described in the following. Read carefully the comments
- // and use the default version (the only one uncommented) unless you are making
- // comparisons and you know what you are doing. In this case just uncomment the
- // ITS geometry you want to use and run Aliroot.
- //
- // Detailed geometries:
- //
- //
- //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
- //
- //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
- //
- AliITSvPPRasymm *ITS = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
- ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
- ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
- ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
- ITS->SetThicknessDet1(300.); // detector thickness on layer 1 must be in the range [100,300]
- ITS->SetThicknessDet2(300.); // detector thickness on layer 2 must be in the range [100,300]
- ITS->SetThicknessChip1(300.); // chip thickness on layer 1 must be in the range [150,300]
- ITS->SetThicknessChip2(300.); // chip thickness on layer 2 must be in the range [150,300]
- ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
- ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
- //
- //AliITSvPPRsymm *ITS = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
- //ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
- //ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
- //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
- //ITS->SetThicknessDet1(300.); // detector thickness on layer 1 must be in the range [100,300]
- //ITS->SetThicknessDet2(300.); // detector thickness on layer 2 must be in the range [100,300]
- //ITS->SetThicknessChip1(300.); // chip thickness on layer 1 must be in the range [150,300]
- //ITS->SetThicknessChip2(300.); // chip thickness on layer 2 must be in the range [150,300]
- //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
- //ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
- //
- //
- // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
- // for reconstruction !):
- //
- //
- //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
- //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
- //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
- //
- //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
- //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
- //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
- //
- //
- //
- // Geant3 <-> EUCLID conversion
- // ============================
- //
- // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
- // media to two ASCII files (called by default ITSgeometry.euc and
- // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
- // The default (=0) means that you dont want to use this facility.
- //
- ITS->SetEUCLID(0);
- }
-
-
- if (iTPC)
- {
- //============================ TPC parameters ================================
- // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
- // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
- // --- sectors are specified, any value other than that requires at least one
- // --- sector (lower or upper)to be specified!
- // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
- // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
- // --- SecLows - number of lower sectors specified (up to 6)
- // --- SecUps - number of upper sectors specified (up to 12)
- // --- Sens - sensitive strips for the Slow Simulator !!!
- // --- This does NOT work if all S or L-sectors are specified, i.e.
- // --- if SecAL or SecAU < 0
- //
- //
- //-----------------------------------------------------------------------------
-
- // gROOT->LoadMacro("SetTPCParam.C");
- // AliTPCParam *param = SetTPCParam();
- AliTPC *TPC = new AliTPCv2("TPC", "Default");
-
- // All sectors included
- TPC->SetSecAL(-1);
- TPC->SetSecAU(-1);
-
- }
-
- if (iTOF)
- {
- //=================== TOF parameters ============================
- AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
- }
-
- if (iRICH)
- {
- //=================== RICH parameters ===========================
- AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
-
- }
-
-
- if (iZDC)
- {
- //=================== ZDC parameters ============================
-
- AliZDC *ZDC = new AliZDCv1("ZDC", "normal ZDC");
- }
-
- if (iCASTOR)
- {
- //=================== CASTOR parameters ============================
-
- AliCASTOR *CASTOR = new AliCASTORv1("CASTOR", "normal CASTOR");
- }
-
- if (iTRD)
- {