1 //**************************************************************************
2 //* This file is property of and copyright by the ALICE HLT Project *
3 //* ALICE Experiment at CERN, All rights reserved. *
5 //* Primary Authors: Gaute Ovrebekk <ovrebekk@ift.uib.no> *
6 //* for The ALICE HLT Project. *
8 //* Permission to use, copy, modify and distribute this software and its *
9 //* documentation strictly for non-commercial purposes is hereby granted *
10 //* without fee, provided that the above copyright notice appears in all *
11 //* copies and that both the copyright notice and this permission notice *
12 //* appear in the supporting documentation. The authors make no claims *
13 //* about the suitability of this software for any purpose. It is *
14 //* provided "as is" without express or implied warranty. *
15 //**************************************************************************
17 /** @file AliHLTV0HistoComponent.cxx
18 @author Gaute Ovrebekk
19 @brief Component for ploting charge in clusters
26 #include "AliHLTV0HistoComponent.h"
27 #include "AliCDBEntry.h"
28 #include "AliCDBManager.h"
31 #include "TObjString.h"
32 #include "TObjArray.h"
33 #include "AliKFParticle.h"
34 #include "AliKFVertex.h"
37 #include "AliESDEvent.h"
38 #include "AliESDtrack.h"
40 #include "AliHLTMessage.h"
42 //#include "AliHLTTPC.h"
46 /** ROOT macro for the implementation of ROOT specific class methods */
47 ClassImp(AliHLTV0HistoComponent)
49 AliHLTV0HistoComponent::AliHLTV0HistoComponent()
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
69 AliHLTV0HistoComponent::~AliHLTV0HistoComponent()
71 // see header file for class documentation
74 // Public functions to implement AliHLTComponent's interface.
75 // These functions are required for the registration process
77 const char* AliHLTV0HistoComponent::GetComponentID()
79 // see header file for class documentation
84 void AliHLTV0HistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
86 // see header file for class documentation
88 list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut );
91 AliHLTComponentDataType AliHLTV0HistoComponent::GetOutputDataType()
93 // see header file for class documentation
94 return kAliHLTDataTypeHistogram;
97 void AliHLTV0HistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
99 // see header file for class documentation
100 // XXX TODO: Find more realistic values.
105 AliHLTComponent* AliHLTV0HistoComponent::Spawn()
107 // see header file for class documentation
108 return new AliHLTV0HistoComponent;
111 int AliHLTV0HistoComponent::DoInit( int argc, const char** argv )
115 fGamma = new TH1F("hGamma","HLT: #gamma inv mass",50,-.05,.2);
116 fGamma->SetFillColor(kGreen);
118 fKShort = new TH1F("hKShort","HLT: K_{s}^{0} inv mass",80,0.4,.6);
119 fKShort->SetFillColor(kGreen);
120 fKShort->SetStats(0);
121 fLambda = new TH1F("hLambda","HLT: #Lambda^{0} inv mass",50,1.0,1.4);
122 fLambda->SetFillColor(kGreen);
123 fLambda->SetStats(0);
124 fAP = new TH2F("hAP","HLT: Armenteros-Podolanski plot",60,-1.,1.,60,0.,0.3);
125 fAP->SetMarkerStyle(8);
126 fAP->SetMarkerSize(0.4);
127 fAP->SetYTitle("p_{t}[GeV]");
128 fAP->SetXTitle("(p^{+}_{L}-p^{-}_{L})/(p^{+}_{L}+p^{-}_{L})");
130 fAP->SetOption("COLZ");
132 fGammaXY = new TH2F("hGammaXY","HLT: #gamma conversions",100,-100.,100.,100,-100.,100.);
133 fGammaXY->SetMarkerStyle(8);
134 fGammaXY->SetMarkerSize(0.4);
135 fGammaXY->SetYTitle("X[cm]");
136 fGammaXY->SetXTitle("Y[cm]");
137 fGammaXY->SetStats(0);
138 fGammaXY->SetOption("COLZ");
146 // [0] == 0 --- N clusters on each daughter track
147 // [1] == 2.5 --- (daughter-primVtx)/sigma >= cut
148 // [2] == 3.5 --- (v0 - primVtx)/sigma <= cut
149 // [3] == 3.0 --- (decay_length)/sigma >= cut
150 // [4] == 0.0 --- (decay_length)[cm] >= cut
151 // [5] == 300.0 --- (v0 radius)[cm] <= cut
152 // [6] == 3.5 --- (v0 mass - true value)/sigma <= cut (for identification)
153 // [7] == 0.05 --- (v0 mass - true value) <= cut (for identification)
160 fGammaCuts[5] = 300.0;
162 fGammaCuts[7] = 0.05;
183 fLambdaCuts[1] = 3.0;
184 fLambdaCuts[2] = 3.5;
185 fLambdaCuts[3] = 3.0;
186 fLambdaCuts[4] = 4.0;
187 fLambdaCuts[5] = 50.0;
188 fLambdaCuts[6] = 4.0;
189 fLambdaCuts[7] = 0.1;
192 TString configuration="";
194 for (int i=0; i<argc && iResult>=0; i++) {
196 if (!configuration.IsNull()) configuration+=" ";
197 configuration+=argument;
200 if (!configuration.IsNull()) {
201 iResult=Configure(configuration.Data());
207 int AliHLTV0HistoComponent::DoDeinit()
209 // see header file for class documentation
218 int AliHLTV0HistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
221 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
226 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
228 AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
229 event->GetStdContent();
230 Int_t nV0 = event->GetNumberOfV0s();
231 AliKFParticle::SetField( event->GetMagneticField() );
233 const double kKsMass = 0.49767;
234 const double kLambdaMass = 1.11568;
236 for (Int_t iv=0; iv<nV0; iv++) {
238 AliESDtrack *t1=event->GetTrack( event->GetV0(iv)->GetNindex());
239 AliESDtrack *t2=event->GetTrack( event->GetV0(iv)->GetPindex());
241 AliKFParticle kf1( *t1->GetInnerParam(), 11 );
242 AliKFParticle kf2( *t2->GetInnerParam(), 11 );
244 AliKFVertex primVtx( *event->GetPrimaryVertexTracks() );
245 double dev1 = kf1.GetDeviationFromVertex( primVtx );
246 double dev2 = kf2.GetDeviationFromVertex( primVtx );
248 AliKFParticle v0( kf1, kf2 );
249 double devPrim = v0.GetDeviationFromVertex( primVtx );
251 v0.SetProductionVertex( primVtx );
253 Double_t length, sigmaLength;
254 if( v0.GetDecayLength( length, sigmaLength ) ) continue;
256 double dx = v0.GetX()-primVtx.GetX();
257 double dy = v0.GetY()-primVtx.GetY();
258 double r = sqrt(dx*dx + dy*dy);
265 t1->GetTPCNcls()>=fGammaCuts[0]
266 && t2->GetTPCNcls()>=fGammaCuts[0]
267 && dev1>=fGammaCuts[1]
268 && dev2>=fGammaCuts[1]
269 && devPrim <= fGammaCuts[2]
270 && length >= fGammaCuts[3]*sigmaLength
271 && length >= fGammaCuts[4]
272 && r <= fGammaCuts[5]
275 v0.GetMass(mass,error);
276 if( fGamma ) fGamma->Fill( mass );
278 if( TMath::Abs(mass)<fGammaCuts[6]*error && TMath::Abs(mass)<fGammaCuts[7] ){
279 AliKFParticle gamma = v0;
280 gamma.SetMassConstraint(0);
281 if( fGammaXY ) fGammaXY->Fill(gamma.GetX(), gamma.GetY());
287 if( isGamma ) continue;
293 AliKFParticle kf01 = kf1, kf02 = kf2;
294 kf01.SetProductionVertex(v0);
295 kf02.SetProductionVertex(v0);
296 kf01.TransportToProductionVertex();
297 kf02.TransportToProductionVertex();
298 double px1=kf01.GetPx(), py1=kf01.GetPy(), pz1=kf01.GetPz();
299 double px2=kf02.GetPx(), py2=kf02.GetPy(), pz2=kf02.GetPz();
300 double px = px1+px2, py = py1+py2, pz = pz1+pz2;
301 double p = sqrt(px*px+py*py+pz*pz);
302 double l1 = (px*px1 + py*py1 + pz*pz1)/p;
303 double l2 = (px*px2 + py*py2 + pz*pz2)/p;
304 pt = sqrt(px1*px1+py1*py1+pz1*pz1 - l1*l1);
305 ap = (l1-l2)/(l1+l2);
309 t1->GetTPCNcls()>=fAPCuts[0]
310 && t2->GetTPCNcls()>=fAPCuts[0]
313 && devPrim <= fAPCuts[2]
314 && length >= fAPCuts[3]*sigmaLength
315 && length >= fAPCuts[4]
318 if( fAP ) fAP->Fill( ap, pt );
327 t1->GetTPCNcls()>=fKsCuts[0]
328 && t2->GetTPCNcls()>=fKsCuts[0]
331 && devPrim <= fKsCuts[2]
332 && length >= fKsCuts[3]*sigmaLength
333 && length >= fKsCuts[4]
337 AliKFParticle piN( *t1->GetInnerParam(), 211 );
338 AliKFParticle piP( *t2->GetInnerParam(), 211 );
340 AliKFParticle Ks( piN, piP );
341 Ks.SetProductionVertex( primVtx );
344 Ks.GetMass( mass, error);
345 if( fKShort ) fKShort->Fill( mass );
347 if( TMath::Abs( mass - kKsMass )<=fKsCuts[6]*error && TMath::Abs( mass - kKsMass )<=fKsCuts[7] ){
358 t1->GetTPCNcls()>=fLambdaCuts[0]
359 && t2->GetTPCNcls()>=fLambdaCuts[0]
360 && dev1>=fLambdaCuts[1]
361 && dev2>=fLambdaCuts[1]
362 && devPrim <= fLambdaCuts[2]
363 && length >= fLambdaCuts[3]*sigmaLength
364 && length >= fLambdaCuts[4]
365 && r <= fLambdaCuts[5]
366 && TMath::Abs( ap )>.4
369 AliKFParticle kP, kpi;
371 kP = AliKFParticle( *t2->GetInnerParam(), 2212 );
372 kpi = AliKFParticle( *t1->GetInnerParam(), 211 );
374 kP = AliKFParticle( *t1->GetInnerParam(), 2212 );
375 kpi = AliKFParticle( *t2->GetInnerParam(), 211 );
378 AliKFParticle lambda = AliKFParticle( kP, kpi );
379 lambda.SetProductionVertex( primVtx );
381 lambda.GetMass( mass, error);
382 if( fLambda ) fLambda->Fill( mass );
384 if( TMath::Abs( mass - kLambdaMass )<=fLambdaCuts[6]*error && TMath::Abs( mass - kKsMass )<=fLambdaCuts[7] ){
391 if( fGamma ) PushBack( (TObject*) fGamma, kAliHLTDataTypeHistogram,0);
393 if( fKShort ) PushBack( (TObject*) fKShort, kAliHLTDataTypeHistogram,0);
395 if( fLambda ) PushBack( (TObject*) fLambda, kAliHLTDataTypeHistogram, 0);
397 if( fAP ) PushBack( (TObject*) fAP, kAliHLTDataTypeHistogram,0);
399 if( fGammaXY ) PushBack( (TObject*) fGammaXY, kAliHLTDataTypeHistogram,0);
402 HLTInfo("Found %d Gammas, %d KShorts and %d Lambdas in %d events", fNGammas, fNKShorts, fNLambdas, fNEvents );
407 int AliHLTV0HistoComponent::Configure(const char* arguments)
411 if (!arguments) return iResult;
413 TString allArgs=arguments;
416 TObjArray* pTokens=allArgs.Tokenize(" ");
421 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
422 argument=((TObjString*)pTokens->At(i))->GetString();
423 if (argument.IsNull()) continue;
425 if (argument.CompareTo("-cutsGamma")==0) {
427 for( int j=0; j<8; j++ ){
428 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
430 spar+=((TObjString*)pTokens->At(i))->GetString();
431 fGammaCuts[j]=((TObjString*)pTokens->At(i))->GetString().Atof();
433 if( !bMissingParam ){
434 HLTInfo("Gamma cuts are set to: %s", spar.Data());
437 } else if (argument.CompareTo("-cutsAP")==0) {
439 for( int j=0; j<8; j++ ){
440 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
442 spar+=((TObjString*)pTokens->At(i))->GetString();
443 fAPCuts[j]=((TObjString*)pTokens->At(i))->GetString().Atof();
445 if( !bMissingParam ){
446 HLTInfo("AP cuts are set to: %s", spar.Data());
450 else if (argument.CompareTo("-cutsKs")==0) {
452 for( int j=0; j<8; j++ ){
453 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
455 spar+=((TObjString*)pTokens->At(i))->GetString();
456 fKsCuts[j]=((TObjString*)pTokens->At(i))->GetString().Atof();
458 if( !bMissingParam ){
459 HLTInfo("KShort cuts are set to: %s", spar.Data());
462 } else if (argument.CompareTo("-cutsLambda")==0) {
464 for( int j=0; j<8; j++ ){
465 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
467 spar+=((TObjString*)pTokens->At(i))->GetString();
468 fLambdaCuts[j]=((TObjString*)pTokens->At(i))->GetString().Atof();
470 if( !bMissingParam ){
471 HLTInfo("Lampda cuts are set to: %s", spar.Data());
475 HLTError("unknown argument %s", argument.Data());
486 int AliHLTV0HistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
488 // see header file for class documentation
490 const char* path="HLT/ConfigTPC/KryptonHistoComponent";
491 const char* defaultNotify="";
494 defaultNotify=" (default)";
497 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
498 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
500 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
502 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
503 iResult=Configure(pString->GetString().Data());
505 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
508 HLTError("can not fetch object \"%s\" from CDB", path);