]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTUpcTriggerComponent.cxx
removing obsolete classes, concept of event and run summary was not put into producti...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTUpcTriggerComponent.cxx
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Kyrre Skjerdal                                        *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
9 //* Permission to use, copy, modify and distribute this software and its   *
10 //* documentation strictly for non-commercial purposes is hereby granted   *
11 //* without fee, provided that the above copyright notice appears in all   *
12 //* copies and that both the copyright notice and this permission notice   *
13 //* appear in the supporting documentation. The authors make no claims     *
14 //* about the suitability of this software for any purpose. It is          *
15 //* provided "as is" without express or implied warranty.                  *
16 //**************************************************************************
17
18 /// @file   AliHLTUpcTriggerComponent.cxx
19 /// @author Kyrre Skjerdal
20 /// @date   2010-04-16
21 /// @brief  HLT trigger component for Ultra-Peripheral Collisions
22
23 // see header file for class documentation
24 // or
25 // refer to README to build package
26 // or
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
28
29
30 #include "AliHLTUpcTriggerComponent.h"
31 #include "AliESDEvent.h"
32 #include "AliHLTTriggerDecision.h"
33 #include "AliHLTDomainEntry.h"
34 ClassImp(AliHLTUpcTriggerComponent)
35
36 const char* AliHLTUpcTriggerComponent::GetTriggerName() const
37 {
38   //See header file for documentation
39   return "UpcTrigger";
40 }
41
42 AliHLTComponent* AliHLTUpcTriggerComponent::Spawn()
43 {
44   //See header file for documentation
45   return new AliHLTUpcTriggerComponent;
46 }
47
48 int AliHLTUpcTriggerComponent::DoTrigger()
49 {
50   //See header file for documentation
51   HLTInfo("Entering DoTrigger()");
52   const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
53   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
54   
55   if (esd != NULL){
56       esd->GetStdContent();     
57       //We skip events with no primary vertex reconstructed
58       if(!(PrimaryVertexReconstructed(esd))){
59         HLTWarning("No primary vertex reconstructed");
60         SetDescription("No reconstructed primary vertex. Not a candidate for an Ultra-peripheral Collison");
61         TriggerEvent(false);
62         return 0;
63       }
64       
65       Int_t nGoodRec = 0;
66       Int_t charge1 = 0;
67       Int_t charge2 = 0;
68       
69       for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++){
70         cout << "Track number: " << esd->GetNumberOfTracks() << endl;
71         AliESDtrack* track = esd->GetTrack(i);
72
73         Int_t nItsClusters = track->GetNcls(0);
74         Int_t nTpcClusters = track->GetNcls(1);
75
76         Float_t bxy = 0;
77         Float_t bz = 0;
78         track->GetImpactParametersTPC(bxy, bz);
79         
80         //Check if the track is comming from the primary vertex
81         Bool_t isPrimary = kFALSE;
82         if(fabs(bxy) < 1.5 && fabs(bz) < 1.5){
83           isPrimary = kTRUE;
84         }
85         
86         Int_t charge = track->Charge();    
87         
88         if(nItsClusters > 3 && nTpcClusters > 50 && isPrimary){
89           nGoodRec++;
90           if(nGoodRec == 1){
91             charge1 = charge;
92           } else if(nGoodRec == 2){
93             charge2 = charge;
94           }
95         }
96         
97       }
98       
99       //Demand two good tracks with opposite charge
100       if(nGoodRec == 2){
101         if(charge1 == -charge2){
102           SetDescription("Event is a candidate for an Ultra-peripheral Collision.");
103           // Enable the central detectors for readout.
104           GetReadoutList().Enable(
105
106                                   AliHLTReadoutList::kITSSPD |
107                                   AliHLTReadoutList::kITSSDD |
108                                   AliHLTReadoutList::kITSSSD |
109                                   AliHLTReadoutList::kTPC    |
110                                   AliHLTReadoutList::kTRD    |
111                                   AliHLTReadoutList::kTRD    |
112                                   AliHLTReadoutList::kTOF    |
113                                   AliHLTReadoutList::kHMPID  |
114                                   AliHLTReadoutList::kPHOS   
115                                   );
116           // Add the available HLT information for readout too.
117           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "ISPD");
118           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "ISDD");
119           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "ISSD");
120           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "ITPC");
121           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "ITRD");
122           GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "IPHOS");
123           TriggerEvent(true);
124           return 0;
125         }
126       }
127       
128   }else{
129     HLTFatal("No ESD found");
130     SetDescription("Not a candidate for an Ultra-peripheral Collision.");
131     TriggerEvent(false);
132     return 0;
133   }
134   SetDescription("Not a candidate for an Ultra-peripheral Collision.");
135   TriggerEvent(false);
136   return 0;
137 }
138
139 void AliHLTUpcTriggerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
140 {
141   //See header file for documentation
142   
143   constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
144   inputMultiplier = 1;
145 }
146
147
148 Bool_t AliHLTUpcTriggerComponent::PrimaryVertexReconstructed(const AliESDEvent *event) const
149
150   //See header file for documentation
151   
152   return (event->GetPrimaryVertex()->GetNContributors() > 0);
153 }