@@ -53,24 +53,13 @@ struct ft0CorrectedTable {
5353 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
5454 void init (o2::framework::InitContext&)
5555 {
56- if (doprocessStandard && doprocessWithBypassFT0timeInMC) {
57- LOG (fatal) << " Both processStandard and processWithBypassFT0timeInMC are enabled. Pick one of the two" ;
58- }
59- if (!doprocessStandard && !doprocessWithBypassFT0timeInMC) {
60- LOG (fatal) << " No process is enabled. Pick one" ;
61- }
6256 ccdb->setURL (cfgUrl);
6357 ccdb->setTimestamp (cfgTimestamp);
6458 ccdb->setCaching (true );
6559 ccdb->setLocalObjectValidityChecking ();
6660 // Not later than now objects
6761 ccdb->setCreatedNotAfter (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ());
6862
69- if (doprocessWithBypassFT0timeInMC) {
70- // From ps to ns
71- resoFT0A.value = resoFT0A.value / 1000 .f ;
72- resoFT0C.value = resoFT0C.value / 1000 .f ;
73- }
7463 if (!addHistograms) {
7564 return ;
7665 }
@@ -79,16 +68,11 @@ struct ft0CorrectedTable {
7968 histos.add (" t0AC" , " t0AC" , kTH1D , {{1000 , -1000 , 1000 , " t0AC (ns)" }});
8069 histos.add (" deltat0AC" , " deltat0AC" , kTH1D , {{1000 , -1 , 1 , " #Deltat0AC (ns)" }});
8170 histos.add (" deltat0ACps" , " deltat0ACps" , kTH1D , {{1000 , -1000 , 1000 , " #Deltat0AC (ps)" }});
82- if (doprocessWithBypassFT0timeInMC) {
83- histos.add (" MC/deltat0A" , " t0A" , kTH1D , {{1000 , -50 , 50 , " t0A (ps)" }});
84- histos.add (" MC/deltat0C" , " t0C" , kTH1D , {{1000 , -50 , 50 , " t0C (ps)" }});
85- histos.add (" MC/deltat0AC" , " t0AC" , kTH1D , {{1000 , -50 , 50 , " t0AC (ps)" }});
86- }
8771 }
8872
89- void processStandard (soa::Join<aod::Collisions, aod::EvSels> const & collisions,
90- BCsWithMatchings const &,
91- aod::FT0s const &)
73+ void process (soa::Join<aod::Collisions, aod::EvSels> const & collisions,
74+ BCsWithMatchings const &,
75+ aod::FT0s const &)
9276 {
9377 table.reserve (collisions.size ());
9478 float t0A = 1e10f;
@@ -126,95 +110,6 @@ struct ft0CorrectedTable {
126110 table (t0A, t0C);
127111 }
128112 }
129- PROCESS_SWITCH (ft0CorrectedTable, processStandard, " Process standard table (default)" , true );
130-
131- void processWithBypassFT0timeInMC (soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const & collisions,
132- soa::Join<BCsWithMatchings, aod::Timestamps> const & bcs,
133- aod::FT0s const &,
134- aod::McCollisions const &)
135- {
136- if (cfgCollisionSystem.value == -1 ) {
137- o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp <o2::parameters::GRPLHCIFData>(cfgPathGrpLhcIf,
138- bcs.iteratorAt (0 ).timestamp ());
139- cfgCollisionSystem.value = CollisionSystemType::getCollisionTypeFromGrp (grpo);
140- switch (cfgCollisionSystem.value ) {
141- case CollisionSystemType::kCollSyspp :
142- resoFT0A.value = 24 .f ;
143- resoFT0C.value = 24 .f ;
144- break ;
145- case CollisionSystemType::kCollSysPbPb :
146- resoFT0A.value = 5 .65f ;
147- resoFT0C.value = 5 .65f ;
148- break ;
149- default :
150- break ;
151- }
152- // Resolution is given in ps
153- resoFT0A.value = resoFT0A.value / 1000 .f ;
154- resoFT0C.value = resoFT0C.value / 1000 .f ;
155- }
156- table.reserve (collisions.size ());
157- float t0A = 1e10f;
158- float t0C = 1e10f;
159- float eventtimeMC = 1e10f;
160- float posZMC = 0 ;
161- bool hasMCcoll = false ;
162-
163- for (const auto & collision : collisions) {
164- hasMCcoll = false ;
165- eventtimeMC = 1e10f;
166- t0A = 1e10f;
167- t0C = 1e10f;
168- posZMC = 0 ;
169- const float vertexPV = collision.posZ ();
170- const float vertex_corr = vertexPV * invLightSpeedCm2NS;
171- constexpr float dummyTime = 30 .; // Due to HW limitations time can be only within range (-25,25) ns, dummy time is around 32 ns
172- if (collision.has_mcCollision ()) {
173- hasMCcoll = true ;
174- const auto & collisionMC = collision.mcCollision ();
175- eventtimeMC = collisionMC.t ();
176- posZMC = collisionMC.posZ ();
177- }
178- if (collision.has_foundFT0 ()) {
179- const auto & ft0 = collision.foundFT0 ();
180- const std::bitset<8 >& triggers = ft0.triggerMask ();
181- const bool ora = triggers[o2::ft0::Triggers::bitA];
182- const bool orc = triggers[o2::ft0::Triggers::bitC];
183-
184- if (ora && ft0.timeA () < dummyTime) {
185- t0A = ft0.timeA ();
186- if (hasMCcoll) {
187- const float diff = eventtimeMC - posZMC * invLightSpeedCm2NS + gRandom ->Gaus (0 .f , resoFT0A);
188- t0A = diff;
189- }
190- t0A += vertex_corr;
191- }
192- if (orc && ft0.timeC () < dummyTime) {
193- t0C = ft0.timeC ();
194- if (hasMCcoll) {
195- const float diff = eventtimeMC + posZMC * invLightSpeedCm2NS + gRandom ->Gaus (0 .f , resoFT0C);
196- t0C = diff;
197- }
198- t0C -= vertex_corr;
199- }
200- }
201- LOGF (debug, " T0 collision time T0A = %f, T0C = %f" , t0A, t0C);
202- if (addHistograms) {
203- histos.fill (HIST (" t0A" ), t0A);
204- histos.fill (HIST (" t0C" ), t0C);
205- histos.fill (HIST (" t0AC" ), (t0A + t0C) * 0 .5f );
206- histos.fill (HIST (" deltat0AC" ), t0A - t0C);
207- if (hasMCcoll) {
208- histos.fill (HIST (" MC/deltat0A" ), (t0A - eventtimeMC) * 1000 .f );
209- histos.fill (HIST (" MC/deltat0C" ), (t0C - eventtimeMC) * 1000 .f );
210- histos.fill (HIST (" MC/deltat0AC" ), ((t0A + t0C) * 0 .5f - eventtimeMC) * 1000 .f );
211- }
212- }
213- table (t0A, t0C);
214- }
215- }
216- // Commented out, not used anymore
217- // PROCESS_SWITCH(ft0CorrectedTable, processWithBypassFT0timeInMC, "Process MC with bypass of the AO2D information. Use with care!", false);
218113};
219114
220115WorkflowSpec defineDataProcessing (ConfigContext const & cfgc) { return WorkflowSpec{adaptAnalysisTask<ft0CorrectedTable>(cfgc)}; }
0 commit comments