]>
Commit | Line | Data |
---|---|---|
dc8af42e | 1 | // --- ROOT system --- |
2 | #include "TTask.h" | |
3 | #include "TTree.h" | |
4 | #include "TSystem.h" | |
5 | #include "TFile.h" | |
6 | // --- Standard library --- | |
7 | ||
8 | // --- AliRoot header files --- | |
9 | ||
10 | #include "AliFMDdigit.h" | |
11 | #include "AliFMDReconstParticles.h" | |
12 | #include "AliFMD.h" | |
13 | #include "AliFMDv1.h" | |
14 | #include "AliFMDReconstruction.h" | |
15 | #include "AliRun.h" | |
16 | #include "AliDetector.h" | |
17 | ||
18 | #include "TROOT.h" | |
19 | #include "TFolder.h" | |
20 | #include <stdlib.h> | |
21 | #include <iostream.h> | |
22 | #include <fstream.h> | |
23 | ||
24 | ClassImp(AliFMDReconstruction) | |
25 | ||
26 | ||
27 | //____________________________________________________________________________ | |
28 | ||
29 | AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","") | |
30 | { | |
31 | fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file | |
32 | // add Task to //root/Tasks folder | |
33 | TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; | |
34 | roottasks->Add(this) ; | |
35 | } | |
36 | //____________________________________________________________________________ | |
37 | ||
38 | AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","") | |
39 | { | |
40 | fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file | |
41 | fReconstParticlesFile=ReconstParticlesFile ; | |
42 | fHeadersFile=HeaderFile ; | |
43 | //add Task to //root/Tasks folder | |
44 | TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; | |
45 | roottasks->Add(this) ; | |
46 | } | |
47 | ||
48 | //____________________________________________________________________________ | |
49 | ||
50 | AliFMDReconstruction::~AliFMDReconstruction() | |
51 | { | |
52 | ||
53 | } | |
54 | ||
55 | //____________________________________________________________________________ | |
56 | ||
57 | void AliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) | |
58 | { | |
59 | //Collects all digits in the same active volume into number of particles | |
60 | ||
61 | AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD"); | |
62 | if(fNevents == 0) fNevents=(Int_t)gAlice->TreeD()->GetEntries(); | |
63 | for(Int_t ievent=0;ievent<fNevents;ievent++) | |
64 | { | |
65 | gAlice->GetEvent(ievent) ; | |
66 | if(gAlice->TreeH()==0) return; | |
67 | if(gAlice->TreeR()==0) gAlice->MakeTree("R"); | |
68 | //Make branches | |
69 | FMD->MakeBranch("R"); | |
70 | Int_t threshold[]={ 0, 18, 37, 56, 76, | |
71 | 96, 119, 138, 165, 172, | |
72 | 218, 231, 238, 277, 304, | |
73 | 330, 357, 423, 449, 476, | |
74 | 522, 542, 555, 568, 581, | |
75 | 614, 624, 657, 674, 687, | |
76 | 700, 713, 720, 727, 733, | |
77 | 740, 759, 778, 797, 816, | |
78 | 834, 853, 872, 891, 910, | |
79 | 929, 948, 967, 986, 1024}; | |
80 | ||
81 | ||
82 | int threshold_array_size=sizeof(threshold)/sizeof(threshold[0]); | |
83 | AliFMDdigit *fmdDigit; | |
84 | ||
85 | if (FMD) | |
86 | { | |
87 | gAlice->TreeD()->GetEvent(0); | |
88 | TClonesArray *FMDdigits=FMD->Digits(); | |
89 | Int_t nDigits=FMDdigits->GetEntries(); | |
90 | Int_t RecParticles[4]; | |
91 | Int_t nRecPart=0 ; | |
92 | for (Int_t digit=0;digit<nDigits;digit++) | |
93 | { | |
94 | fmdDigit=(AliFMDdigit*)FMDdigits->UncheckedAt(digit); | |
95 | RecParticles[0] = fmdDigit->Volume(); | |
96 | RecParticles[1] = fmdDigit->NumberOfSector(); | |
97 | RecParticles[2] = fmdDigit->NumberOfRing(); | |
98 | Int_t ADC=fmdDigit->ADCsignal(); | |
99 | RecParticles[3]=0; //case when fmdDigit->ADCsignal()==0 | |
100 | for (int i=0;i<threshold_array_size-1;i++) | |
101 | { | |
102 | if(ADC>threshold[i]&&ADC<=threshold[i+1]) | |
103 | RecParticles[3]=i; | |
104 | } | |
105 | new((*fReconParticles)[nRecPart++]) AliFMDReconstParticles(RecParticles); | |
106 | } //digit loop | |
107 | }//if FMD | |
108 | gAlice->TreeR()->Reset(); | |
109 | gAlice->TreeR()->Fill(); | |
110 | gAlice->TreeR()->Write(0,TObject::kOverwrite); | |
111 | } //event loop | |
112 | cout<<"\nAliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) finished"<<endl; | |
113 | } | |
114 | //__________________________________________________________________ | |
115 | ||
116 | void AliFMDReconstruction::SetReconstParticlesFile(char * file ) | |
117 | { | |
118 | if (!fReconstParticlesFile.IsNull()) | |
119 | cout<<"\nChanging reconstructed particles file from "<< | |
120 | (char *) fReconstParticlesFile.Data()<< " to "<<file<<endl; | |
121 | fReconstParticlesFile=file; | |
122 | } | |
123 | //__________________________________________________________________ | |
124 | void AliFMDReconstruction::Print(Option_t* option)const | |
125 | { | |
126 | cout<<"------------------- "<<GetName() <<" -------------"<< endl ; | |
127 | if(fReconstParticlesFile.IsNull()) | |
128 | cout<<"\nWriting reconstructed particles to file"<<endl ; | |
129 | else | |
130 | cout<<"\nWriting reconstructed particles to file "<< | |
131 | (char*) fReconstParticlesFile.Data() << endl ; | |
132 | } | |
133 | ||
134 | ||
135 | ||
136 | ||
137 |