+Int_t AliEvent::GetNcalorimeters()
+{
+// Provide the number of stored calorimeter systems
+ return fNcals;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::AddCalorimeter(AliCalorimeter& c)
+{
+// Add a calorimeter system to the event
+ if (!fCalorimeters)
+ {
+ fCalorimeters=new TObjArray();
+ if (fCalCopy) fCalorimeters->SetOwner();
+ }
+
+ // Add the calorimeter system to this event
+ fNcals++;
+ if (fCalCopy)
+ {
+ fCalorimeters->AddLast((AliCalorimeter*)c.Clone());
+ }
+ else
+ {
+ fCalorimeters->AddLast(&c);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetCalCopy(Int_t j)
+{
+// (De)activate the creation of private copies of the added calorimeters.
+// j=0 ==> No private copies are made; pointers of original cals. are stored.
+// j=1 ==> Private copies of the cals. are made and these pointers are stored.
+//
+// Note : Once the storage contains pointer(s) to AliCalorimeter(s) one cannot
+// change the CalCopy mode anymore.
+// To change the CalCopy mode for an existing AliEvent containing
+// calorimeters one first has to invoke Reset().
+ if (!fCalorimeters)
+ {
+ if (j==0 || j==1)
+ {
+ fCalCopy=j;
+ }
+ else
+ {
+ cout << "*AliEvent::SetCalCopy* Invalid argument : " << j << endl;
+ }
+ }
+ else
+ {
+ cout << "*AliEvent::SetCalCopy* Storage already contained calorimeters."
+ << " ==> CalCopy mode not changed." << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliEvent::GetCalCopy()
+{
+// Provide value of the CalCopy mode.
+// 0 ==> No private copies are made; pointers of original cals. are stored.
+// 1 ==> Private copies of the cals. are made and these pointers are stored.
+ return fCalCopy;
+}
+///////////////////////////////////////////////////////////////////////////
+AliCalorimeter* AliEvent::GetCalorimeter(Int_t i)
+{
+// Return the i-th calorimeter of this event
+ if (!fCalorimeters)
+ {
+ cout << " *AliEvent::GetCalorimeter* No calorimeters present." << endl;
+ return 0;
+ }
+ else
+ {
+ if (i<=0 || i>fNcals)
+ {
+ cout << " *AliEvent::GetCalorimeter* Invalid argument i : " << i
+ << " Ncals = " << fNcals << endl;
+ return 0;
+ }
+ else
+ {
+ return (AliCalorimeter*)fCalorimeters->At(i-1);
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+AliCalorimeter* AliEvent::GetCalorimeter(TString name)
+{
+// Return the calorimeter with name tag "name"
+ if (!fCalorimeters)
+ {
+ cout << " *AliEvent::GetCalorimeter* No calorimeters present." << endl;
+ return 0;
+ }
+ else
+ {
+ AliCalorimeter* cx;
+ TString s;
+ for (Int_t i=0; i<fNcals; i++)
+ {
+ cx=(AliCalorimeter*)fCalorimeters->At(i);
+ if (cx)
+ {
+ s=cx->GetName();
+ if (s == name) return cx;
+ }
+ }
+
+ return 0; // No matching name found
+ }
+}
+///////////////////////////////////////////////////////////////////////////