2424
2525#define ENABLE_UPGRADES
2626#include "ITSMFTSimulation/AlpideSimResponse.h"
27+ #include "ITS3Simulation/ChipSimResponse.h"
2728
2829#include "ITS3Base/SegmentationMosaix.h"
2930#include "fairlogger/Logger.h"
@@ -34,61 +35,71 @@ using SegmentationMosaix = o2::its3::SegmentationMosaix;
3435double um2cm (double um ) { return um * 1e-4 ; }
3536double cm2um (double cm ) { return cm * 1e+4 ; }
3637
37- o2 ::itsmft ::AlpideSimResponse * mAlpSimResp0 = nullptr ,
38- * mAlpSimResp1 = nullptr ,
39- * mAptSimResp1 = nullptr ;
38+ std ::unique_ptr < o2 ::its3 ::ChipSimResponse > mAlpSimResp0 , mAlpSimResp1 , mAptSimResp1 ;
4039
41- o2 ::itsmft :: AlpideSimResponse * loadResponse (const std ::string & fileName , const std ::string & respName )
40+ std :: unique_ptr < o2 ::its3 :: ChipSimResponse > loadResponse (const std ::string & fileName , const std ::string & respName )
4241{
4342 TFile * f = TFile ::Open (fileName .data ());
4443 if (!f ) {
4544 std ::cerr << fileName << " not found" << std ::endl ;
4645 return nullptr ;
4746 }
48- auto resp = ( o2 ::itsmft ::AlpideSimResponse * ) f -> Get (respName .data ());
49- if (!resp )
47+ auto base = f -> Get < o2 ::itsmft ::AlpideSimResponse > (respName .c_str ());
48+ if (!base ) {
5049 std ::cerr << respName << " not found in " << fileName << std ::endl ;
51- return resp ;
50+ return nullptr ;
51+ }
52+ return std ::make_unique < o2 ::its3 ::ChipSimResponse > (base );
5253}
5354
5455void LoadRespFunc ()
5556{
5657 std ::string AptsFile = "$(O2_ROOT)/share/Detectors/Upgrades/ITS3/data/ITS3ChipResponseData/APTSResponseData.root" ;
5758 std ::string AlpideFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root" ;
5859
60+ std ::cout << "=====================\n" ;
61+ LOGP (info , "ALPIDE Vbb=0V response" );
5962 mAlpSimResp0 = loadResponse (AlpideFile , "response0" ); // Vbb=0V
60- LOG ( info ) << "ALPIDE Vbb=0V response" << std :: endl ;
63+ mAlpSimResp0 -> computeCentreFromData () ;
6164 mAlpSimResp0 -> print ();
65+ LOGP (info , "Response Centre {}" , mAlpSimResp0 -> getRespCentreDep ());
66+ std ::cout << "=====================\n" ;
67+ LOGP (info , "ALPIDE Vbb=-3V response" );
6268 mAlpSimResp1 = loadResponse (AlpideFile , "response1" ); // Vbb=-3V
63- LOG ( info ) << "ALPIDE Vbb=-3V response" << std :: endl ;
69+ mAlpSimResp1 -> computeCentreFromData () ;
6470 mAlpSimResp1 -> print ();
71+ LOGP (info , "Response Centre {}" , mAlpSimResp1 -> getRespCentreDep ());
72+ std ::cout << "=====================\n" ;
73+ LOGP (info , "APTS response" );
6574 mAptSimResp1 = loadResponse (AptsFile , "response1" ); // APTS
66- LOG ( info ) << "APTS response" << std :: endl ;
75+ mAptSimResp1 -> computeCentreFromData () ;
6776 mAptSimResp1 -> print ();
77+ LOGP (info , "Response Centre {}" , mAptSimResp1 -> getRespCentreDep ());
78+ std ::cout << "=====================\n" ;
6879}
6980
70- std ::vector < float > getCollectionSeediciencies (o2 ::itsmft :: AlpideSimResponse * resp ,
81+ std ::vector < float > getCollectionSeediciencies (o2 ::its3 :: ChipSimResponse * resp ,
7182 const std ::vector < float > & depths )
7283{
7384 std ::vector < float > seed ;
7485 bool flipRow = false, flipCol = false;
7586 for (auto depth : depths ) {
7687 auto rspmat = resp -> getResponse (0.0 , 0.0 ,
77- um2cm (depth ) + resp -> getDepthMin () + 1.e-9 ,
88+ um2cm (depth ) + 1.e-9 ,
7889 flipRow , flipCol );
7990 seed .push_back (rspmat ? rspmat -> getValue (2 , 2 ) : 0.f );
8091 }
8192 return seed ;
8293}
8394
84- std ::vector < float > getShareValues (o2 ::itsmft :: AlpideSimResponse * resp ,
95+ std ::vector < float > getShareValues (o2 ::its3 :: ChipSimResponse * resp ,
8596 const std ::vector < float > & depths )
8697{
8798 std ::vector < float > share ;
8899 bool flipRow = false, flipCol = false;
89100 for (auto depth : depths ) {
90101 auto rspmat = resp -> getResponse (0.0 , 0.0 ,
91- um2cm (depth ) + resp -> getDepthMin () + 1.e-9 ,
102+ um2cm (depth ) + 1.e-9 ,
92103 flipRow , flipCol );
93104 float s = 0 ;
94105 int npix = resp -> getNPix ();
@@ -103,14 +114,14 @@ std::vector<float> getShareValues(o2::itsmft::AlpideSimResponse* resp,
103114 return share ;
104115}
105116
106- std ::vector < float > getEffValues (o2 ::itsmft :: AlpideSimResponse * resp ,
117+ std ::vector < float > getEffValues (o2 ::its3 :: ChipSimResponse * resp ,
107118 const std ::vector < float > & depths )
108119{
109120 std ::vector < float > all ;
110121 bool flipRow = false, flipCol = false;
111122 for (auto depth : depths ) {
112123 auto rspmat = resp -> getResponse (0.0 , 0.0 ,
113- um2cm (depth ) + resp -> getDepthMin () + 1.e-9 ,
124+ um2cm (depth ) + 1.e-9 ,
114125 flipRow , flipCol );
115126 float s = 0 ;
116127 int npix = resp -> getNPix ();
@@ -129,13 +140,16 @@ void CheckChipResponseFile()
129140 LoadRespFunc ();
130141 LOG (info ) << "Response function loaded" << std ::endl ;
131142
132- std ::vector < float > vecDepth (50 );
133- for (int i = 0 ; i < 50 ; ++ i )
134- vecDepth [i ] = i ;
143+ std ::vector < float > vecDepth ;
144+ int numPoints = 100 ;
145+ for (int i = 0 ; i < numPoints ; ++ i ) {
146+ float value = -50 + i * (100.0f / (numPoints - 1 ));
147+ vecDepth .push_back (value );
148+ }
135149
136150 int colors [ ] = {kOrange + 7 , kRed + 1 , kAzure + 4 };
137151 struct RespInfo {
138- o2 ::itsmft :: AlpideSimResponse * resp ;
152+ std :: unique_ptr < o2 ::its3 :: ChipSimResponse > & resp ;
139153 std ::string title ;
140154 int color ;
141155 };
@@ -145,7 +159,7 @@ void CheckChipResponseFile()
145159 {mAlpSimResp1 , "ALPIDE Vbb = -3 V ", colors [2 ]}};
146160
147161 TCanvas * c1 = new TCanvas ("c1 ", "c1 ", 800 , 600 );
148- TH1 * frame = c1 -> DrawFrame (-1 , -0.049 , 50 , 1.049 );
162+ TH1 * frame = c1 -> DrawFrame (-50 , -0.049 , 50 , 1.049 );
149163 frame -> SetTitle (";Depth(um);Charge Collection Seed / Share / Eff" );
150164 TLegend * leg = new TLegend (0.15 , 0.5 , 0.4 , 0.85 );
151165 leg -> SetFillStyle (0 );
@@ -154,11 +168,11 @@ void CheckChipResponseFile()
154168 for (auto& r : responses ) {
155169 if (!r .resp )
156170 continue ;
157- auto seed = getCollectionSeediciencies (r .resp , vecDepth );
158- auto shr = getShareValues (r .resp , vecDepth );
159- auto all = getEffValues (r .resp , vecDepth );
171+ auto seed = getCollectionSeediciencies (r .resp . get () , vecDepth );
172+ auto shr = getShareValues (r .resp . get () , vecDepth );
173+ auto all = getEffValues (r .resp . get () , vecDepth );
160174
161- TGraph * grSeed = new TGraph (vecDepth .size (), vecDepth .data (), seed .data ());
175+ auto grSeed = new TGraph (vecDepth .size (), vecDepth .data (), seed .data ());
162176 grSeed -> SetTitle (Form ("%s seed" , r .title .c_str ()));
163177 grSeed -> SetLineColor (r .color );
164178 grSeed -> SetLineWidth (2 );
@@ -168,7 +182,7 @@ void CheckChipResponseFile()
168182 grSeed -> Draw ("SAME LP" );
169183 leg -> AddEntry (grSeed , Form ("%s seed" , r .title .c_str ()), "lp" );
170184
171- TGraph * grShare = new TGraph (vecDepth .size (), vecDepth .data (), shr .data ());
185+ auto grShare = new TGraph (vecDepth .size (), vecDepth .data (), shr .data ());
172186 grShare -> SetLineColor (r .color );
173187 grShare -> SetLineWidth (2 );
174188 grShare -> SetMarkerColor (r .color );
@@ -177,7 +191,7 @@ void CheckChipResponseFile()
177191 grShare -> Draw ("SAME LP" );
178192 leg -> AddEntry (grShare , Form ("%s share" , r .title .c_str ()), "p" );
179193
180- TGraph * grEff = new TGraph (vecDepth .size (), vecDepth .data (), all .data ());
194+ auto grEff = new TGraph (vecDepth .size (), vecDepth .data (), all .data ());
181195 grEff -> SetLineColor (r .color );
182196 grEff -> SetLineWidth (2 );
183197 grEff -> SetMarkerColor (r .color );
0 commit comments