/[PAMELA software]/DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp
ViewVC logotype

Annotation of /DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Wed Nov 22 08:31:11 2006 UTC (18 years ago) by mocchiut
Branch: MAIN
CVS Tags: v2r01
Changes since 1.8: +3 -88 lines
Calorimeter major upgrade, Level1 branch + CaloStrip class

1 mocchiut 1.1 /**
2     * \file src/CaloLevel2.cpp
3     * \author Emiliano Mocchiutti
4     *
5     **/
6     #include <TObject.h>
7     #include <CaloLevel2.h>
8 mocchiut 1.9
9     //
10 mocchiut 1.1 ClassImp(CaloTrkVar);
11     ClassImp(CaloLevel2);
12    
13     /**
14     * CaloTrkVar constructor
15     **/
16     CaloTrkVar::CaloTrkVar() {
17 mocchiut 1.7 this->Clear();
18     };
19    
20     /**
21     * Clear variables
22     **/
23     void CaloTrkVar::Clear() {
24 mocchiut 1.1 trkseqno = 0;
25     noint = 0;
26     ncore = 0;
27     qcore = 0.;
28     ncyl = 0;
29     qcyl = 0.;
30     qtrack = 0.;
31     qtrackx = 0.;
32     qtracky = 0.;
33     dxtrack = 0.;
34     dytrack = 0.;
35     qlast = 0.;
36     nlast = 0;
37     qpre = 0.;
38     npre = 0;
39     qpresh = 0.;
40     npresh = 0;
41     qtr = 0.;
42     ntr = 0;
43     planetot = 0;
44     qmean = 0.;
45     qlow = 0.;
46     nlow = 0;
47     dX0l = 0.;
48 mocchiut 1.5 memset(tbar, 0, 2*22*sizeof(Float_t));
49     memset(tibar, 0, 2*22*sizeof(Int_t));
50 mocchiut 1.1 }
51    
52     /**
53     * Copies from t to this
54     **/
55     CaloTrkVar::CaloTrkVar(const CaloTrkVar &t){
56     trkseqno = t.trkseqno;
57     noint = t.noint;
58     ncore = t.ncore;
59     qcore = t.qcore;
60     ncyl = t.ncyl;
61     qcyl = t.qcyl;
62     qtrack = t.qtrack;
63     qtrackx = t.qtrackx;
64     qtracky = t.qtracky;
65     dxtrack = t.dxtrack;
66     dytrack = t.dytrack;
67     qlast = t.qlast;
68     nlast = t.nlast;
69     qpre = t.qpre;
70     npre = t.npre;
71     qpresh = t.qpresh;
72     npresh = t.npresh;
73     qtr = t.qtr;
74     ntr = t.ntr;
75     planetot = t.planetot;
76     qmean = t.qmean;
77     dX0l = t.dX0l;
78     qlow = t.qlow;
79     nlow = t.nlow;
80     memcpy(tibar,t.tibar,sizeof(tibar));
81     memcpy(tbar,t.tbar,sizeof(tbar));
82     }
83    
84     /**
85     * CaloLevel2 constructor
86     **/
87     CaloLevel2::CaloLevel2() {
88     //
89     CaloTrk = new TClonesArray("CaloTrkVar",1);
90 mocchiut 1.7 //
91     this->Clear();
92 mocchiut 1.1 //
93     };
94    
95 mocchiut 1.8 /**
96     * Clear the CaloLevel2 object
97     **/
98 mocchiut 1.2 void CaloLevel2::Clear() {
99     //
100     CaloTrk->Clear();
101     //
102     nstrip = 0;
103     qtot = 0.;
104     impx = 0.;
105     impy = 0.;
106     tanx = 0.;
107     tany = 0.;
108     qmax = 0.;
109     nx22 = 0;
110     qx22 = 0.;
111     elen = 0.;
112     selen = 0.;
113 mocchiut 1.5 memset(perr, 0, 4*sizeof(Int_t));
114     memset(swerr, 0, 4*sizeof(Int_t));
115     memset(crc, 0, 4*sizeof(Int_t));
116     memset(qq, 0, 4*sizeof(Int_t));
117     memset(varcfit, 0, 2*sizeof(Float_t));
118     memset(npcfit, 0, 2*sizeof(Int_t));
119     memset(planemax, 0, 2*sizeof(Int_t));
120     memset(cibar, 0, 2*22*sizeof(Int_t));
121     memset(cbar, 0, 2*22*sizeof(Float_t));
122 mocchiut 1.2 good = 0;
123     selftrigger = 0;
124 mocchiut 1.9 //
125 mocchiut 1.2 };
126    
127 pam-fi 1.4
128     /**
129     * Fills a struct cCaloLevel2 with values from a CaloLevel2 object (to put data into a F77 common).
130     */
131     void CaloLevel2::GetLevel2Struct(cCaloLevel2 *l2) const {
132    
133     l2->good = good;
134     l2->selftrigger = selftrigger;
135     l2->nstrip = nstrip;
136     l2->nx22 = nx22;
137     l2->qtot = qtot;
138     l2->qx22 = qx22;
139     l2->qmax = qmax;
140     l2->impx = impx;
141     l2->impy = impy;
142     l2->tanx = tanx;
143     l2->tany = tany;
144     l2->elen = elen;
145     l2->selen = selen;
146    
147     for(Int_t i=0;i<2;i++){
148     l2->planemax[i] = planemax[i];
149     l2->varcfit[i] = varcfit[i];
150     l2->npcfit[i] = npcfit[i];
151     }
152     for(Int_t i=0;i<4;i++){
153     l2->perr[i] = perr[i];
154     l2->swerr[i] = swerr[i];
155     l2->calcrc[i] = crc[i];
156     l2->qq[i] = qq[i];
157     }
158    
159     l2->calntrk = CaloTrk->GetEntries();
160    
161     for(Int_t i=0;i<l2->calntrk;i++){
162     l2->caltrkseqno[i] = ((CaloTrkVar *)CaloTrk->At(i))->trkseqno;
163     l2->ncore[i] = ((CaloTrkVar *)CaloTrk->At(i))->ncore;
164     l2->noint[i] = ((CaloTrkVar *)CaloTrk->At(i))->noint;
165     l2->ncyl[i] = ((CaloTrkVar *)CaloTrk->At(i))->ncyl;
166     l2->nlast[i] = ((CaloTrkVar *)CaloTrk->At(i))->nlast;
167     l2->npre[i] = ((CaloTrkVar *)CaloTrk->At(i))->npre;
168     l2->npresh[i] = ((CaloTrkVar *)CaloTrk->At(i))->npresh;
169     l2->ntr[i] = ((CaloTrkVar *)CaloTrk->At(i))->ntr;
170     l2->planetot[i] = ((CaloTrkVar *)CaloTrk->At(i))->planetot;
171     l2->nlow[i] = ((CaloTrkVar *)CaloTrk->At(i))->nlow;
172     l2->qcore[i] =((CaloTrkVar *)CaloTrk->At(i))->qcore ;
173     l2->qcyl[i] = ((CaloTrkVar *)CaloTrk->At(i))->qcyl;
174     l2->qlast[i] = ((CaloTrkVar *)CaloTrk->At(i))->qlast;
175     l2->qpre[i] = ((CaloTrkVar *)CaloTrk->At(i))->qpre;
176     l2->qpresh[i] = ((CaloTrkVar *)CaloTrk->At(i))->qpresh;
177     l2->qtr[i] = ((CaloTrkVar *)CaloTrk->At(i))->qtr;
178     l2->qtrack[i] = ((CaloTrkVar *)CaloTrk->At(i))->qtrack;
179     l2->qtrackx[i] = ((CaloTrkVar *)CaloTrk->At(i))->qtrackx;
180     l2->qtracky[i] = ((CaloTrkVar *)CaloTrk->At(i))->qtracky;
181     l2->dxtrack[i] = ((CaloTrkVar *)CaloTrk->At(i))->dxtrack;
182     l2->dytrack[i] = ((CaloTrkVar *)CaloTrk->At(i))->dytrack;
183     l2->qmean[i] = ((CaloTrkVar *)CaloTrk->At(i))->qmean;
184     l2->qlow[i] = ((CaloTrkVar *)CaloTrk->At(i))->qlow;
185     l2->dX0l[i] = ((CaloTrkVar *)CaloTrk->At(i))->dX0l;
186 mocchiut 1.6 for (Int_t j=0; j<2; j++){
187     for (Int_t k=0; k<22; k++){
188     l2->tbar[i][k][j] = ((CaloTrkVar *)CaloTrk->At(i))->tbar[k][j];
189     };
190     };
191 pam-fi 1.4 }
192    
193     }
194    
195 mocchiut 1.1 /**
196 mocchiut 1.8 * Should return the energy in GeV if the particle would be an electron
197     * using a parametrization taken from Monte Carlo simulation
198     **/
199 mocchiut 1.1 void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){
200     if ( nstrip == 0 ) return;
201     energy = qtot * 40.82 * 0.000106;
202     sigma = 0.;
203     if ( energy > 0. ) sigma = energy * (0.01183 + 0.121/sqrt(energy));
204     return;
205     };
206    
207     /**
208     * Returns pointer to the set of track-related variables "itrk"
209     **/
210     CaloTrkVar *CaloLevel2::GetCaloTrkVar(Int_t itrk){
211     //
212     if(itrk >= ntrk()){
213     printf(" CaloLevel2 ERROR: track related variables set %i does not exists! \n",itrk);
214     printf(" stored track related variables = %i \n",ntrk());
215     return(NULL);
216     }
217     TClonesArray &t = *(CaloTrk);
218     CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
219     return calotrack;
220     }

  ViewVC Help
Powered by ViewVC 1.1.23